com.github.rahulsom.grooves.queries.internal.Executor Maven / Gradle / Ivy
package com.github.rahulsom.grooves.queries.internal;
import com.github.rahulsom.grooves.api.AggregateType;
import com.github.rahulsom.grooves.api.events.BaseEvent;
import com.github.rahulsom.grooves.api.events.Deprecates;
import com.github.rahulsom.grooves.api.snapshots.internal.BaseSnapshot;
import io.reactivex.Flowable;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Executes a query by controlling how events are applied.
*
* @param The type of {@link AggregateT}'s id
* @param The type of Aggregate
* @param The type of {@link EventT}'s id
* @param The type of Event
* @param The type of {@link SnapshotT}'s id
* @param The type of Snapshot
* @param The type of the query using the executor
*
* @author Rahul Somasunderam
*/
public interface Executor<
AggregateIdT,
AggregateT extends AggregateType,
EventIdT,
EventT extends BaseEvent,
SnapshotIdT,
SnapshotT extends BaseSnapshot,
QueryT extends BaseQuery
> {
/**
* Applies reverts to a list of events and then returns forward events.
*
* @param events The list of events
*
* @return a list of events after the reverts have been applied
*/
@NotNull Flowable applyReverts(@NotNull Flowable events);
/**
* Applies forward events on a snapshot
*
* @param query The query that demands the events to be applied.
* @param initialSnapshot The snapshot to be mutated
* @param events The list of forward events
* @param deprecatesList The list of Deprecate events
* @param aggregate The aggregate on which we are currently working
*
* @return The Snapshot that has been mutated
*/
@NotNull Flowable applyEvents(
@NotNull QueryT query,
@NotNull SnapshotT initialSnapshot,
@NotNull Flowable events,
@NotNull List> deprecatesList,
@NotNull AggregateT aggregate);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy