Expand description
The representation of a auditable key directory
Implementations§
source§impl<S: Database + Sync + Send, V: VRFKeyStorage> Directory<S, V>
impl<S: Database + Sync + Send, V: VRFKeyStorage> Directory<S, V>
sourcepub async fn new(
storage: &StorageManager<S>,
vrf: &V,
read_only: bool
) -> Result<Self, AkdError>
pub async fn new(
storage: &StorageManager<S>,
vrf: &V,
read_only: bool
) -> 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.
sourcepub async fn publish(
&self,
updates: Vec<(AkdLabel, AkdValue)>
) -> Result<EpochHash, AkdError>
pub async fn publish(
&self,
updates: Vec<(AkdLabel, AkdValue)>
) -> Result<EpochHash, AkdError>
Updates the directory to include the updated key-value pairs.
sourcepub async fn lookup(
&self,
uname: AkdLabel
) -> Result<(LookupProof, EpochHash), AkdError>
pub async fn lookup(
&self,
uname: AkdLabel
) -> Result<(LookupProof, EpochHash), AkdError>
Provides proof for correctness of latest version
sourcepub async fn batch_lookup(
&self,
unames: &[AkdLabel]
) -> Result<(Vec<LookupProof>, EpochHash), AkdError>
pub async fn batch_lookup(
&self,
unames: &[AkdLabel]
) -> Result<(Vec<LookupProof>, EpochHash), AkdError>
Allows efficient batch lookups by preloading necessary nodes for the lookups.
sourcepub async fn key_history(
&self,
uname: &AkdLabel,
params: HistoryParams
) -> Result<(HistoryProof, EpochHash), AkdError>
pub async fn key_history(
&self,
uname: &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.
sourcepub async fn poll_for_azks_changes(
&self,
period: Duration,
change_detected: Option<Sender<()>>
) -> Result<(), AkdError>
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
NOTE: Due to the use of std::thread::sleep(.) this will BLOCK the polling thread, and should be allocated it’s own thread since it won’t yield
sourcepub async fn audit(
&self,
audit_start_ep: u64,
audit_end_ep: u64
) -> Result<AppendOnlyProof, AkdError>
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.
sourcepub async fn retrieve_current_azks(&self) -> Result<Azks, AkdError>
pub async fn retrieve_current_azks(&self) -> Result<Azks, AkdError>
Retrieves the current azks
sourcepub async fn get_public_key(&self) -> Result<VRFPublicKey, AkdError>
pub async fn get_public_key(&self) -> Result<VRFPublicKey, AkdError>
HELPERS /// Use this function to retrieve the VRF public key for this AKD.
source§impl<S: Database + Sync + Send, V: VRFKeyStorage> Directory<S, V>
impl<S: Database + Sync + Send, V: VRFKeyStorage> Directory<S, V>
sourcepub async fn publish_malicious_update(
&self,
updates: Vec<(AkdLabel, AkdValue)>,
corruption: PublishCorruption
) -> Result<EpochHash, AkdError>
pub async fn publish_malicious_update(
&self,
updates: Vec<(AkdLabel, AkdValue)>,
corruption: PublishCorruption
) -> Result<EpochHash, AkdError>
Updates the directory to include the updated key-value pairs with possible issues.