peloton.persistence

Members list

Type members

Classlikes

trait Driver

A driver is able to create an instances of DurableStateStore or EventStore as a Resource.

A driver is able to create an instances of DurableStateStore or EventStore as a Resource.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Driver

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Driver.type
final case class DurableState[A](payload: A, revision: Long, timestamp: Long)

The durable (i.e. persistent) state of an actor.

The durable (i.e. persistent) state of an actor.

Type parameters

A

the type of the payload

Value parameters

payload

the payload, i.e., the state of an actor that os to be persisted.

revision

the revision of the payload

timestamp

the timestamp when this revision was written (in UNIX epoch milliseconds)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
abstract class DurableStateStore

The persistence layer typeclass for a given state class A that provides methods to store and retrieve instances of type A from and to a specific storage backend.

The persistence layer typeclass for a given state class A that provides methods to store and retrieve instances of type A from and to a specific storage backend.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
final case class EncodedEvent(payload: Array[Byte], timestamp: Long, isSnapshot: Boolean)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class EncodedState(payload: Array[Byte], revision: Long, timestamp: Long)

A version of DurableState where the payload is no longer typed, but encoded to an array of Byte.

A version of DurableState where the payload is no longer typed, but encoded to an array of Byte.

Value parameters

payload

the encoded payloadan an Array[Byte]

revision

the revision of the payload

timestamp

the timestamp when this revision was written (in UNIX epoch milliseconds)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Event[A](payload: A, timestamp: Long)

A container to store the events of an event sourced actor as its payload.

A container to store the events of an event sourced actor as its payload.

Type parameters

A

the type of the payload

Value parameters

payload

the typed (unencoded) payload

timestamp

the timestamp when the event was written

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum EventAction[+E]

The result of the EventHandler.

The result of the EventHandler.

Attributes

Companion
object
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object EventAction

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
trait EventStore

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object EventStore

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
EventStore.type
class JsonPayloadCodec[A](using x$1: Codec[A]) extends PayloadCodec[A]

A PayloadCodec typeclass implementation for type A that uses Json encoding/decoding under the hood

A PayloadCodec typeclass implementation for type A that uses Json encoding/decoding under the hood

Value parameters

codec

A given Circe Json Codec for type A

Attributes

Companion
object
Supertypes
trait PayloadCodec[A]
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class KryoPayloadCodec[A] extends PayloadCodec[A]

A PayloadCodec typeclass implementation for type A that uses Kryo encoding/decoding under the hood

A PayloadCodec typeclass implementation for type A that uses Kryo encoding/decoding under the hood

Attributes

Companion
object
Supertypes
trait PayloadCodec[A]
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
trait PayloadCodec[A]

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

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object PersistenceId

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class Retention(purgeOnSnapshot: Boolean, snapshotsToKeep: Int)

Retention parameters.

Retention parameters.

Determines the purging behavior of events and snapshots after creating a new snapshot.

Value parameters

purgeOnSnapshot

Flag. If set to true, the event store will keep a maximum of snapshotsToKeep snapshots that exist in the event store (including the one just created) and purge all events and snapshots that are older. If set to false, no purging will be performed.

snapshotsToKeep

Number of snapshots to keep when purging is requested (purgeOnSnapshot is set to true). Attention! This number includes the snapshot just created, so if this parameter is set to 0, all snapshots (including the the one just created!) will be deleted.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Snapshot[A](payload: A, timestamp: Long)

A snapshot of a persistent actor's state.

A snapshot of a persistent actor's state.

Type parameters

A

the type of the payload

Value parameters

payload

the payload, i.e., the serialize actor message.

timestamp

the timestamp (UNIX epoch milliseconds) when the event was written

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Types

type EventHandler[S, E] = (state: S, event: E) => S

The event handler is used to modify the state of an event sourced actor.

The event handler is used to modify the state of an event sourced actor.

It is applied to the current state of the actor and each event and returns the new state of the actor. It is used in two different actor lifetime cycles:

  • when the actor is already running and the actor's MessageHandler decides to create an event. In this case, the event handler is applied to the new event after successfully writing the event to the event store.
  • when the actor is created, all previous events for this actor's persistence ID (starting at the most recent snapshot) are fetched from the event store.

Attributes

type MessageHandler[S, M, E] = (state: S, message: M, context: ActorContext[S, M]) => IO[EventAction[E]]

The message handler is applied to the current state and each incoming message of an event sourced actor and returns an EventAction. the event action defines how to deal with the message, e.g., just ignore it or create an event.

The message handler is applied to the current state and each incoming message of an event sourced actor and returns an EventAction. the event action defines how to deal with the message, e.g., just ignore it or create an event.

Attributes

opaque type PersistenceId
type SnapshotPredicate[S, E] = (state: S, event: E, numEvents: Int) => Boolean

Extensions

Extensions

extension (id: PersistenceId)
def toString(): String