AggregateStorage

public abstract class AggregateStorage<I> extends AbstractStorage<I, M, R> implements StorageWithLifecycleFlags<I, M, R>

An event-sourced storage of aggregate part events and snapshots.

Parameters

<I>

the type of IDs of aggregates managed by this storage

Constructors

Link copied to clipboard
protected void AggregateStorage(boolean multitenant)

Functions

Link copied to clipboard
protected void checkNotClosed()
Ensures the storage is not closed.
Link copied to clipboard
protected abstract Iterator<I> distinctAggregateIds()
Obtains distinct aggregate IDs from the stored event records.
Link copied to clipboard
protected abstract Iterator<AggregateEventRecord> historyBackward(AggregateReadRequest<I> request)
Creates iterator of aggregate event history with the reverse traversal.
Link copied to clipboard
public Iterator<I> index()
Returns an iterator over identifiers of records in the storage.
Link copied to clipboard
public Optional<AggregateHistory> read(AggregateReadRequest<I> request)
Forms and returns an AggregateHistory based on the aggregate history.
Link copied to clipboard
protected abstract void truncate(int snapshotIndex)
Drops all records which occur before the Nth snapshot for each entity.
protected abstract void truncate(int snapshotIndex, Timestamp date)
Drops all records older than date but not newer than the Nth snapshot for each entity.
Link copied to clipboard
public void truncateOlderThan(int snapshotIndex)
Truncates the storage, dropping all records which occur before the Nth snapshot for each entity.
public void truncateOlderThan(int snapshotIndex, Timestamp date)
Truncates the storage, dropping all records older than date but not newer than the Nth snapshot.
Link copied to clipboard
public void write(I id, AggregateHistory events)
Writes events into the storage.
Link copied to clipboard
protected abstract void writeRecord(I id, AggregateEventRecord record)
Writes the passed record into the storage.

Inherited functions

Link copied to clipboard
protected void checkNotClosed(String message)
Ensures the storage is not closed.
Link copied to clipboard
public void close()
Closes the storage.
public abstract void close()
Link copied to clipboard
public boolean isClosed()
Tests whether the storage is closed.
Link copied to clipboard
public boolean isMultitenant()
Verifies whether the storage is multitenant.
Link copied to clipboard
public boolean isOpen()
Tests whether the storage is open.
Link copied to clipboard
public abstract Optional<LifecycleFlags> readLifecycleFlags(I id)
Reads the lifecycle status for the entity with the passed ID.
Link copied to clipboard
public abstract void writeLifecycleFlags(I id, LifecycleFlags flags)
Writes the lifecycle status for the entity with the passed ID.