[][src]Trait xaynet_server::storage::traits::CoordinatorStorage

pub trait CoordinatorStorage where
    Self: Clone + Send + Sync + 'static, 
{ #[must_use] pub fn set_coordinator_state<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        state: &'life1 CoordinatorState
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn coordinator_state<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<CoordinatorState>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn add_sum_participant<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        pk: &'life1 SumParticipantPublicKey,
        ephm_pk: &'life2 SumParticipantEphemeralPublicKey
    ) -> Pin<Box<dyn Future<Output = StorageResult<SumPartAdd>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn sum_dict<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<SumDict>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn add_local_seed_dict<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        update_pk: &'life1 UpdateParticipantPublicKey,
        local_seed_dict: &'life2 LocalSeedDict
    ) -> Pin<Box<dyn Future<Output = StorageResult<LocalSeedDictAdd>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn seed_dict<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<SeedDict>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn incr_mask_score<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        pk: &'life1 SumParticipantPublicKey,
        mask: &'life2 MaskObject
    ) -> Pin<Box<dyn Future<Output = StorageResult<MaskScoreIncr>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn best_masks<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<Vec<(MaskObject, u64)>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn number_of_unique_masks<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn delete_coordinator_data<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn delete_dicts<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn set_latest_global_model_id<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        id: &'life1 str
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn latest_global_model_id<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<String>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] pub fn is_ready<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

An abstract coordinator storage.

Required methods

#[must_use]pub fn set_coordinator_state<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    state: &'life1 CoordinatorState
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Sets a CoordinatorState.

Behavior

  • If no state has been set yet, set the state and return StorageResult::Ok(()).
  • If a state already exists, override the state and return StorageResult::Ok(()).

#[must_use]pub fn coordinator_state<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<Option<CoordinatorState>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Returns a CoordinatorState.

Behavior

  • If no state has been set yet, return StorageResult::Ok(Option::None).
  • If a state exists, return StorageResult::Ok(Some(CoordinatorState)).

#[must_use]pub fn add_sum_participant<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 mut self,
    pk: &'life1 SumParticipantPublicKey,
    ephm_pk: &'life2 SumParticipantEphemeralPublicKey
) -> Pin<Box<dyn Future<Output = StorageResult<SumPartAdd>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

Adds a sum participant entry to the SumDict.

Behavior

  • If a sum participant has been successfully added, return StorageResult::Ok(SumPartAdd) containing a Result::Ok(()).
  • If the participant could not be added due to a PET protocol error, return the corresponding StorageResult::Ok(SumPartAdd) containing a Result::Err(SumPartAddError).

#[must_use]pub fn sum_dict<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<Option<SumDict>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Returns the SumDict.

Behavior

  • If the sum dict does not exist, return StorageResult::Ok(Option::None).
  • If the sum dict exists, return StorageResult::Ok(Option::Some(SumDict)).

#[must_use]pub fn add_local_seed_dict<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 mut self,
    update_pk: &'life1 UpdateParticipantPublicKey,
    local_seed_dict: &'life2 LocalSeedDict
) -> Pin<Box<dyn Future<Output = StorageResult<LocalSeedDictAdd>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

Adds a local LocalSeedDict of the given UpdateParticipantPublicKey to the SeedDict.

Behavior

  • If the local seed dict has been successfully added, return StorageResult::Ok(LocalSeedDictAdd) containing a Result::Ok(()).
  • If the local seed dict could not be added due to a PET protocol error, return the corresponding StorageResult::Ok(LocalSeedDictAdd) containing a Result::Err(LocalSeedDictAddError).

#[must_use]pub fn seed_dict<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<Option<SeedDict>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Returns the SeedDict.

Behavior

  • If the seed dict does not exist, return StorageResult::Ok(Option::None).
  • If the seed dict exists, return StorageResult::Ok(Option::Some(SeedDict)).

#[must_use]pub fn incr_mask_score<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 mut self,
    pk: &'life1 SumParticipantPublicKey,
    mask: &'life2 MaskObject
) -> Pin<Box<dyn Future<Output = StorageResult<MaskScoreIncr>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

Increments the mask score with the given MaskObjectb by one.

Behavior

  • If the mask score has been successfully incremented, return StorageResult::Ok(MaskScoreIncr) containing a Result::Ok(()).
  • If the mask score could not be incremented due to a PET protocol error, return the corresponding Result::Ok(MaskScoreIncr) containing a Result::Err(MaskScoreIncrError).

#[must_use]pub fn best_masks<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Vec<(MaskObject, u64)>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Returns the two masks with the highest score.

Behavior

  • If no masks exist, return Result::Ok(Option::None).
  • If only one mask exists, return this mask StorageResult::Ok(Option::Some(Vec<(MaskObject, u64)>)).
  • If two masks exist with the same score, return both StorageResult::Ok(Option::Some(Vec<(MaskObject, u64)>)).
  • If two masks exist with the different score, return both in descending order StorageResult::Ok(Option::Some(Vec<(MaskObject, u64)>)).

#[must_use]pub fn number_of_unique_masks<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Returns the number of unique masks.

#[must_use]pub fn delete_coordinator_data<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Deletes all coordinator data. This includes the coordinator state as well as the SumDict, SeedDict and mask dictionary.

#[must_use]pub fn delete_dicts<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Deletes the SumDict, SeedDict and mask dictionary.

#[must_use]pub fn set_latest_global_model_id<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Sets the latest global model id.

Behavior

  • If no global model id has been set yet, set the new id and return StorageResult::Ok(()).
  • If the global model id already exists, override with the new id and return StorageResult::Ok(()).

#[must_use]pub fn latest_global_model_id<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<Option<String>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Returns the latest global model id.

Behavior

  • If the global model id does not exist, return StorageResult::Ok(None).
  • If the global model id exists, return StorageResult::Ok(Some(String))).

#[must_use]pub fn is_ready<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Checks if the CoordinatorStorage is ready to process requests.

Behavior

If the CoordinatorStorage is ready to process requests, return StorageResult::Ok(()). If the CoordinatorStorage cannot process requests because of a connection error, for example, return StorageResult::Err(error).

Loading content...

Implementors

impl CoordinatorStorage for Client[src]

pub fn seed_dict<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<Option<SeedDict>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Note

This method is not an atomic operation.

pub fn incr_mask_score<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 mut self,
    sum_pk: &'life1 SumParticipantPublicKey,
    mask: &'life2 MaskObject
) -> Pin<Box<dyn Future<Output = StorageResult<MaskScoreIncr>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

The maximum length of a serialized mask is 512 Megabytes.

pub fn delete_coordinator_data<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Note

This method is not an atomic operation.

pub fn delete_dicts<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Note

This method is not an atomic operation.

impl<C, M> CoordinatorStorage for Store<C, M> where
    C: CoordinatorStorage,
    M: ModelStorage
[src]

Loading content...