package memory
import "github.com/google/trillian/storage/memory"
Package memory provides a simple in-process implementation of the tree- and log-storage interfaces.
This implementation is intended SOLELY for use in integration tests which exercise properties of the higher levels of Trillian componened - e.g. an integration test which ensures that the Trillian Log is able to correctly handle a tree which contains duplicate leaves.
The storage implementation is based on a BTree, which provides an ordered key-value space which can be used to store arbitrary items, as well as scan ranges of keys in order.
The implementation does provide transaction-like semantics for the LogStorage interface, although conflict is avoided by each writable transaction exclusively locking the tree until it's committed or rolled-back.
Currently, the Admin Storage does not honor transactional semantics.
Index ¶
- func Dump(t *btree.BTree)
- func DumpSubtrees(ls storage.LogStorage, treeID int64, callback func(string, *storagepb.SubtreeProto))
- func NewAdminStorage(ms *TreeStorage) storage.AdminStorage
- func NewLogStorage(ts *TreeStorage, mf monitoring.MetricFactory) storage.LogStorage
- type TreeStorage
Functions ¶
func Dump ¶
Dump ascends the tree, logging the items contained.
func DumpSubtrees ¶
func DumpSubtrees(ls storage.LogStorage, treeID int64, callback func(string, *storagepb.SubtreeProto))
DumpSubtrees will traverse the BTree and execute a callback on each subtree proto that it contains. The traversal will be 'in order' according to the BTree keys, which may not be useful at the application level.
func NewAdminStorage ¶
func NewAdminStorage(ms *TreeStorage) storage.AdminStorage
NewAdminStorage returns a storage.AdminStorage implementation backed by TreeStorage.
func NewLogStorage ¶
func NewLogStorage(ts *TreeStorage, mf monitoring.MetricFactory) storage.LogStorage
NewLogStorage creates an in-memory LogStorage instance.
Types ¶
type TreeStorage ¶
type TreeStorage struct {
// contains filtered or unexported fields
}
TreeStorage is shared between the memoryLog and (forthcoming) memoryMap- Storage implementations, and contains functionality which is common to both,
func NewTreeStorage ¶
func NewTreeStorage() *TreeStorage
NewTreeStorage returns a new instance of the in-memory tree storage database.
Source Files ¶
admin_storage.go doc.go log_storage.go provider.go tree_debug.go tree_storage.go
- Version
- v1.7.1 (latest)
- Published
- Jan 9, 2025
- Platform
- linux/amd64
- Imports
- 22 packages
- Last checked
- 5 days ago –
Tools for package owners.