Struct akd::append_only_zks::Azks

source ·
pub struct Azks {
    pub latest_epoch: u64,
    pub num_nodes: u64,
}
Expand description

An append-only zero knowledge set, the data structure used to efficiently implement a auditable key directory.

Fields

latest_epoch: u64

The latest complete epoch

num_nodes: u64

The number of nodes ie the size of this tree

Implementations

Creates a new azks

Insert a batch of new leaves

Preloads given nodes using breadth-first search.

An azks is built both by the crate::directory::Directory and the auditor. However, both constructions have very minor differences, and the append_only_usage bool keeps track of this.

Returns the Merkle membership proof for the trie as it stood at epoch

In a compressed trie, the proof consists of the longest prefix of the label that is included in the trie, as well as its children, to show that none of the children is equal to the given label.

An append-only proof for going from start_epoch to end_epoch consists of roots of subtrees the azks tree that remain unchanged from start_epoch to end_epoch and the leaves inserted into the tree after start_epoch and up until end_epoch. If there is no errors, this function returns an Ok result, containing the append-only proof and otherwise, it returns a errors::AkdError.

RESTRICTIONS: Note that start_epoch and end_epoch are valid only when the following are true

  • start_epoch <= end_epoch
  • start_epoch and end_epoch are both existing epochs of this AZKS

Gets the root hash for this azks

Gets the root hash of the tree at a epoch. Since this is accessing the root node and the root node exists at all epochs that the azks does, this would never be called at an epoch before the birth of the root node.

Gets the latest epoch of this azks. If an update aka epoch transition is in progress, this should return the most recent completed epoch.

This function returns the node label for the node whose label is the longest common prefix for the queried label. It also returns a membership proof for said label. This is meant to be used in both, getting membership proofs and getting non-membership proofs.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Retrieve the size of the item in bytes
This particular storage will have a key type
Must return a valid storage type
Retrieve an instance of the id of this storable. The combination of the storable’s StorageType and this id are globally unique Read more
Retrieve the full binary version of a key (for comparisons)
Reformat a key from the full-binary specification
Retrieve the full binary version of a key (for comparisons)

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.