xprt64/cqrs-es

View on GitHub
src/Dudulina/EventStore.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/******************************************************************************
 * Copyright (c) 2017 Constantin Galbenu <gica.galbenu@gmail.com>             *
 ******************************************************************************/

namespace Dudulina;


use Dudulina\Aggregate\AggregateDescriptor;
use Dudulina\Event\EventWithMetaData;
use Dudulina\EventStore\AggregateEventStream;
use Dudulina\EventStore\SeekableEventStream;

interface EventStore
{
    public function loadEventsForAggregate(AggregateDescriptor $aggregateDescriptor): AggregateEventStream;

    /**
     * @param AggregateDescriptor $aggregateDescriptor
     * @param EventWithMetaData[] $eventsWithMetaData
     * @param AggregateEventStream $expectedEventStream
     * @return void
     */
    public function appendEventsForAggregate(AggregateDescriptor $aggregateDescriptor, $eventsWithMetaData, AggregateEventStream $expectedEventStream): void;

    public function loadEventsByClassNames(array $eventClasses): SeekableEventStream;

    public function getAggregateVersion(AggregateDescriptor $aggregateDescriptor);

    public function findEventById(string $eventId): ?EventWithMetaData;
}