Documentation
¶
Overview ¶
Package tree contains functions for manipulating generic tree representations.
Index ¶
- Variables
- func BitString(index []byte) string
- func InvertBitString(bindex string) (index []byte, depth int)
- func Neighbor(b uint8) uint8
- func NeighborIndex(index []byte, depth int) []byte
- func NeighborString(bindex string) string
- func Neighbors(bindex string) []string
- func Path(bindex string) []string
- type Sparse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Zero is the value used to represent 0 in the index bit string. Zero = byte('0') // One is the data used to represent 1 in the index bit string. One = byte('1') )
Functions ¶
func BitString ¶
BitString converts a byte slice index into a string of Depth '0' or '1' characters.
func InvertBitString ¶
InvertBitString converts BitString outputs back into []byte.
func NeighborIndex ¶
NeighborIndex flips the bit at depth. Does not modify index.
func NeighborString ¶
NeighborString inverts the last Zero into a One and visa versa. Note that the root node does not have a Neighbor.
Types ¶
type Sparse ¶
type Sparse interface {
// QueueLeaf queues a leaf to be written on the next Commit().
QueueLeaf(txn transaction.Txn, index, leaf []byte) error
// Commit takes all the Queued values since the last Commmit() and writes them.
// Commit is NOT multi-process safe. It should only be called from the sequencer.
Commit(txn transaction.Txn) error
// ReadRootAt returns the root value at epoch.
ReadRootAt(txn transaction.Txn, epoch int64) ([]byte, error)
// ReadLeafAt returns the leaf value at epoch.
ReadLeafAt(txn transaction.Txn, index []byte, epoch int64) ([]byte, error)
// Neighbors returns the list of neighbors from the neighbor leaf to just below the root at epoch.
NeighborsAt(txn transaction.Txn, index []byte, epoch int64) ([][]byte, error)
// Epoch returns the current epoch of the merkle tree.
Epoch(txn transaction.Txn) (int64, error)
}
Sparse is a temporal sparse merkle tree.
Click to show internal directories.
Click to hide internal directories.