object RequireTypes
Encapsulates those classes and their utility methods which enforce a given invariant via the use of require.
- Alphabetic
- By Inheritance
- RequireTypes
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class ExistingFile(file: File) extends NoCopy with Product with Serializable
- sealed trait LengthLimitedString 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. Classes implementing this trait expose
create
andtryCreate
methods to safely (and non-safely) construct such a String.The canonical use case for LengthLimitedString's 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 intoLengthLimitedString
s). On the client side, e.g. at the console, we generally take normal String types. The console commandset_display_name
and serviceGrpcPartyNameManagementService
validatingrequest.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)
CLOB is only used for the following values (none are indices): - V1_1 source_description - v4 agreement_text - v8 ignore_reason - v13 connection_uri - v28_1 error_message
- trait LengthLimitedStringCompanion[A <: LengthLimitedString] extends AnyRef
Trait that implements method commonly needed in the companion object of a LengthLimitedString
- final case class LengthLimitedStringVar(str: String, maxLength: Int)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable
- 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
- 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
- final case class NonEmptyString(str: String) extends NoCopy with Product with Serializable
- type NonNegativeInt = NonNegativeNumeric[Int]
- sealed abstract case class NonNegativeNumeric[T] extends RefinedNumeric[T] with Product with Serializable
- final case class Port(n: Int) extends Ordered[Port] with PrettyPrinting with NoCopy with Product with Serializable
- type PositiveInt = PositiveNumeric[Int]
- sealed abstract case class PositiveNumeric[T] extends RefinedNumeric[T] with Product with Serializable
- sealed trait RefinedNumeric[T] extends Ordered[RefinedNumeric[T]] with PrettyPrinting
- final case class String185(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable
Limit used by com.digitalasset.canton.topology.Identifier.
Limit used by com.digitalasset.canton.topology.Identifier.
- See also
com.digitalasset.canton.topology.Identifier for documentation on its origin
- 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
- final case class String3(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable
Limit used for enum names.
- 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
- final case class String36(str: String)(name: Option[String] = None) extends LengthLimitedString with Product with Serializable
Limit used by a UUID.
- 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
- 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
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- object ExistingFile extends Serializable
- object LengthLimitedString
- object LengthLimitedStringVar extends Serializable
- object NonEmptyString extends Serializable
- object NonNegativeInt
- object NonNegativeNumeric extends Serializable
- object Port extends Serializable
- object PositiveInt
- object PositiveNumeric extends Serializable
- object String185 extends LengthLimitedStringCompanion[String185] with Serializable
- object String255 extends LengthLimitedStringCompanion[String255] with Serializable
- object String3 extends LengthLimitedStringCompanion[String3] with Serializable
- object String300 extends LengthLimitedStringCompanion[String300] with Serializable
- object String36 extends LengthLimitedStringCompanion[String36] with Serializable
- object String68 extends LengthLimitedStringCompanion[String68] with Serializable
- object String73 extends LengthLimitedStringCompanion[String73] with Serializable