storage

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package storage provides event storage implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorage

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

MemoryStorage implements EventSink using in-memory storage. This is suitable for development and small-scale deployments.

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

NewMemoryStorage creates a new in-memory event storage.

func (*MemoryStorage) Cleanup

func (s *MemoryStorage) Cleanup(maxAge time.Duration)

Cleanup removes old events (for memory management).

func (*MemoryStorage) Count

func (s *MemoryStorage) Count(ctx context.Context, query core.Query) (int, error)

Count returns the number of events matching the criteria.

func (*MemoryStorage) Query

func (s *MemoryStorage) Query(ctx context.Context, query core.Query) ([]core.Event, error)

Query retrieves events matching the criteria.

func (*MemoryStorage) Store

func (s *MemoryStorage) Store(ctx context.Context, event core.Event) error

Store saves an event to memory.

type StorageWithSink

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

StorageWithSink wraps a storage implementation and automatically stores events from a stream.

func NewStorageWithSink

func NewStorageWithSink(storage core.EventSink, stream core.EventStream) *StorageWithSink

NewStorageWithSink creates storage that automatically consumes from an event stream.

func (*StorageWithSink) Close

func (s *StorageWithSink) Close() error

Close stops consuming events.

func (*StorageWithSink) Count

func (s *StorageWithSink) Count(ctx context.Context, query core.Query) (int, error)

Count implements EventSink.

func (*StorageWithSink) Query

func (s *StorageWithSink) Query(ctx context.Context, query core.Query) ([]core.Event, error)

Query implements EventSink.

func (*StorageWithSink) Store

func (s *StorageWithSink) Store(ctx context.Context, event core.Event) error

Store implements EventSink.

Jump to

Keyboard shortcuts

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