Documentation
¶
Index ¶
- type DiffEntry
- type TransactionalStore
- func (ts *TransactionalStore) Delete(key string) error
- func (ts *TransactionalStore) Exists(key string) (bool, error)
- func (ts *TransactionalStore) Flush(rootRef string) error
- func (ts *TransactionalStore) Get(key string) ([]byte, error)
- func (ts *TransactionalStore) List(prefix string) ([]string, error)
- func (ts *TransactionalStore) Put(key string, data []byte) error
- func (ts *TransactionalStore) Size(key string) (int64, error)
- func (ts *TransactionalStore) TotalSize() (int64, error)
- type Tree
- func (t *Tree) Delete(root, key string) (string, error)
- func (t *Tree) Diff(root1, root2 string, fn func(DiffEntry) error) error
- func (t *Tree) Insert(root, key, value string) (string, error)
- func (t *Tree) Lookup(root, key string) (string, error)
- func (t *Tree) NodeRefs(root string, fn func(ref string) error) error
- func (t *Tree) Walk(root string, fn func(key, value string) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiffEntry ¶
DiffEntry represents a single change between two trees. OldValue is empty for additions; NewValue is empty for deletions.
type TransactionalStore ¶
type TransactionalStore struct {
// contains filtered or unexported fields
}
TransactionalStore buffers HAMT node writes in memory and flushes only the reachable subset to the persistent store. Reads fall through to the persistent store when the key is not in the cache.
func NewTransactionalStore ¶
func NewTransactionalStore(persistent store.ObjectStore) *TransactionalStore
func (*TransactionalStore) Delete ¶
func (ts *TransactionalStore) Delete(key string) error
func (*TransactionalStore) Flush ¶
func (ts *TransactionalStore) Flush(rootRef string) error
Flush writes only the HAMT nodes reachable from rootRef to the persistent store, ignoring intermediate nodes that were superseded during the transaction. Returns the number of nodes written.
func (*TransactionalStore) List ¶
func (ts *TransactionalStore) List(prefix string) ([]string, error)
func (*TransactionalStore) TotalSize ¶
func (ts *TransactionalStore) TotalSize() (int64, error)
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a persistent Hash Array Mapped Trie backed by a content-addressed store. Keys and values are opaque strings; values are typically object refs ("filemeta/<hash>").
func NewTree ¶
func NewTree(s store.ObjectStore) *Tree
NewTree creates a Tree backed by the given object store.
func (*Tree) Delete ¶
Delete removes the entry for key, returning a new root ref. If the key is not found the original root is returned unchanged. Deleting from an empty tree is a no-op.
func (*Tree) Diff ¶
Diff structurally compares two trees and calls fn for every entry that was added, removed, or modified between root1 and root2.
func (*Tree) Insert ¶
Insert adds or updates the entry for key, returning a new root ref. Pass an empty root to start a new tree.