inmem

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventStore

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

EventStore that stores stream in memory.

func New

func New() *EventStore

New returns a new in memory event store.

func (EventStore) AppendTo

func (s EventStore) AppendTo(ctx context.Context, streamName string, events []*messages.Event) error

AppendTo will append events to the stream.

func (EventStore) Create

func (s EventStore) Create(ctx context.Context, stream *eventstore.Stream) error

Create will create the stream with the name and metadata provided.

func (EventStore) Delete

func (s EventStore) Delete(ctx context.Context, streamName string) error

Delete will remove the stream.

func (EventStore) FetchStreamMetadata

func (s EventStore) FetchStreamMetadata(ctx context.Context, streamName string) (eventstore.StreamMetadata, error)

FetchStreamMetadata gets the metadata about a stream.

func (EventStore) FetchStreamNames

func (s EventStore) FetchStreamNames(ctx context.Context, filter string, matcher eventstore.MetadataMatcher, limit, offset uint64) ([]string, error)

FetchStreamNames gets stream names that match the filter.

func (EventStore) FetchStreamNamesRegex

func (s EventStore) FetchStreamNamesRegex(ctx context.Context, filter string, matcher eventstore.MetadataMatcher, limit, offset uint64) ([]string, error)

FetchStreamNamesRegex gets stream names that match the regex filter.

func (EventStore) Load

func (s EventStore) Load(ctx context.Context, streamName string, from, count uint64, matcher eventstore.MetadataMatcher) eventstore.StreamIterator

Load events from the given stream name.

func (EventStore) LoadReverse

func (s EventStore) LoadReverse(ctx context.Context, streamName string, from, count uint64, matcher eventstore.MetadataMatcher) eventstore.StreamIterator

LoadReverse Loads events from the given stream name in reverse.

func (EventStore) UpdateStreamMetadata

func (s EventStore) UpdateStreamMetadata(ctx context.Context, streamName string, newMetadata eventstore.StreamMetadata) error

UpdateStreamMetadata sets the metadata for the given stream name.

type StreamIterator

type StreamIterator struct {
	Error  error
	Events []*messages.Event
	// contains filtered or unexported fields
}

StreamIterator which iterates over events in memory.

func (*StreamIterator) Close

func (s *StreamIterator) Close()

Close will clean up resources.

func (*StreamIterator) Current

func (s *StreamIterator) Current() *messages.Event

Current will return the current event in the stream.

func (*StreamIterator) Next

Next will move the cursor forward.

func (*StreamIterator) Rewind

func (s *StreamIterator) Rewind()

Rewind will go back to the begining of the stream.

Jump to

Keyboard shortcuts

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