Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlobStore ¶
type BlobStore interface {
// Transaction management
Close() error
NewTransaction(bool) types.Txn
// KV operations (plugins map these to their internals with transaction context)
Get(txn types.Txn, key []byte) ([]byte, error)
Set(txn types.Txn, key, val []byte) error
Delete(txn types.Txn, key []byte) error
NewIterator(
txn types.Txn,
opts types.BlobIteratorOptions,
) types.BlobIterator
// Commit timestamp management
GetCommitTimestamp() (int64, error)
// SetCommitTimestamp stores the last commit timestamp; parameter order is
// (timestamp, txn) to keep the transaction as the final parameter.
SetCommitTimestamp(int64, types.Txn) error
// Block operations
SetBlock(
txn types.Txn,
slot uint64,
hash []byte,
cbor []byte,
id uint64,
blockType uint,
height uint64,
prevHash []byte,
) error
GetBlock(
txn types.Txn,
slot uint64,
hash []byte,
) ([]byte, types.BlockMetadata, error)
DeleteBlock(txn types.Txn, slot uint64, hash []byte, id uint64) error
// UTxO operations
SetUtxo(txn types.Txn, txId []byte, outputIdx uint32, cbor []byte) error
GetUtxo(txn types.Txn, txId []byte, outputIdx uint32) ([]byte, error)
DeleteUtxo(txn types.Txn, txId []byte, outputIdx uint32) error
}
BlobStore defines the interface for a blob storage provider. All transactional methods (Get, Set, Delete, NewIterator, SetCommitTimestamp) require a non-nil types.Txn created by NewTransaction(). Passing nil will result in types.ErrNilTxn.
Important: iterators returned by `NewIterator` yield `Item()` values that must only be accessed while the transaction used to create the iterator is still active. Implementations may validate transaction state at access time (for example `ValueCopy` may fail if the transaction has been committed or rolled back). Typical usage iterates and accesses item values within the same transaction scope.