store

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerTag = "EVENTSTORE"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Storage   Storage
	Transport transport.Transport
	Log       log.Logger
}

Config contains configuration parameters for EventStore.

type EventStore

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

EventStore listens for event messages using the transport and stores them for later use.

func New

func New(ctx context.Context, cfg Config) (*EventStore, error)

New returns a new instance of the EventStore struct.

func (*EventStore) Events

func (e *EventStore) Events(typ string, idx []byte) ([]*messages.Event, error)

func (*EventStore) Start

func (e *EventStore) Start() error

func (*EventStore) Wait

func (e *EventStore) Wait() chan error

Wait waits until the context is canceled or until an error occurs.

type Storage

type Storage interface {
	// Add adds a message to the store. If the message already exists, no error
	// will be returned. Method is thread safe.
	Add(msg *messages.Event) error
	// Get returns a message form the store. If the message does not exist,
	// nil will be returned. Method is thread safe.
	Get(typ string, idx []byte) ([]*messages.Event, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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