All Known Implementing Classes:
DelayedAddAndDeleteAggregateSnapshotDelegate, PostgresqlAggregateSnapshotRepository

public interface AggregateSnapshotRepository
Repository storing and updating Aggregate instance snapshots
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    <ID, AGGREGATE_IMPL_TYPE>
    void
    aggregateUpdated(AGGREGATE_IMPL_TYPE aggregate, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateEventStream<ID> persistedEvents)
    Callback from an Aggregate Repository to notify that the aggregate has been updated
    <AGGREGATE_IMPL_TYPE>
    void
    deleteAllSnapshots(Class<AGGREGATE_IMPL_TYPE> ofAggregateImplementationType)
    Delete all snapshots for the given aggregate implementation type
    <ID, AGGREGATE_IMPL_TYPE>
    void
    deleteSnapshots(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, Class<AGGREGATE_IMPL_TYPE> withAggregateImplementationType)
    Delete all snapshots for the given aggregate instance with the given aggregate implementation type
    <ID, AGGREGATE_IMPL_TYPE>
    void
    deleteSnapshots(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, Class<AGGREGATE_IMPL_TYPE> withAggregateImplementationType, List<dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.types.EventOrder> snapshotEventOrdersToDelete)
    Delete all snapshots with a given AggregateSnapshot.eventOrderOfLastIncludedEvent for the given aggregate instance, with the given aggregate implementation type
    <ID, AGGREGATE_IMPL_TYPE>
    List<AggregateSnapshot<ID,AGGREGATE_IMPL_TYPE>>
    loadAllSnapshots(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, Class<AGGREGATE_IMPL_TYPE> aggregateImplType, boolean includeSnapshotPayload)
    Load all AggregateSnapshot's related to the given aggregate instance
    <ID, AGGREGATE_IMPL_TYPE>
    Optional<AggregateSnapshot<ID,AGGREGATE_IMPL_TYPE>>
    loadSnapshot(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.types.EventOrder withLastIncludedEventOrderLessThanOrEqualTo, Class<AGGREGATE_IMPL_TYPE> aggregateImplType)
     
    default <ID, AGGREGATE_IMPL_TYPE>
    Optional<AggregateSnapshot<ID,AGGREGATE_IMPL_TYPE>>
    loadSnapshot(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, Class<AGGREGATE_IMPL_TYPE> aggregateImplType)
     
  • Method Details

    • loadSnapshot

      default <ID, AGGREGATE_IMPL_TYPE> Optional<AggregateSnapshot<ID,AGGREGATE_IMPL_TYPE>> loadSnapshot(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, Class<AGGREGATE_IMPL_TYPE> aggregateImplType)
      Type Parameters:
      ID - the aggregate ID type
      AGGREGATE_IMPL_TYPE - the concrete aggregate implementation type
      Parameters:
      aggregateType - the aggregate type (determining the aggregate's event stream name)
      aggregateId - the identifier for the aggregate instance
      aggregateImplType - the concrete aggregate implementation type
      Returns:
      the aggregate snapshot wrapped in an Optional if a snapshot was found, otherwise Optional.empty()
    • loadSnapshot

      <ID, AGGREGATE_IMPL_TYPE> Optional<AggregateSnapshot<ID,AGGREGATE_IMPL_TYPE>> loadSnapshot(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.types.EventOrder withLastIncludedEventOrderLessThanOrEqualTo, Class<AGGREGATE_IMPL_TYPE> aggregateImplType)
      Type Parameters:
      ID - the aggregate ID type
      AGGREGATE_IMPL_TYPE - the concrete aggregate implementation type
      Parameters:
      aggregateType - the aggregate type (determining the aggregate's event stream name)
      aggregateId - the identifier for the aggregate instance
      withLastIncludedEventOrderLessThanOrEqualTo - the snapshot returned must have AggregateSnapshot.eventOrderOfLastIncludedEvent that is less than or equal to this value
      aggregateImplType - the concrete aggregate implementation type
      Returns:
      the aggregate snapshot wrapped in an Optional if a snapshot was found, otherwise Optional.empty()
    • loadAllSnapshots

      <ID, AGGREGATE_IMPL_TYPE> List<AggregateSnapshot<ID,AGGREGATE_IMPL_TYPE>> loadAllSnapshots(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, Class<AGGREGATE_IMPL_TYPE> aggregateImplType, boolean includeSnapshotPayload)
      Load all AggregateSnapshot's related to the given aggregate instance
      Type Parameters:
      ID - the aggregate ID type
      AGGREGATE_IMPL_TYPE - the concrete aggregate implementation type
      Parameters:
      aggregateType - the aggregate type (determining the aggregate's event stream name)
      aggregateId - the identifier for the aggregate instance
      aggregateImplType - the concrete aggregate implementation type
      includeSnapshotPayload - should the AggregateSnapshot.aggregateSnapshot be loaded?
      Returns:
      list of all AggregateSnapshot's in ascending AggregateSnapshot.eventOrderOfLastIncludedEvent order (the oldest snapshot first) related to the given aggregate instance
    • aggregateUpdated

      <ID, AGGREGATE_IMPL_TYPE> void aggregateUpdated(AGGREGATE_IMPL_TYPE aggregate, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateEventStream<ID> persistedEvents)
      Callback from an Aggregate Repository to notify that the aggregate has been updated
      Type Parameters:
      ID - the aggregate ID type
      AGGREGATE_IMPL_TYPE - the concrete aggregate implementation type
      Parameters:
      aggregate - the aggregate instance after the changes (in the form of events) has been marked as committed within the aggregate
      persistedEvents - the aggregate changes (in the form of events) after they've been persisted
    • deleteAllSnapshots

      <AGGREGATE_IMPL_TYPE> void deleteAllSnapshots(Class<AGGREGATE_IMPL_TYPE> ofAggregateImplementationType)
      Delete all snapshots for the given aggregate implementation type
      Type Parameters:
      AGGREGATE_IMPL_TYPE - the concrete aggregate implementation type
      Parameters:
      ofAggregateImplementationType - the concrete aggregate implementation type that we want to delete all snapshots for
    • deleteSnapshots

      <ID, AGGREGATE_IMPL_TYPE> void deleteSnapshots(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, Class<AGGREGATE_IMPL_TYPE> withAggregateImplementationType)
      Delete all snapshots for the given aggregate instance with the given aggregate implementation type
      Type Parameters:
      ID - the aggregate ID type
      AGGREGATE_IMPL_TYPE - the concrete aggregate implementation type
      Parameters:
      aggregateType - the aggregate type (determining the aggregate's event stream name)
      aggregateId - the id of the aggregate that we want to delete all snapshots for
      withAggregateImplementationType - the concrete aggregate implementation type that we want to delete all snapshots for
    • deleteSnapshots

      <ID, AGGREGATE_IMPL_TYPE> void deleteSnapshots(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, ID aggregateId, Class<AGGREGATE_IMPL_TYPE> withAggregateImplementationType, List<dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.types.EventOrder> snapshotEventOrdersToDelete)
      Delete all snapshots with a given AggregateSnapshot.eventOrderOfLastIncludedEvent for the given aggregate instance, with the given aggregate implementation type
      Type Parameters:
      ID - the aggregate ID type
      AGGREGATE_IMPL_TYPE - the concrete aggregate implementation type
      Parameters:
      aggregateType - the aggregate type (determining the aggregate's event stream name)
      aggregateId - the id of the aggregate that we want to delete all snapshots for
      withAggregateImplementationType - the concrete aggregate implementation type that we want to delete all snapshots for
      snapshotEventOrdersToDelete - The list of AggregateSnapshot.eventOrderOfLastIncludedEvent 's that should be deleted