memory

package
v0.0.0-...-1759ba1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoEventStoreDefined = errors.New("no event store defined")

ErrNoEventStoreDefined is if no event store has been defined.

Functions

This section is empty.

Types

type EventStore

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

EventStore implements EventStore as an in memory structure.

func NewEventStore

func NewEventStore(eventBus eventhorizon.EventBus) *EventStore

NewEventStore creates a new EventStore.

func (*EventStore) Load

Load loads all events for the aggregate id from the memory store. Returns ErrNoEventsFound if no events can be found.

func (*EventStore) Save

func (s *EventStore) Save(events []eventhorizon.Event) error

Save appends all events in the event stream to the memory store.

type ReadRepository

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

ReadRepository implements an in memory repository of read models.

func NewReadRepository

func NewReadRepository() *ReadRepository

NewReadRepository creates a new ReadRepository.

func (*ReadRepository) Find

func (r *ReadRepository) Find(id eventhorizon.UUID) (interface{}, error)

Find returns one read model with using an id. Returns ErrModelNotFound if no model could be found.

func (*ReadRepository) FindAll

func (r *ReadRepository) FindAll() ([]interface{}, error)

FindAll returns all read models in the repository.

func (*ReadRepository) Remove

func (r *ReadRepository) Remove(id eventhorizon.UUID) error

Remove removes a read model with id from the repository. Returns ErrModelNotFound if no model could be found.

func (*ReadRepository) Save

func (r *ReadRepository) Save(id eventhorizon.UUID, model interface{}) error

Save saves a read model with id to the repository.

type TraceEventStore

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

TraceEventStore wraps an EventStore and adds debug tracing.

func NewTraceEventStore

func NewTraceEventStore(eventStore eventhorizon.EventStore) *TraceEventStore

NewTraceEventStore creates a new TraceEventStore.

func (*TraceEventStore) GetTrace

func (s *TraceEventStore) GetTrace() []eventhorizon.Event

GetTrace returns the events that happened during the tracing.

func (*TraceEventStore) Load

Load loads all events for the aggregate id from the base store. Returns ErrNoEventStoreDefined if no event store could be found.

func (*TraceEventStore) ResetTrace

func (s *TraceEventStore) ResetTrace()

ResetTrace resets the trace.

func (*TraceEventStore) Save

func (s *TraceEventStore) Save(events []eventhorizon.Event) error

Save appends all events to the base store and trace them if enabled.

func (*TraceEventStore) StartTracing

func (s *TraceEventStore) StartTracing()

StartTracing starts the tracing of events.

func (*TraceEventStore) StopTracing

func (s *TraceEventStore) StopTracing()

StopTracing stops the tracing of events.

Jump to

Keyboard shortcuts

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