storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNamespaceRequired = errors.New("namespace is required")
	ErrKeyRequired       = errors.New("key is required")
	ErrValueRequired     = errors.New("value is required")
	ErrPathRequired      = errors.New("path is required")
	ErrStoreLocked       = errors.New("store is locked by another process")
	ErrStoreClosed       = errors.New("store is closed")
	ErrReadOnlyTx        = errors.New("transaction is read-only")
	ErrNotFound          = errors.New("record not found")
	ErrNegativeListLimit = errors.New("list limit cannot be negative")
)

Functions

This section is empty.

Types

type BboltStore

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

func OpenBboltStore

func OpenBboltStore(path string) (*BboltStore, error)

func (*BboltStore) Close

func (s *BboltStore) Close() error

func (*BboltStore) Compact

func (s *BboltStore) Compact() error

func (*BboltStore) Delete

func (s *BboltStore) Delete(namespace, key string) error

func (*BboltStore) EnsureNamespace

func (s *BboltStore) EnsureNamespace(namespace string) error

func (*BboltStore) Get

func (s *BboltStore) Get(namespace, key string) ([]byte, error)

func (*BboltStore) List

func (s *BboltStore) List(namespace, prefix string, limit int) ([]Record, error)

func (*BboltStore) Put

func (s *BboltStore) Put(namespace, key string, value []byte) error

func (*BboltStore) Snapshot

func (s *BboltStore) Snapshot() (Snapshot, error)

func (*BboltStore) Update

func (s *BboltStore) Update(fn func(Tx) error) error

func (*BboltStore) View

func (s *BboltStore) View(fn func(Tx) error) error

type FakeStore

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

func NewFakeStore

func NewFakeStore() *FakeStore

func (*FakeStore) Close

func (s *FakeStore) Close() error

func (*FakeStore) Compact

func (s *FakeStore) Compact() error

func (*FakeStore) Delete

func (s *FakeStore) Delete(namespace, key string) error

func (*FakeStore) EnsureNamespace

func (s *FakeStore) EnsureNamespace(namespace string) error

func (*FakeStore) Get

func (s *FakeStore) Get(namespace, key string) ([]byte, error)

func (*FakeStore) List

func (s *FakeStore) List(namespace, prefix string, limit int) ([]Record, error)

func (*FakeStore) Put

func (s *FakeStore) Put(namespace, key string, value []byte) error

func (*FakeStore) Snapshot

func (s *FakeStore) Snapshot() (Snapshot, error)

func (*FakeStore) Update

func (s *FakeStore) Update(fn func(Tx) error) error

func (*FakeStore) View

func (s *FakeStore) View(fn func(Tx) error) error

type Record

type Record struct {
	Key   string
	Value []byte
}

type Snapshot

type Snapshot struct {
	TakenAt    time.Time
	Namespaces map[string][]Record
}

type Store

type Store interface {
	EnsureNamespace(namespace string) error
	Put(namespace, key string, value []byte) error
	Get(namespace, key string) ([]byte, error)
	Delete(namespace, key string) error
	List(namespace, prefix string, limit int) ([]Record, error)
	View(fn func(Tx) error) error
	Update(fn func(Tx) error) error
	Snapshot() (Snapshot, error)
	Compact() error
	Close() error
}

type Tx

type Tx interface {
	EnsureNamespace(namespace string) error
	Put(namespace, key string, value []byte) error
	Get(namespace, key string) ([]byte, error)
	Delete(namespace, key string) error
	List(namespace, prefix string, limit int) ([]Record, error)
}

Jump to

Keyboard shortcuts

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