Documentation ¶
Overview ¶
Package sqlhist implements a temporal sparse merkle tree using SQL. Each epoch has its own sparse tree. By default, each new epoch is equal to the contents of the previous epoch.
Index ¶
- func PrefixLen(nodes [][]byte) int
- type Map
- func (m *Map) Commit(txn transaction.Txn) error
- func (m *Map) Epoch(txn transaction.Txn) (int64, error)
- func (m *Map) NeighborsAt(txn transaction.Txn, index []byte, epoch int64) ([][]byte, error)
- func (m *Map) QueueLeaf(txn transaction.Txn, index, leaf []byte) error
- func (m *Map) ReadLeafAt(txn transaction.Txn, index []byte, epoch int64) ([]byte, error)
- func (m *Map) ReadRootAt(txn transaction.Txn, epoch int64) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map stores a temporal sparse merkle tree, backed by an SQL database.
func (*Map) Commit ¶
func (m *Map) Commit(txn transaction.Txn) 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.
func (*Map) Epoch ¶
func (m *Map) Epoch(txn transaction.Txn) (int64, error)
Epoch returns the current epoch of the merkle tree.
func (*Map) NeighborsAt ¶
NeighborsAt returns the list of neighbors from the neighbor leaf to just below the root at epoch.
func (*Map) QueueLeaf ¶
func (m *Map) QueueLeaf(txn transaction.Txn, index, leaf []byte) error
QueueLeaf should only be called by the sequencer.
func (*Map) ReadLeafAt ¶
ReadLeafAt returns the leaf value at epoch.
func (*Map) ReadRootAt ¶
ReadRootAt returns the value of the root node in a specific epoch.