inmemory

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Code generated by goengine. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStreamExistsAlready occurs when create is called for an already created stream
	ErrStreamExistsAlready = errors.New("goengine: stream already exists")
	// ErrStreamNotFound occurs when an unknown streamName is provided
	ErrStreamNotFound = errors.New("goengine: unknown stream")
	// ErrNilMessage occurs when a goengine.Message that is being appended to a stream is nil or a reference to nil
	ErrNilMessage = errors.New("goengine: nil is not a valid message")
)
View Source
var (
	// ErrMessageNumberCountMismatch occurs when the provided messages and numbers do not have the same length
	ErrMessageNumberCountMismatch = errors.New("goengine: provided messages and messageNumbers do not match")
	// ErrEventStreamClosed occurs when an eventstream is closed
	ErrEventStreamClosed = errors.New("goengine: no more messages")
	// ErrEventStreamNotStarted occurs when an eventstream Message or MessageNumber is called before Next
	ErrEventStreamNotStarted = errors.New("goengine: eventStream Message called without calling Next")
)
View Source
var (
	// ErrTypeMismatch occurs when a metadata value cannot be converted to the constraints value type
	ErrTypeMismatch = errors.New("goengine: the values to compare are of a different type")
	// ErrUnsupportedOperator occurs when a constraints operation is not supported for a type
	ErrUnsupportedOperator = errors.New("goengine: the operator is not supported for this type")
)
View Source
var (
	// ErrUnknownPayloadType occurs when a payload type is unknown
	ErrUnknownPayloadType = errors.New("goengine: unknown payload type was provided")
	// ErrDuplicatePayloadType occurs when a payload type is already registered
	ErrDuplicatePayloadType = errors.New("goengine: payload type is already registered")
)
View Source
var ErrUnsupportedType = errors.New("the value is not a scalar type")

Functions

This section is empty.

Types

type EventStore

type EventStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

EventStore a in memory event store implementation

func NewEventStore

func NewEventStore(logger goengine.Logger) *EventStore

NewEventStore return a new inmemory.EventStore

func (*EventStore) AppendTo

func (i *EventStore) AppendTo(ctx context.Context, streamName goengine.StreamName, streamEvents []goengine.Message) error

AppendTo appends the provided messages to the stream

func (*EventStore) Create

func (i *EventStore) Create(ctx context.Context, streamName goengine.StreamName) error

Create creates a event stream

func (*EventStore) HasStream

func (i *EventStore) HasStream(ctx context.Context, streamName goengine.StreamName) bool

HasStream returns true if the stream exists

func (*EventStore) Load

func (i *EventStore) Load(
	ctx context.Context,
	streamName goengine.StreamName,
	fromNumber int64,
	count *uint,
	matcher metadata.Matcher,
) (goengine.EventStream, error)

Load returns a list of events based on the provided conditions

type EventStream

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

EventStream an inmemory eventstore.EventStream implementation

func NewEventStream

func NewEventStream(messages []goengine.Message, messageNumbers []int64) (*EventStream, error)

NewEventStream return a new EventStream containing the given messages

func (*EventStream) Close

func (e *EventStream) Close() error

Close closes the EventStream, preventing further enumeration.

func (*EventStream) Err

func (e *EventStream) Err() error

Err returns the error, if any, that was encountered during iteration.

func (*EventStream) Message

func (e *EventStream) Message() (goengine.Message, int64, error)

Message returns the current message in the EventStream.

func (*EventStream) Next

func (e *EventStream) Next() bool

Next prepares the next result for reading.

type IncompatibleConstraintError

type IncompatibleConstraintError struct {
	Parent     error
	Constraint metadata.Constraint
}

IncompatibleConstraintError is an error indicating that a constraint is incompatible.

func (*IncompatibleConstraintError) Error

Error an error message

type IncompatibleMatcherError

type IncompatibleMatcherError []IncompatibleConstraintError

IncompatibleMatcherError is an error that constraints multiple errors. This error is returned when a metadata.Matcher contains constraints that are not supported by the inmemory.MetadataMatcher

func (IncompatibleMatcherError) Error

func (e IncompatibleMatcherError) Error() string

Error an error message

type MetadataMatcher

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

MetadataMatcher an in memory metadata matcher implementation

func NewMetadataMatcher

func NewMetadataMatcher(matcher metadata.Matcher, logger goengine.Logger) (*MetadataMatcher, error)

NewMetadataMatcher returns a new metadata matcher based of off the metadata.Matcher

func (*MetadataMatcher) Matches

func (m *MetadataMatcher) Matches(metadata metadata.Metadata) bool

Matches returns true if the constraints in the matcher are all satisfied by the metadata

type PayloadRegistry

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

PayloadRegistry is a registry containing the mapping of an payload type to a event name

func (*PayloadRegistry) RegisterPayload

func (p *PayloadRegistry) RegisterPayload(eventName string, payload interface{}) error

RegisterPayload register a eventName to a specific payload type. Reflection is used to determine the full payload type name.

func (*PayloadRegistry) ResolveName

func (p *PayloadRegistry) ResolveName(payload interface{}) (string, error)

ResolveName resolves the type name based on the underlying type of the payload

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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