persistent

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package persistent provides persistent storage functionality for key-value operations. This package implements durable storage mechanisms with support for various backends.

Index

Constants

View Source
const (
	KeyPrefixLength = 2
)

Variables

View Source
var ErrRegistryNotFound = errors.New("registry not found")

StorageProvider is the default storage provider instance for the package

Functions

func GetLogger added in v0.1.11

func GetLogger() ec.Logger

GetLogger returns the current package logger

func SetLogger added in v0.1.11

func SetLogger(log ec.Logger)

SetLogger configures the package-level logger for all persistent storage operations

Types

type Ledger

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

func (*Ledger) Close

func (l *Ledger) Close(delete bool) error

func (*Ledger) Log

func (l *Ledger) Log(t uint32, v []byte) error

type PersistentStorageApi

type PersistentStorageApi interface {
	View(func(txn PersistentStorageTransactionApi) error) error
	Update(func(txn PersistentStorageTransactionApi) error) error
	Delete(key string) error

	Close() error
}

PersistentStorageApi provides an interface for interacting with persistent storage.

type PersistentStorageIteratorApi

type PersistentStorageIteratorApi interface {
	Rewind()
	Valid() bool
	Next()

	Key() string
	Value() ([]byte, error)

	Close()
}

Persistent Storage Iterator API provides an iterface for interacting with persistent storage iterators

type PersistentStorageProvider

type PersistentStorageProvider interface {
	NewPersistentStorageInterface(path string, readOnly bool) (PersistentStorageApi, error)
}

PersistentStorageProvider provides methods for creating persistent storage interfaces

func NewJsonFilePersistentStorageProvider

func NewJsonFilePersistentStorageProvider(filename string) PersistentStorageProvider

func NewLocalPersistentStorageProvider

func NewLocalPersistentStorageProvider() PersistentStorageProvider

type PersistentStorageTransactionApi

type PersistentStorageTransactionApi interface {
	NewIterator(prefix string) PersistentStorageIteratorApi
	Set(key string, value []byte) error
	Get(key string) ([]byte, error)
}

PersistentStorageTransactionApi provides an interface for interacting with persistent storage transactions

func NewBase64PersistentStorageTransaction

func NewBase64PersistentStorageTransaction(data map[string]string) PersistentStorageTransactionApi

type Registry

type Registry interface {
	Prefix() string
	NewReplay(id string) ReplayHandler
}

type ReplayHandler

type ReplayHandler interface {
	Metadata(data []byte) error
	Entry(t uint32, data []byte) error
	Done() (bool, error)
}

type Store

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

func Open

func Open(path string, readOnly bool) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) DeleteKey

func (s *Store) DeleteKey(key string) error

func (*Store) MakeKey

func (s *Store) MakeKey(registry Registry, id string) string

func (*Store) NewKey

func (s *Store) NewKey(key string, metadata []byte) (*Ledger, error)

NewKey will create the provided key with metadata provided. It returns a logger which tracks updates to the key's value.

func (*Store) OpenKey

func (s *Store) OpenKey(key string) (*Ledger, error)

func (*Store) Register

func (s *Store) Register(registries []Registry)

func (*Store) Replay

func (s *Store) Replay() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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