
com.github.rahulsom.grooves.queries.VersionedQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grooves-api Show documentation
Show all versions of grooves-api Show documentation
APIs that help in computation of Grooves based Snapshots
The newest version!
package com.github.rahulsom.grooves.queries;
import com.github.rahulsom.grooves.api.events.BaseEvent;
import com.github.rahulsom.grooves.api.snapshots.VersionedSnapshot;
import org.jetbrains.annotations.NotNull;
import org.reactivestreams.Publisher;
/**
* A query that produces a {@link VersionedSnapshot}.
*
* @param The aggregate over which the query executes
* @param The type of the EventT's id field
* @param The type of the event
* @param The type of the SnapshotT's id field
* @param The type of the snapshot
* @author Rahul Somasunderam
*/
public interface VersionedQuery<
AggregateT,
EventIdT,
EventT extends BaseEvent,
SnapshotIdT,
SnapshotT extends VersionedSnapshot> {
/**
* Computes a snapshot for specified version of an aggregate.
*
* @param aggregate The aggregate
* @param version The version number, starting at 1
* @return A Publisher that returns at most one Snapshot
*/
@NotNull Publisher computeSnapshot(
@NotNull AggregateT aggregate, long version);
/**
* Computes a snapshot for specified version of an aggregate.
*
* @param aggregate The aggregate
* @param version The version number, starting at 1
* @param redirect If there has been a deprecation, redirect to the current aggregate's
* snapshot. Defaults to true.
* @return A Publisher that returns at most one Snapshot
*/
@NotNull Publisher computeSnapshot(
@NotNull AggregateT aggregate, long version, boolean redirect);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy