store

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ESTIMATE_SLEEP_TIME = time.Second
)

Variables

View Source
var (
	BUCKET_EVENTS   = []byte{0, 0}
	BUCKET_STREAMS  = []byte{0, 1}
	BUCKET_METADATA = []byte{0, 2}
)
View Source
var (
	ErrConcurrentStreamModification = errors.New("concurrent stream modification")
	ErrGappedStream                 = errors.New("given version leaves gap in stream")
	ErrEmptyEventType               = errors.New("event type cannot be empty")
)
View Source
var File_proto_store_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type BadgerEventStore added in v0.7.0

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

func NewBadgerEventStore added in v0.7.0

func NewBadgerEventStore(options BadgerStoreOptions) (*BadgerEventStore, error)

func (*BadgerEventStore) Add added in v0.7.0

func (s *BadgerEventStore) Add(req *api.AddRequest) (res *api.EventResponse, err error)

func (*BadgerEventStore) Backup added in v0.7.0

func (s *BadgerEventStore) Backup(dst io.Writer) error

func (*BadgerEventStore) Close added in v0.7.0

func (s *BadgerEventStore) Close() error

func (*BadgerEventStore) EventCount added in v0.7.0

func (s *BadgerEventStore) EventCount(req *api.EventCountRequest) (res *api.EventCountResponse, err error)

func (*BadgerEventStore) EventCountEstimate added in v0.7.0

func (s *BadgerEventStore) EventCountEstimate(req *api.EventCountEstimateRequest) (res *api.EventCountResponse, err error)

func (*BadgerEventStore) Get added in v0.7.0

func (s *BadgerEventStore) Get(req *api.GetRequest) (res *api.EventResponse, err error)

func (*BadgerEventStore) GetAll added in v0.7.0

func (s *BadgerEventStore) GetAll(req *api.GetAllRequest) (res *api.EventResponse, err error)

func (*BadgerEventStore) ListStreams added in v0.7.0

func (s *BadgerEventStore) ListStreams(req *api.ListStreamsRequest) (res *api.ListStreamsReponse, err error)

func (*BadgerEventStore) Size added in v0.7.0

func (s *BadgerEventStore) Size(req *api.SizeRequest) (res *api.SizeResponse, err error)

func (*BadgerEventStore) StreamCount added in v0.7.0

func (s *BadgerEventStore) StreamCount(req *api.StreamCountRequest) (res *api.StreamCountResponse, err error)

func (*BadgerEventStore) StreamCountEstimate added in v0.7.0

func (s *BadgerEventStore) StreamCountEstimate(req *api.StreamCountEstimateRequest) (res *api.StreamCountResponse, err error)

type BadgerStoreOptions added in v0.7.0

type BadgerStoreOptions struct {
	DB             *badger.DB
	EstimateCounts bool
}

type EventStore added in v0.6.0

type EventStore interface {
	/*
		Adds event to specified stream at specfied version offset. Returns the persisted events and
		an error in case of concurrent stream modification.
	*/
	// Add(stream uuid.UUID, version uint32, events []EventData) ([]Event, error)
	Add(*api.AddRequest) (*api.EventResponse, error)

	/*
		Returns events for specified stream, offset at given version and limits the resulting set by the given limit.
		If limit is zero, then all events from given version onwards will be returned.
	*/
	Get(*api.GetRequest) (*api.EventResponse, error)

	/*
		Returns amount of events that have been recorded since the given offset. The maximum amount of returned events is specified by the given limit.
		If the limit is 0, then it will return a maximum of 100 events.
	*/
	GetAll(*api.GetAllRequest) (*api.EventResponse, error)

	/*
		Size of the database in bytes on disk
	*/
	Size(*api.SizeRequest) (*api.SizeResponse, error)

	/*
		Writes a snapshot of the database to a writer
	*/
	Backup(dst io.Writer) error

	/*
		Returns the total number of events stored in the database
	*/
	EventCount(*api.EventCountRequest) (*api.EventCountResponse, error)

	/*
		Returns the total number of streams in the database
	*/
	StreamCount(*api.StreamCountRequest) (*api.StreamCountResponse, error)

	/*
		Returns an estimate of the total number of events stored in the database
	*/
	EventCountEstimate(*api.EventCountEstimateRequest) (*api.EventCountResponse, error)

	/*
		Returns an estimate of the total number of streams in the database
	*/
	StreamCountEstimate(*api.StreamCountEstimateRequest) (*api.StreamCountResponse, error)

	ListStreams(*api.ListStreamsRequest) (*api.ListStreamsReponse, error)

	Close() error
}

