store

package
v0.0.0-...-ab4c30b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity interface {
	projector.Projector
	Id() string
}

type EventStore

type EventStore struct {
	// contains filtered or unexported fields
}

func NewEventStore

func NewEventStore(name string, be backend.Backend, er *registry.EventRegistry, replicationFactor int) *EventStore

func (*EventStore) AddEvent

func (es *EventStore) AddEvent(e *registry.Event, expectedSeq uint64) (uint64, error)

AddEvent synchronously adds a new event to the store and returns the sequence number

func (*EventStore) NewEvent

func (es *EventStore) NewEvent(name string) *registry.Event

NewEvent creates a new event with the given name

func (*EventStore) Project

func (es *EventStore) Project(model Entity) (uint64, error)

Project applies all events for a given entity to the model and returns the last sequence number applied and the error if any

func (*EventStore) ProjectAll

func (es *EventStore) ProjectAll(models []Entity) (map[string]uint64, map[string]error)

ProjectAll applies all events for a given list of entities to the models and returns a map of the last sequence number applied and a map of errors if any

func (*EventStore) Start

func (es *EventStore) Start() error

Start connects to the backend and sets up the store

func (*EventStore) Stop

func (es *EventStore) Stop() error

Stop closes the connection to the backend

type MockEntity

type MockEntity struct {
	mock.Mock
}

func (*MockEntity) Id

func (m *MockEntity) Id() string

func (*MockEntity) Project

func (m *MockEntity) Project(e *registry.Event) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL