Packages

o

com.digitalasset.canton.config

CantonRequireTypes

object CantonRequireTypes

Encapsulates those classes and their utility methods which enforce a given invariant via the use of require.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CantonRequireTypes
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed trait AbstractLengthLimitedString extends NoCopy

    This trait wraps a String that is limited to a certain maximum length.

    This trait wraps a String that is limited to a certain maximum length. The canonical use case is ensuring that we don't write too long strings into the database.

    You should normally implement LengthLimitedString or use its subclasses, for strings to be stored in standard string columns.

    As this class implements fewer checks, this also serves as the basis for longer strings such as CLOBs.

  2. final case class InstanceName extends NoCopy with PrettyPrinting with Product with Serializable
  3. sealed trait LengthLimitedString extends AbstractLengthLimitedString

    This trait wraps a String that is limited to a certain maximum length.

    This trait wraps a String that is limited to a certain maximum length. Classes implementing this trait expose create and tryCreate methods to safely (and non-safely) construct such a String.

    The canonical use case for LengthLimitedStrings is ensuring that we don't write too long strings into the database: Oracle has a length-limit of 1000 Unicode characters for the ordinary String type NVARCHAR2 and we are trying to avoid the use of CLOB (as it has pitfalls regarding implicits). This validation generally occurs on the server side and not on the client side. Concretely, this means that the Admin API and Ledger API gRPC services is the point where we validate that the received Protobuf Strings are not too long (and convert them into LengthLimitedStrings). On the client side, e.g. at the console, we generally take normal String types. The console command set_display_name and service com.digitalasset.canton.participant.admin.grpc.GrpcPartyNameManagementService validating request.displayName illustrate this.

    As a rule of thumb: whenever you want to create a column that uses a NVARCHAR2 in Oracle, the value you write to it should use a LengthLimitedString.

    Some more background on the Oracle issues: NVARCHAR and NVARCHAR2 have both by default a 4000 byte limit, but unicode uses 4-bytes per character (and nvarchar2 uses unicode) Therefore, NVARCHAR has a limit of 4000 and NVARCHAR2 has a limit of 1000 characters If need be, we can extend this to 32 KB by setting the Oracle database string size to 'extended mode' (ALTER SYSTEM SET MAX_STRING_SIZE=EXTENDED)

    For longer strings, directly inherit from AbstractLengthLimitedString.

  4. trait LengthLimitedStringCompanion[A <: AbstractLengthLimitedString] extends AnyRef

    Trait that implements method commonly needed in the companion object of an AbstractLengthLimitedString

  5. final case class LengthLimitedStringVar(str: String, maxLength: Int)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable
  6. trait LengthLimitedStringWrapper extends AnyRef

    Trait for case classes that are a wrapper around a LengthLimitedString.

    Trait for case classes that are a wrapper around a LengthLimitedString.

    See also

    com.digitalasset.canton.crypto.CertificateId for an example

  7. trait LengthLimitedStringWrapperCompanion[A <: LengthLimitedString, Wrapper <: LengthLimitedStringWrapper] extends AnyRef

    Trait that implements utility methods to avoid boilerplate in the companion object of a case class that wraps a LengthLimitedString type using LengthLimitedStringWrapper.

    Trait that implements utility methods to avoid boilerplate in the companion object of a case class that wraps a LengthLimitedString type using LengthLimitedStringWrapper.

    See also

    com.digitalasset.canton.crypto.CertificateId for an example

  8. final case class NonEmptyString(str: String) extends NoCopy with Product with Serializable
  9. final case class String1(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable
  10. final case class String100(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable
  11. final case class String185(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable

    Limit used by com.digitalasset.canton.topology.Identifier.

    See also

    com.digitalasset.canton.topology.Identifier for documentation on its origin

  12. final case class String2066(str: String)(name: Option[String] = None) extends AbstractLengthLimitedString with Product with Serializable

    Length limitation for an com.digitalasset.canton.protocol.LfTemplateId.

    Length limitation for an com.digitalasset.canton.protocol.LfTemplateId. A com.digitalasset.canton.protocol.LfTemplateId consists of - The module name (com.daml.lf.data.Ref.DottedName) - The template name (com.daml.lf.data.Ref.DottedName) - The package ID - Two separating dots Each com.daml.lf.data.Ref.DottedName can have 1000 chars (com.daml.lf.data.Ref.DottedName.maxLength). So a com.digitalasset.canton.protocol.LfTemplateId serializes to 1000 + 1000 + 64 + 2 = 2066 chars.

    2066 is beyond the string size for Oracle's NVARCHAR2 column type unless max_string_size is set to extended. Such strings may therefore be written into VARCHAR2 columns using an encoding that does not exceed the 4000 bytes limit. UTF8 is such an encoding for ASCII-only strings, but we do not yet test that str really contains only ASCII characters.

  13. final case class String255(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable

    Default LengthLimitedString that should be used when in doubt.

    Default LengthLimitedString that should be used when in doubt. 255 was chosen as it is also the limit used in the upstream code for, e.g., LedgerStrings in the upstream code

    name

    optionally set it to improve the error message. It is given as an extra argument, so the automatically generated equals-method doesn't use it for comparison

  14. final case class String256M(str: String)(name: Option[String] = None) extends AbstractLengthLimitedString with Product with Serializable

    Length limitation of a TEXT or unbounded VARCHAR field in postgres or CLOB in Oracle.

    Length limitation of a TEXT or unbounded VARCHAR field in postgres or CLOB in Oracle. - Postgres TEXT or VARCHAR support up to 1GB storage. That is at least 2 28 characters in UTF8 encoding as each character needs at most 4 bytes. - Oracle CLOB supports up to 4GB storage, i.e., at least 2 30 UTF8 characters

    TEXT/VARCHAR/CLOB are only used for the following values (none are indices): - daml_packages.source_description - service_agreements.agreement_text - topology_transactions.ignore_reason - sequencer_events.error_message

  15. final case class String3(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable

    Limit used for enum names.

  16. final case class String300(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable

    Longest limited-length strings that have been needed so far.

    Longest limited-length strings that have been needed so far. Typical use case: when a 255-length identifier is combined with other short suffixes or prefixes to further specialize them.

    See also

    com.digitalasset.canton.store.db.SequencerClientDiscriminator

    com.digitalasset.canton.crypto.KeyName

  17. final case class String36(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable

    Limit used by a UUID.

  18. final case class String68(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable

    Limit used by a hash (SHA256 in particular) in a com.digitalasset.canton.topology.UniqueIdentifier.

    Limit used by a hash (SHA256 in particular) in a com.digitalasset.canton.topology.UniqueIdentifier.

    See also

    com.digitalasset.canton.topology.UniqueIdentifier for documentation on its origin

  19. final case class String73(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable

    Limit used by a com.digitalasset.canton.sequencing.protocol.MessageId.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  14. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  19. object InstanceName extends Serializable
  20. object LengthLimitedString
  21. object LengthLimitedStringVar extends Serializable
  22. object NonEmptyString extends Serializable
  23. object String1 extends LengthLimitedStringCompanion[String1] with Serializable
  24. object String100 extends LengthLimitedStringCompanion[String100] with Serializable
  25. object String185 extends LengthLimitedStringCompanion[String185] with Serializable
  26. object String2066 extends LengthLimitedStringCompanion[String2066] with Serializable
  27. object String255 extends LengthLimitedStringCompanion[String255] with Serializable
  28. object String256M extends LengthLimitedStringCompanion[String256M] with Serializable
  29. object String3 extends LengthLimitedStringCompanion[String3] with Serializable
  30. object String300 extends LengthLimitedStringCompanion[String300] with Serializable
  31. object String36 extends LengthLimitedStringCompanion[String36] with Serializable
  32. object String68 extends LengthLimitedStringCompanion[String68] with Serializable
  33. object String73 extends LengthLimitedStringCompanion[String73] with Serializable

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped