[−][src]Trait xaynet_server::storage::traits::ModelStorage
An abstract model storage.
Required methods
#[must_use]pub fn set_global_model<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
round_id: u64,
round_seed: &'life1 RoundSeed,
global_model: &'life2 Model
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
round_id: u64,
round_seed: &'life1 RoundSeed,
global_model: &'life2 Model
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Sets a global model.
Behavior
- If the global model already exists (has the same model id), return
StorageResult::Err(StorageError))
. - If the global model does not exist, set the model and return
StorageResult::Ok(String)
#[must_use]pub fn global_model<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Model>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Model>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Returns a global model.
Behavior
- If the global model does not exist, return
StorageResult::Ok(Option::None)
. - If the global model exists, return
StorageResult::Ok(Option::Some(Model))
.
#[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]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Checks if the ModelStorage
is ready to process requests.
Behavior
If the ModelStorage
is ready to process requests, return StorageResult::Ok(())
.
If the ModelStorage
cannot process requests because of a connection error,
for example, return StorageResult::Err(error)
.
Provided methods
pub fn create_global_model_id(round_id: u64, round_seed: &RoundSeed) -> String
[src]
Creates a unique global model id by using the round id and the round seed in which the global model was created.
The format of the default implementation is roundid_roundseed
,
where the RoundSeed
is encoded in hexadecimal.
Implementors
impl ModelStorage for NoOp
[src]
pub fn set_global_model<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
round_id: u64,
round_seed: &'life1 RoundSeed,
_global_model: &'life2 Model
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
round_id: u64,
round_seed: &'life1 RoundSeed,
_global_model: &'life2 Model
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
pub fn global_model<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Model>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
_id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Model>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
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]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl ModelStorage for Client
[src]
This is supported on crate feature
model-persistence
only.pub fn set_global_model<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
round_id: u64,
round_seed: &'life1 RoundSeed,
global_model: &'life2 Model
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
round_id: u64,
round_seed: &'life1 RoundSeed,
global_model: &'life2 Model
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
pub fn global_model<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Model>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Model>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
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]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl<C, M> ModelStorage for Store<C, M> where
C: CoordinatorStorage,
M: ModelStorage,
[src]
C: CoordinatorStorage,
M: ModelStorage,
pub fn set_global_model<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
round_id: u64,
round_seed: &'life1 RoundSeed,
global_model: &'life2 Model
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
round_id: u64,
round_seed: &'life1 RoundSeed,
global_model: &'life2 Model
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
pub fn global_model<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Model>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
id: &'life1 str
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Model>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
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]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,