Packages

p

com.digitalasset.canton

serialization

package serialization

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

  1. case class DeserializationError(message: String, bytes: ByteString) extends PrettyPrinting with Product with Serializable
  2. trait HasCryptographicEvidence extends HasVersionedToByteString

    Trait for deterministically serializing an object to a com.google.protobuf.ByteString.

    Trait for deterministically serializing an object to a com.google.protobuf.ByteString.

    A class should extend this trait to indicate that the serialize method yields the same ByteString if invoked several times. Typical use cases of this behavior include:

    • Classes that represent a leaf of a Merkle tree.
    • Classes that represent content that is signed e.g. Hash or SignedProtocolMessageContent.
    • Classes that are mere wrappers of ByteString (for convenience of the caller) e.g. AuthenticationToken.

    If a class merely represents content that is transmitted over a network, the class does not need to extend this trait.

    It is strongly recommended to extend this trait by mixing in MemoizedEvidence or MemoizedEvidenceWithFailure, instead of directly extending this trait.

    Classes C implementing HasCryptographicEvidence must define a fromByteString: ByteString => C method in their companion object that converts a serialization back into an equal object. In particular, c.fromByteString(byteString).toByteString must equal byteString.

  3. trait MemoizedEvidence extends HasCryptographicEvidence

    Effectively immutable HasCryptographicEvidence classes can mix in this trait to implement the memoization logic.

    Effectively immutable HasCryptographicEvidence classes can mix in this trait to implement the memoization logic.

    Use this class if serialization always succeeds.

    Make sure that fromByteString(byteString).deserializedFrom equals Some(byteString).

    Make sure that every public constructor and apply method yields an instance with deserializedFrom == None.

    See also

    MemoizedEvidenceWithFailure if serialization may fail

  4. trait MemoizedEvidenceWithFailure[SerializationError] extends HasCryptographicEvidence with NoCopy

    Effectively immutable HasCryptographicEvidence classes can mix in this trait to implement the memoization logic.

    Effectively immutable HasCryptographicEvidence classes can mix in this trait to implement the memoization logic.

    Use this class if serialization may fail. This mix-in checks whenever an object is constructed that either a serialization is given or that serialization will succeed. It also ensures that no copy method is generated for case classes with this mixin.

    Make sure that fromByteString(byteString).deserializedFrom equals Some(byteString).

    Make sure that every public constructor and apply method yields an instance with deserializedFrom == None.

    SerializationError

    The type of serialization errors

    Exceptions thrown

    SerializationCheckFailed if the serialization fails

    See also

    MemoizedEvidence if serialization always succeeds.

  5. trait ProtoConverter[A, Proto, Err] extends AnyRef

    Can convert messages to and from proto objects

    Can convert messages to and from proto objects

    A

    type of the message to be serialized

    Proto

    type of the proto message

    Err

    type of deserialization errors

  6. case class SerializationCheckFailed[+E](serializationError: E) extends Exception with Product with Serializable

    Thrown by MemoizedEvidenceWithFailure classes during object construction if the serialization fails.

    Thrown by MemoizedEvidenceWithFailure classes during object construction if the serialization fails.

    E

    The type of errors that serialization may return

    serializationError

    The error raised during the serialization

Value Members

  1. object DeterministicEncoding

    The methods in this object should be used when a deterministic encoding is needed.

    The methods in this object should be used when a deterministic encoding is needed. They are not meant for computing serializations for a wire format. Protobuf is a better choice there.

  2. object ProtoConverter

Ungrouped