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
- Variables
- func GetLogger() ec.Logger
- func SetLogger(log ec.Logger)
- type Ledger
- type PersistentStorageApi
- type PersistentStorageIteratorApi
- type PersistentStorageProvider
- type PersistentStorageTransactionApi
- type Registry
- type ReplayHandler
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteKey(key string) error
- func (s *Store) MakeKey(registry Registry, id string) string
- func (s *Store) NewKey(key string, metadata []byte) (*Ledger, error)
- func (s *Store) OpenKey(key string) (*Ledger, error)
- func (s *Store) Register(registries []Registry)
- func (s *Store) Replay() error
Constants ¶
View Source
const (
KeyPrefixLength = 2
)
Variables ¶
View Source
var ErrRegistryNotFound = errors.New("registry not found")
View Source
var StorageProvider = NewLocalPersistentStorageProvider()
StorageProvider is the default storage provider instance for the package
Functions ¶
Types ¶
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 ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.