backend

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Connect() error
	Close() error
	SetEventRegistry(*registry.EventRegistry)
	Setup(string, int) error
	Save([]*registry.Event, uint64) (uint64, error)
	// returns all events in the store in a map of entity id to events
	Load() (map[string]*registry.Event, error)
	// returns all events for a given entity id
	LoadByEntityId(string) ([]*registry.Event, error)
	// returns all events for a given event type
	LoadByEventType(string) ([]*registry.Event, error)
}

type ErrWrongSequence

type ErrWrongSequence struct {
	Expected uint64
	Actual   uint64
}

func (*ErrWrongSequence) Error

func (e *ErrWrongSequence) Error() string

type MockBackend

type MockBackend struct {
	mock.Mock
}

func (*MockBackend) Close

func (m *MockBackend) Close() error

func (*MockBackend) Connect

func (m *MockBackend) Connect() error

func (*MockBackend) Load

func (m *MockBackend) Load() (map[string]*registry.Event, error)

func (*MockBackend) LoadByEntityId

func (m *MockBackend) LoadByEntityId(id string) ([]*registry.Event, error)

func (*MockBackend) LoadByEventType

func (m *MockBackend) LoadByEventType(eventType string) ([]*registry.Event, error)

func (*MockBackend) Save

func (m *MockBackend) Save(events []*registry.Event, expectedSeq uint64) (uint64, error)

func (*MockBackend) SetEventRegistry

func (m *MockBackend) SetEventRegistry(er *registry.EventRegistry)

func (*MockBackend) Setup

func (m *MockBackend) Setup(name string, replicationFactor int) error

type NATSBackend

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

func NewNATSBackend

func NewNATSBackend(opt NATSBackendConfig) *NATSBackend

func (*NATSBackend) Close

func (n *NATSBackend) Close() error

func (*NATSBackend) Connect

func (n *NATSBackend) Connect() error

func (*NATSBackend) Load

func (n *NATSBackend) Load() (map[string]*registry.Event, error)

func (*NATSBackend) LoadByEntityId

func (n *NATSBackend) LoadByEntityId(id string) ([]*registry.Event, error)

func (*NATSBackend) LoadByEventType

func (n *NATSBackend) LoadByEventType(evType string) ([]*registry.Event, error)

func (*NATSBackend) Save

func (n *NATSBackend) Save(events []*registry.Event, expectedSequence uint64) (uint64, error)

func (*NATSBackend) SetEventRegistry

func (n *NATSBackend) SetEventRegistry(er *registry.EventRegistry)

func (*NATSBackend) Setup

func (n *NATSBackend) Setup(storeName string, replicas int) error

type NATSBackendConfig

type NATSBackendConfig struct {
	Connection      string
	Token           string
	DefaultReplicas int
}

Jump to

Keyboard shortcuts

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