trait BaseVersioningCompanion[ValueClass <: HasRepresentativeProtocolVersion, Context, DeserializedValueClass <: HasRepresentativeProtocolVersion, Dependency] extends AnyRef
This trait has the logic to store proto (de)serializers and retrieve them by protocol version.
Parameters and concepts are explained in contributing guide
- Alphabetic
- By Inheritance
- BaseVersioningCompanion
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type Codec = ProtoCodec[ValueClass, Context, DeserializedValueClass, BaseVersioningCompanion.this.type, Dependency]
- type Deserializer = (Context, OriginalByteString, DataByteString) => ParsingResult[DeserializedValueClass]
- type Invariants = Seq[Invariant[ValueClass, BaseVersioningCompanion.this.type]]
- Attributes
- protected
- type ThisRepresentativeProtocolVersion = RepresentativeProtocolVersion[BaseVersioningCompanion.this.type]
- Attributes
- protected
- type VersioningTable = SupportedProtoVersions[ValueClass, Context, DeserializedValueClass, BaseVersioningCompanion.this.type, Dependency]
Abstract Value Members
- abstract def name: String
The name of the class as used for pretty-printing and error reporting
- abstract def versioningTable: VersioningTable
Proto versions that are supported by
fromByteString
See the helpersupportedProtoVersion
below to define aParser
.
Concrete 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]) @IntrinsicCandidate() @native()
- def converterFor(protocolVersion: RepresentativeProtocolVersion[BaseVersioningCompanion.this.type]): ParsingResult[Codec]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fromByteString(expectedProtocolVersion: ProtocolVersionValidation, bytes: OriginalByteString)(implicit ev: =:=[Unit, Context]): ParsingResult[DeserializedValueClass]
Alias of fromByteString that can be used when there is no context.
- def fromByteString(expectedProtocolVersion: ProtocolVersion, bytes: OriginalByteString)(implicit ev: =:=[Unit, Context]): ParsingResult[DeserializedValueClass]
Alias of fromByteString that can be used when there is no context.
- def fromByteString(expectedProtocolVersion: ProtocolVersion, context: Context)(bytes: OriginalByteString): ParsingResult[DeserializedValueClass]
- def fromByteString(expectedProtocolVersion: ProtocolVersionValidation, context: Context, bytes: OriginalByteString): ParsingResult[DeserializedValueClass]
Main deserialization method to parse a byte string
Main deserialization method to parse a byte string
- expectedProtocolVersion
Protocol version used by the synchronizer
- context
Context for the deserialization (() if there is no context)
- bytes
Byte string to be deserialized
- returns
Deserialized value class (as a Right) or a ProtoDeserializationError (as a left) Variants of this method (e.g., when Context=unit) are provided below for convenience.
- def fromByteStringPV(expectedProtocolVersion: ProtocolVersion, bytes: OriginalByteString)(implicit ev: =:=[ProtocolVersion, Context]): ParsingResult[DeserializedValueClass]
Alias of fromByteString that can be used when the Context is a com.digitalasset.canton.version.ProtocolVersion.
- def fromByteStringPVV(expectedProtocolVersion: ProtocolVersionValidation, bytes: OriginalByteString)(implicit ev: =:=[ProtocolVersionValidation, Context]): ParsingResult[DeserializedValueClass]
Alias of fromByteString that can be used when the Context is a com.digitalasset.canton.version.ProtocolVersionValidation.
- def fromTrustedByteArray(bytes: Array[Byte])(implicit ev: =:=[Unit, Context]): ParsingResult[DeserializedValueClass]
- def fromTrustedByteArray(context: Context, bytes: Array[Byte]): ParsingResult[DeserializedValueClass]
Deserializes the given bytes without validation.
Deserializes the given bytes without validation.
Unsafe! Do NOT use this method unless you can justify that the given bytes originate from a trusted source. For example, this should be the case for deserialization of data that originates from a database.
- bytes
trusted bytes with an embedded proto version
- def fromTrustedByteString(bytes: OriginalByteString)(implicit ev: =:=[Unit, Context]): ParsingResult[DeserializedValueClass]
Alias of fromTrustedByteString that can be used when there is no context.
- def fromTrustedByteString(context: Context)(bytes: OriginalByteString): ParsingResult[DeserializedValueClass]
Deserializes the given bytes without validation.
Deserializes the given bytes without validation.
Unsafe! Do NOT use this method unless you can justify that the given bytes originate from a trusted source. For example, this should be the case for deserialization of data that originates from a database.
- bytes
trusted bytes with an embedded proto version
- def fromTrustedByteStringPVV(bytes: OriginalByteString)(implicit ev: =:=[ProtocolVersionValidation, Context]): ParsingResult[DeserializedValueClass]
Since dependency on the ProtocolVersionValidation is encoded in the context, one still has to provide
ProtocolVersionValidation.NoValidation
even when callingfromTrustedByteString
, which is counterintuitive.Since dependency on the ProtocolVersionValidation is encoded in the context, one still has to provide
ProtocolVersionValidation.NoValidation
even when callingfromTrustedByteString
, which is counterintuitive. This method allows a simpler call if the Context is a com.digitalasset.canton.version.ProtocolVersionValidation - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def invariants: Seq[Invariant[ValueClass, BaseVersioningCompanion.this.type]]
- 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
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def parseDelimitedFromTrusted(input: InputStream)(implicit ev: =:=[Unit, Context]): Option[ParsingResult[DeserializedValueClass]]
- def parseDelimitedFromTrusted(input: InputStream, context: Context): Option[ParsingResult[DeserializedValueClass]]
Deserializes a message using a delimiter (the message length) from the given input stream.
Deserializes a message using a delimiter (the message length) from the given input stream.
Unsafe! No deserialization validation is performed.
Do NOT use this method unless you can justify that the given bytes originate from a trusted source.
This method works in conjunction with com.digitalasset.canton.version.HasProtocolVersionedWrapper.writeDelimitedTo which should have been used to serialize the message. It is useful for deserializing multiple messages from a single input stream through repeated invocations.
Deserialization is only supported for com.digitalasset.canton.version.VersionedMessage.
- input
the source from which a message is deserialized
- returns
an Option that is None when there are no messages left anymore, otherwise it wraps an Either where left represents a deserialization error (exception) and right represents the successfully deserialized message
- def protoVersionFor(protocolVersion: ProtocolVersion): ProtoVersion
Return the Proto version corresponding to the protocol version
- def protoVersionFor(protocolVersion: RepresentativeProtocolVersion[BaseVersioningCompanion.this.type]): ProtoVersion
Return the Proto version corresponding to the representative protocol version
- def protocolVersionRepresentativeFor(protoVersion: ProtoVersion): ParsingResult[RepresentativeProtocolVersion[BaseVersioningCompanion.this.type]]
- def protocolVersionRepresentativeFor(protocolVersion: ProtocolVersion): RepresentativeProtocolVersion[BaseVersioningCompanion.this.type]
- def readFromTrustedFile(inputFile: String)(implicit ev: =:=[Unit, Context]): Either[String, DeserializedValueClass]
- def readFromTrustedFile(context: Context, inputFile: String): Either[String, DeserializedValueClass]
Deserializes the data from the given file without validation.
Deserializes the data from the given file without validation.
Unsafe! Do NOT use this method unless you can justify that the data originates from a trusted source.
- def readFromTrustedFilePVV(inputFile: String)(implicit ev: =:=[ProtocolVersionValidation, Context]): Either[String, DeserializedValueClass]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tryReadFromTrustedFile(inputFile: String)(implicit ev: =:=[Unit, Context]): DeserializedValueClass
- def tryReadFromTrustedFile(context: Context, inputFile: String): DeserializedValueClass
- def validateInstance(instance: ValueClass, representativeProtocolVersion: ThisRepresentativeProtocolVersion): Either[String, Unit]
Will check that default value rules defined in invariants hold.
- 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 VersioningTable