Documentation
¶
Index ¶
- Constants
- type FileStorage
- func (s *FileStorage) BatchDelete(keys [][]byte) error
- func (s *FileStorage) BatchGet(keys [][]byte) (map[string][]byte, error)
- func (s *FileStorage) BatchPut(items map[string][]byte) error
- func (s *FileStorage) BeginTransaction() interfaces.Transaction
- func (s *FileStorage) Close() error
- func (s *FileStorage) Compact() error
- func (s *FileStorage) Delete(key []byte) error
- func (s *FileStorage) Get(key []byte) ([]byte, error)
- func (s *FileStorage) GetStats() interfaces.StorageStats
- func (s *FileStorage) Has(key []byte) (bool, error)
- func (s *FileStorage) NewIterator(prefix []byte) interfaces.Iterator
- func (s *FileStorage) Put(key []byte, value []byte) error
- type MemoryStorage
- func (s *MemoryStorage) BatchDelete(keys [][]byte) error
- func (s *MemoryStorage) BatchGet(keys [][]byte) (map[string][]byte, error)
- func (s *MemoryStorage) BatchPut(items map[string][]byte) error
- func (s *MemoryStorage) BeginTransaction() interfaces.Transaction
- func (s *MemoryStorage) Close() error
- func (s *MemoryStorage) Compact() error
- func (s *MemoryStorage) Delete(key []byte) error
- func (s *MemoryStorage) Get(key []byte) ([]byte, error)
- func (s *MemoryStorage) GetStats() interfaces.StorageStats
- func (s *MemoryStorage) Has(key []byte) (bool, error)
- func (s *MemoryStorage) NewIterator(prefix []byte) interfaces.Iterator
- func (s *MemoryStorage) Put(key []byte, value []byte) error
Constants ¶
const ( // TempFileExtension is the extension for temporary files TempFileExtension = ".tmp" // StateKeyPrefix is the prefix for state keys in storage StateKeyPrefix = "state:" // SnapshotKeyPrefix is the prefix for snapshot keys in storage SnapshotKeyPrefix = "snapshot:" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStorage ¶
type FileStorage struct {
// contains filtered or unexported fields
}
FileStorage implements a file-based storage backend Uses one file per key with atomic writes
func NewFileStorage ¶
func NewFileStorage(basePath string) (*FileStorage, error)
NewFileStorage creates a new file-based storage
func (*FileStorage) BatchDelete ¶
func (s *FileStorage) BatchDelete(keys [][]byte) error
BatchDelete removes multiple key-value pairs
func (*FileStorage) BatchGet ¶
func (s *FileStorage) BatchGet(keys [][]byte) (map[string][]byte, error)
BatchGet retrieves multiple values
func (*FileStorage) BatchPut ¶
func (s *FileStorage) BatchPut(items map[string][]byte) error
BatchPut stores multiple key-value pairs
func (*FileStorage) BeginTransaction ¶
func (s *FileStorage) BeginTransaction() interfaces.Transaction
BeginTransaction creates a new transaction
func (*FileStorage) Compact ¶
func (s *FileStorage) Compact() error
Compact compacts the storage (no-op for simple file storage)
func (*FileStorage) Delete ¶
func (s *FileStorage) Delete(key []byte) error
Delete removes a key-value pair
func (*FileStorage) Get ¶
func (s *FileStorage) Get(key []byte) ([]byte, error)
Get retrieves a value by key
func (*FileStorage) GetStats ¶
func (s *FileStorage) GetStats() interfaces.StorageStats
GetStats returns storage statistics
func (*FileStorage) Has ¶
func (s *FileStorage) Has(key []byte) (bool, error)
Has checks if a key exists
func (*FileStorage) NewIterator ¶
func (s *FileStorage) NewIterator(prefix []byte) interfaces.Iterator
NewIterator creates an iterator with optional prefix filtering
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage implements an in-memory storage backend
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
NewMemoryStorage creates a new in-memory storage
func (*MemoryStorage) BatchDelete ¶
func (s *MemoryStorage) BatchDelete(keys [][]byte) error
BatchDelete removes multiple key-value pairs
func (*MemoryStorage) BatchGet ¶
func (s *MemoryStorage) BatchGet(keys [][]byte) (map[string][]byte, error)
BatchGet retrieves multiple values
func (*MemoryStorage) BatchPut ¶
func (s *MemoryStorage) BatchPut(items map[string][]byte) error
BatchPut stores multiple key-value pairs
func (*MemoryStorage) BeginTransaction ¶
func (s *MemoryStorage) BeginTransaction() interfaces.Transaction
BeginTransaction creates a new transaction
func (*MemoryStorage) Close ¶
func (s *MemoryStorage) Close() error
Close closes the storage (no-op for memory storage)
func (*MemoryStorage) Compact ¶
func (s *MemoryStorage) Compact() error
Compact compacts the storage (no-op for memory storage)
func (*MemoryStorage) Delete ¶
func (s *MemoryStorage) Delete(key []byte) error
Delete removes a key-value pair
func (*MemoryStorage) Get ¶
func (s *MemoryStorage) Get(key []byte) ([]byte, error)
Get retrieves a value by key
func (*MemoryStorage) GetStats ¶
func (s *MemoryStorage) GetStats() interfaces.StorageStats
GetStats returns storage statistics
func (*MemoryStorage) Has ¶
func (s *MemoryStorage) Has(key []byte) (bool, error)
Has checks if a key exists
func (*MemoryStorage) NewIterator ¶
func (s *MemoryStorage) NewIterator(prefix []byte) interfaces.Iterator
NewIterator creates an iterator with optional prefix filtering