type PersistedEvent

type PersistedEvent struct {
	Id            []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Stream        []byte `protobuf:"bytes,2,opt,name=stream,proto3" json:"stream,omitempty"`
	Version       uint32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
	Type          string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
	Data          []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
	Metadata      []byte `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"`
	CausationId   []byte `protobuf:"bytes,7,opt,name=causation_id,json=causationId,proto3" json:"causation_id,omitempty"`
	CorrelationId []byte `protobuf:"bytes,8,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"`
	AddedAt       int64  `protobuf:"varint,9,opt,name=added_at,json=addedAt,proto3" json:"added_at,omitempty"`
	// contains filtered or unexported fields
}

func (*PersistedEvent) Descriptor deprecated

func (*PersistedEvent) Descriptor() ([]byte, []int)

Deprecated: Use PersistedEvent.ProtoReflect.Descriptor instead.

func (*PersistedEvent) GetAddedAt

func (x *PersistedEvent) GetAddedAt() int64

func (*PersistedEvent) GetCausationId

func (x *PersistedEvent) GetCausationId() []byte

func (*PersistedEvent) GetCorrelationId

func (x *PersistedEvent) GetCorrelationId() []byte

func (*PersistedEvent) GetData

func (x *PersistedEvent) GetData() []byte

func (*PersistedEvent) GetId

func (x *PersistedEvent) GetId() []byte

func (*PersistedEvent) GetMetadata

func (x *PersistedEvent) GetMetadata() []byte

func (*PersistedEvent) GetStream

func (x *PersistedEvent) GetStream() []byte

func (*PersistedEvent) GetType

func (x *PersistedEvent) GetType() string

func (*PersistedEvent) GetVersion

func (x *PersistedEvent) GetVersion() uint32

func (*PersistedEvent) ProtoMessage

func (*PersistedEvent) ProtoMessage()

func (*PersistedEvent) ProtoReflect added in v0.5.0

func (x *PersistedEvent) ProtoReflect() protoreflect.Message

func (*PersistedEvent) Reset

func (x *PersistedEvent) Reset()

func (*PersistedEvent) String

func (x *PersistedEvent) String() string

type PersistedStream

type PersistedStream struct {
	Id      []byte   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Events  [][]byte `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"`
	AddedAt int64    `protobuf:"varint,3,opt,name=added_at,json=addedAt,proto3" json:"added_at,omitempty"`
	// contains filtered or unexported fields
}

func (*PersistedStream) Descriptor deprecated

func (*PersistedStream) Descriptor() ([]byte, []int)

Deprecated: Use PersistedStream.ProtoReflect.Descriptor instead.

func (*PersistedStream) GetAddedAt

func (x *PersistedStream) GetAddedAt() int64

func (*PersistedStream) GetEvents

func (x *PersistedStream) GetEvents() [][]byte

func (*PersistedStream) GetId

func (x *PersistedStream) GetId() []byte

func (*PersistedStream) ProtoMessage

func (*PersistedStream) ProtoMessage()

func (*PersistedStream) ProtoReflect added in v0.5.0

func (x *PersistedStream) ProtoReflect() protoreflect.Message

func (*PersistedStream) Reset

func (x *PersistedStream) Reset()

func (*PersistedStream) String

func (x *PersistedStream) String() string

Jump to

Keyboard shortcuts

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