All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 rx.Observable;

import java.util.List;

/**
 * Executes a query by controlling how events are applied.
 *
 * @param   The type of Aggregate
 * @param     The type of Event Id
 * @param       The type of Event
 * @param  The type of Snapshot Id
 * @param    The type of Snapshot
 *
 * @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
     */
    Observable applyReverts(Observable 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 aggregates      The list of deprecated aggregates
     * @param aggregate       The aggregate on which we are currently working
     *
     * @return The Snapshot that has been mutated
     */
    Observable applyEvents(
            QueryT query,
            SnapshotT initialSnapshot,
            Observable events,
            List> deprecatesList,
            List aggregates,
            AggregateT aggregate);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy