Documentation
¶
Overview ¶
Package history implements the history tree (a merkel tree, append only structure) life cycle, its operations, different visitors to navigate the tree, as well as the functionality of request and verify membership and incremental proofs.
Index ¶
- Variables
- type AuditPath
- type HistoryTree
- func (t *HistoryTree) Add(eventDigest hashing.Digest, version uint64) (hashing.Digest, []*storage.Mutation, error)
- func (t *HistoryTree) AddBulk(eventDigests []hashing.Digest, initialVersion uint64) ([]hashing.Digest, []*storage.Mutation, error)
- func (t *HistoryTree) Close()
- func (t *HistoryTree) ProveConsistency(start, end uint64) (*IncrementalProof, error)
- func (t *HistoryTree) ProveMembership(index, version uint64) (*MembershipProof, error)
- type IncrementalProof
- type MembershipProof
Constants ¶
This section is empty.
Variables ¶
var ( AddTotal = prometheus.NewCounter( prometheus.CounterOpts{ Namespace: namespace, Subsystem: subSystem, Name: "add_total", Help: "Number of the events added to the history tree.", }, ) MembershipTotal = prometheus.NewCounter( prometheus.CounterOpts{ Namespace: namespace, Subsystem: subSystem, Name: "membership_total", Help: "Number of membership queries", }, ) ConsistencyTotal = prometheus.NewCounter( prometheus.CounterOpts{ Namespace: namespace, Subsystem: subSystem, Name: "consistency_total", Help: "Number of consistency queries", }, ) )
Functions ¶
This section is empty.
Types ¶
type HistoryTree ¶
type HistoryTree struct {
// contains filtered or unexported fields
}
func NewHistoryTree ¶
func (*HistoryTree) Add ¶
func (t *HistoryTree) Add(eventDigest hashing.Digest, version uint64) (hashing.Digest, []*storage.Mutation, error)
Add function adds an event digest into the history tree. It builds an insert visitor, calculates the expected root hash, and returns it along with the storage mutations to be done at balloon level.
func (*HistoryTree) AddBulk ¶
func (t *HistoryTree) AddBulk(eventDigests []hashing.Digest, initialVersion uint64) ([]hashing.Digest, []*storage.Mutation, error)
AddBulk function adds a bulk of event digests (one after another) into the history tree. It builds an insert visitor, calculates the expected bulk of root hashes, and returns them along with the storage mutations to be done at balloon level.
func (*HistoryTree) Close ¶
func (t *HistoryTree) Close()
Close function resets history tree's write and read caches, and hasher.
func (*HistoryTree) ProveConsistency ¶
func (t *HistoryTree) ProveConsistency(start, end uint64) (*IncrementalProof, error)
ProveConsistency function builds the incremental proof between the given event versions. It builds an audit-path visitor to build the proof.
func (*HistoryTree) ProveMembership ¶
func (t *HistoryTree) ProveMembership(index, version uint64) (*MembershipProof, error)
ProveMembership function builds the membership proof of the given index against the given version. It builds an audit-path visitor to build the proof.
type IncrementalProof ¶
type IncrementalProof struct { AuditPath AuditPath StartVersion, EndVersion uint64 // contains filtered or unexported fields }
func NewIncrementalProof ¶
func NewIncrementalProof(start, end uint64, auditPath AuditPath, hasher hashing.Hasher) *IncrementalProof
type MembershipProof ¶
type MembershipProof struct { AuditPath AuditPath Index, Version uint64 // contains filtered or unexported fields }
func NewMembershipProof ¶
func NewMembershipProof(index, version uint64, auditPath AuditPath, hasher hashing.Hasher) *MembershipProof