cqrs-core-0.10.0: Command-Query Responsibility Segregation

Safe HaskellNone
LanguageHaskell2010

Data.CQRS.Types.SnapshotStore

Synopsis

Documentation

data SnapshotStore a Source

A snapshot store is used for storing snapshots.

Constructors

SnapshotStore 

Fields

ssWriteSnapshot :: UUID -> Snapshot a -> IO ()

Write out a snapshot. Snapshot version numbers are NOT checked for validity (e.g. whether they are greater than the existing snapshot version numbers).

ssReadSnapshot :: UUID -> IO (Maybe (Snapshot a))

Read latest snapshot of an aggregate identified by UUID. A snapshot store is permitted to return Nothing in all cases.

applyPrism :: (a -> b, b -> Maybe a) -> SnapshotStore b -> SnapshotStore a Source

Transform an implementation of 'SnapshotStore a' to an implementation of 'SnapshotStore b' via a prism. This is typically used to add serialization/deserialization to snapshot stores which do not support storing anything other than binary data. Note that the prism is allowed to return Nothing to indicate that data could not be transformed. This can be used to avoid the need for complicated versioning of snapshot data by using simple version tags/hashes to determine compatibility with stored snapshots.

nullSnapshotStore :: SnapshotStore a Source

The "null" snapshot store, i.e. a snapshot store which never actually stores any snapshots.