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 is the total size of this tree
Implementations§
source§impl Azks
impl Azks
sourcepub async fn new<TC: Configuration, S: Database>(
storage: &StorageManager<S>
) -> Result<Self, AkdError>
pub async fn new<TC: Configuration, S: Database>( storage: &StorageManager<S> ) -> Result<Self, AkdError>
Creates a new azks
sourcepub async fn batch_insert_nodes<TC: Configuration, S: Database + 'static>(
&mut self,
storage: &StorageManager<S>,
nodes: Vec<AzksElement>,
insert_mode: InsertMode
) -> Result<(), AkdError>
pub async fn batch_insert_nodes<TC: Configuration, S: Database + 'static>( &mut self, storage: &StorageManager<S>, nodes: Vec<AzksElement>, insert_mode: InsertMode ) -> Result<(), AkdError>
Insert a batch of new leaves.
sourcepub async fn get_membership_proof<TC: Configuration, S: Database>(
&self,
storage: &StorageManager<S>,
label: NodeLabel
) -> Result<MembershipProof, AkdError>
pub async fn get_membership_proof<TC: Configuration, S: Database>( &self, storage: &StorageManager<S>, label: NodeLabel ) -> Result<MembershipProof, AkdError>
Returns the Merkle membership proof for the trie as it stood at epoch
sourcepub async fn get_non_membership_proof<TC: Configuration, S: Database>(
&self,
storage: &StorageManager<S>,
label: NodeLabel
) -> Result<NonMembershipProof, AkdError>
pub async fn get_non_membership_proof<TC: Configuration, S: Database>( &self, storage: &StorageManager<S>, label: NodeLabel ) -> Result<NonMembershipProof, AkdError>
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.
sourcepub async fn get_append_only_proof<TC: Configuration, S: Database + 'static>(
&self,
storage: &StorageManager<S>,
start_epoch: u64,
end_epoch: u64
) -> Result<AppendOnlyProof, AkdError>
pub async fn get_append_only_proof<TC: Configuration, S: Database + 'static>( &self, storage: &StorageManager<S>, start_epoch: u64, end_epoch: u64 ) -> Result<AppendOnlyProof, AkdError>
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 an AkdError.
RESTRICTIONS: Note that start_epoch
and end_epoch
are valid only when the following are true
start_epoch
<=end_epoch
start_epoch
andend_epoch
are both existing epochs of this AZKS
sourcepub async fn get_root_hash<TC: Configuration, S: Database>(
&self,
storage: &StorageManager<S>
) -> Result<Digest, AkdError>
pub async fn get_root_hash<TC: Configuration, S: Database>( &self, storage: &StorageManager<S> ) -> Result<Digest, AkdError>
Gets the root hash for this azks
sourcepub fn get_latest_epoch(&self) -> u64
pub fn get_latest_epoch(&self) -> u64
Gets the latest epoch of this azks. If an update aka epoch transition is in progress, this should return the most recent completed epoch.
Trait Implementations§
source§impl Ord for Azks
impl Ord for Azks
source§impl PartialEq<Azks> for Azks
impl PartialEq<Azks> for Azks
source§impl PartialOrd<Azks> for Azks
impl PartialOrd<Azks> for Azks
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more