Struct akd::directory::Directory

source ·
pub struct Directory<TC, S: Database, V> { /* private fields */ }
Expand description

The representation of a auditable key directory

Implementations§

source§

impl<TC, S, V> Directory<TC, S, V>where TC: Configuration, S: Database + 'static, V: VRFKeyStorage,

source

pub async fn new(storage: StorageManager<S>, vrf: V) -> Result<Self, AkdError>

Creates a new (stateless) instance of a auditable key directory. Takes as input a pointer to the storage being used for this instance. The state is stored in the storage.

source

pub async fn publish( &self, updates: Vec<(AkdLabel, AkdValue)> ) -> Result<EpochHash, AkdError>

Updates the directory to include the input label-value pairs.

Note that the vector of label-value pairs should not contain any entries with duplicate labels. This condition is explicitly checked, and an error will be returned if this is the case.

source

pub async fn lookup( &self, akd_label: AkdLabel ) -> Result<(LookupProof, EpochHash), AkdError>

Provides proof for correctness of latest version

  • akd_label: The target label to generate a lookup proof for

Returns [Ok((LookupProof, EpochHash))] upon successful generation for the latest version of the target label’s state. [Err(_)] otherwise

source

pub async fn batch_lookup( &self, akd_labels: &[AkdLabel] ) -> Result<(Vec<LookupProof>, EpochHash), AkdError>

Allows efficient batch lookups by preloading necessary nodes for the lookups.

source

pub async fn key_history( &self, akd_label: &AkdLabel, params: HistoryParams ) -> Result<(HistoryProof, EpochHash), AkdError>

Takes in the current state of the server and a label. If the label is present in the current state, this function returns all the values ever associated with it, and the epoch at which each value was first committed to the server state. It also returns the proof of the latest version being served at all times.

source

pub async fn poll_for_azks_changes( &self, period: Duration, change_detected: Option<Sender<()>> ) -> Result<(), AkdError>

Poll for changes in the epoch number of the AZKS struct stored in the storage layer. If an epoch change is detected, the object cache (if present) is flushed immediately so that new objects are retrieved from the storage layer against the “latest” epoch. There is a “special” flow in the storage layer to do a storage-layer retrieval which ignores the cache

source

pub async fn audit( &self, audit_start_ep: u64, audit_end_ep: u64 ) -> Result<AppendOnlyProof, AkdError>

Returns an AppendOnlyProof for the leaves inserted into the underlying tree between the epochs audit_start_ep and audit_end_ep.

source

pub async fn get_public_key(&self) -> Result<VRFPublicKey, AkdError>

HELPERS /// Use this function to retrieve the VRFPublicKey for this AKD.

source

pub async fn get_epoch_hash(&self) -> Result<EpochHash, AkdError>

Gets the root hash at the current epoch.

Trait Implementations§

source§

impl<TC, S: Database, V: VRFKeyStorage> Clone for Directory<TC, S, V>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<TC, S, V> !RefUnwindSafe for Directory<TC, S, V>

§

impl<TC, S, V> Send for Directory<TC, S, V>where TC: Send, V: Send,

§

impl<TC, S, V> Sync for Directory<TC, S, V>where TC: Sync, V: Sync,

§

impl<TC, S, V> Unpin for Directory<TC, S, V>where TC: Unpin, V: Unpin,

§

impl<TC, S, V> !UnwindSafe for Directory<TC, S, V>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.