PayloadCodec

peloton.persistence.PayloadCodec
trait PayloadCodec[A]

An encoder and decoder type class for a given payload type A

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class JsonPayloadCodec[A]

Members list

Value members

Abstract methods

def decode(bytes: Array[Byte]): IO[A]

Decodes (deserializes) a payload of type A from a given byte array

Decodes (deserializes) a payload of type A from a given byte array

This method is effectful (because decoding could fail) and is therefore wrapped in an IO context.

Value parameters

bytes

A raw byte array

Attributes

Returns

An IO effect that returns the decoded payload of type A on success

def encode(payload: A): IO[Array[Byte]]

Encodes (serializes) a given payload of type A to a raw byte array.

Encodes (serializes) a given payload of type A to a raw byte array.

This method is effectful (because encoding could fail) and is therefore wrapped in an IO context.

Value parameters

payload

The payload of type A

Attributes

Returns

An IO effect that returns an Array[Byte] on success