storage

package
v0.4.96 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteMany added in v0.3.2

func WriteMany(s ports.StoragePort, ops []ports.WriteOp) error

WriteMany is a convenience wrapper for BatchWrite to encourage batched writes

Types

type AppStorage added in v0.1.11

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

func NewAppStorage added in v0.1.11

func NewAppStorage(raftNode ports.RaftNode, db *badger.DB, logger *slog.Logger) *AppStorage

func (*AppStorage) AtomicIncrement added in v0.1.11

func (s *AppStorage) AtomicIncrement(key string) (newValue int64, err error)

func (*AppStorage) BatchWrite added in v0.1.11

func (s *AppStorage) BatchWrite(ops []ports.WriteOp) error

func (*AppStorage) CleanExpired added in v0.1.11

func (s *AppStorage) CleanExpired() (cleanedCount int, err error)

func (*AppStorage) Close added in v0.1.11

func (s *AppStorage) Close() error

func (*AppStorage) CountPrefix added in v0.1.11

func (s *AppStorage) CountPrefix(prefix string) (count int, err error)

func (*AppStorage) Delete added in v0.1.11

func (s *AppStorage) Delete(key string) error

func (*AppStorage) DeleteByPrefix added in v0.1.11

func (s *AppStorage) DeleteByPrefix(prefix string) (deletedCount int, err error)

func (*AppStorage) Exists added in v0.1.11

func (s *AppStorage) Exists(key string) (bool, error)

func (*AppStorage) ExpireAt added in v0.1.11

func (s *AppStorage) ExpireAt(key string, expireTime time.Time) error

func (*AppStorage) Get added in v0.1.11

func (s *AppStorage) Get(key string) (value []byte, version int64, exists bool, err error)

func (*AppStorage) GetMetadata added in v0.1.11

func (s *AppStorage) GetMetadata(key string) (*ports.KeyMetadata, error)

func (*AppStorage) GetNext added in v0.1.11

func (s *AppStorage) GetNext(prefix string) (key string, value []byte, exists bool, err error)

func (*AppStorage) GetNextAfter added in v0.1.11

func (s *AppStorage) GetNextAfter(prefix string, afterKey string) (key string, value []byte, exists bool, err error)

func (*AppStorage) GetTTL added in v0.1.11

func (s *AppStorage) GetTTL(key string) (time.Duration, error)

func (*AppStorage) GetVersion added in v0.1.11

func (s *AppStorage) GetVersion(key string) (int64, error)

func (*AppStorage) ListByPrefix added in v0.1.11

func (s *AppStorage) ListByPrefix(prefix string) ([]ports.KeyValueVersion, error)

func (*AppStorage) Put added in v0.1.11

func (s *AppStorage) Put(key string, value []byte, version int64) error

func (*AppStorage) PutWithTTL added in v0.1.11

func (s *AppStorage) PutWithTTL(key string, value []byte, version int64, ttl time.Duration) error

func (*AppStorage) RunInTransaction added in v0.1.11

func (s *AppStorage) RunInTransaction(fn func(tx ports.Transaction) error) error

func (*AppStorage) SetEventManager added in v0.3.2

func (s *AppStorage) SetEventManager(ev ports.EventManager)

SetEventManager injects the event manager as the single event hub

func (*AppStorage) SetRaftNode added in v0.1.11

func (s *AppStorage) SetRaftNode(node ports.RaftNode)

type LeaseManager added in v0.3.11

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

LeaseManager provides a storage-backed implementation of ports.LeaseManagerPort.

func NewLeaseManager added in v0.3.11

func NewLeaseManager(storage ports.StoragePort, logger *slog.Logger) *LeaseManager

NewLeaseManager constructs a new LeaseManager instance.

func (*LeaseManager) ForceRelease added in v0.3.11

func (m *LeaseManager) ForceRelease(key string) error

ForceRelease removes the lease unconditionally.

func (*LeaseManager) Get added in v0.3.11

func (m *LeaseManager) Get(key string) (*ports.LeaseRecord, bool, error)

Get fetches the current lease record.

func (*LeaseManager) Key added in v0.3.11

func (m *LeaseManager) Key(namespace, id string) string

Key returns the storage key for a lease scoped to the provided namespace and identifier.

func (*LeaseManager) Release added in v0.3.11

func (m *LeaseManager) Release(key, owner string) error

Release relinquishes the lease if owned by the caller.

func (*LeaseManager) Renew added in v0.3.11

func (m *LeaseManager) Renew(key, owner string, ttl time.Duration) (*ports.LeaseRecord, error)

Renew extends the lease expiration if the caller still holds it.

func (*LeaseManager) TryAcquire added in v0.3.11

func (m *LeaseManager) TryAcquire(key, owner string, ttl time.Duration, metadata map[string]string) (*ports.LeaseRecord, bool, error)

TryAcquire attempts to obtain the lease for the provided key.

Jump to

Keyboard shortcuts

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