Struct warg_server::datastore::MemoryDataStore
source · pub struct MemoryDataStore(/* private fields */);Expand description
Represents an in-memory data store.
Data is not persisted between restarts of the server.
Note: this is mainly used for testing, so it is not very efficient as it shares a single RwLock for all operations.
Implementations§
Trait Implementations§
source§impl DataStore for MemoryDataStore
impl DataStore for MemoryDataStore
source§fn get_all_checkpoints<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<TimestampedCheckpoint, DataStoreError>> + Send>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_checkpoints<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<TimestampedCheckpoint, DataStoreError>> + Send>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets a stream of all checkpoints. Read more
source§fn get_all_validated_records<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<LogLeaf, DataStoreError>> + Send>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_validated_records<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<LogLeaf, DataStoreError>> + Send>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets a stream of all validated records. Read more
source§fn get_log_leafs_starting_with_registry_index<'life0, 'async_trait>(
&'life0 self,
starting_index: RegistryIndex,
limit: usize
) -> Pin<Box<dyn Future<Output = Result<Vec<(RegistryIndex, LogLeaf)>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_log_leafs_starting_with_registry_index<'life0, 'async_trait>(
&'life0 self,
starting_index: RegistryIndex,
limit: usize
) -> Pin<Box<dyn Future<Output = Result<Vec<(RegistryIndex, LogLeaf)>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets a batch of log leafs starting with a registry log index.
source§fn get_log_leafs_with_registry_index<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 [RegistryIndex]
) -> Pin<Box<dyn Future<Output = Result<Vec<LogLeaf>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_log_leafs_with_registry_index<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 [RegistryIndex]
) -> Pin<Box<dyn Future<Output = Result<Vec<LogLeaf>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Looks up the log_id and record_id from the registry log index.
source§fn get_package_names<'life0, 'life1, 'async_trait>(
&'life0 self,
log_ids: &'life1 [LogId]
) -> Pin<Box<dyn Future<Output = Result<IndexMap<LogId, Option<PackageName>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_package_names<'life0, 'life1, 'async_trait>(
&'life0 self,
log_ids: &'life1 [LogId]
) -> Pin<Box<dyn Future<Output = Result<IndexMap<LogId, Option<PackageName>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets package names from log IDs. If package name is unavailable, a corresponding
None is returned.source§fn store_operator_record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
record: &'life3 ProtoEnvelope<OperatorRecord>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store_operator_record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
record: &'life3 ProtoEnvelope<OperatorRecord>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Stores the given operator record.
source§fn reject_operator_record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
reason: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn reject_operator_record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
reason: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Rejects the given operator record. Read more
source§fn commit_operator_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
registry_index: RegistryIndex
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn commit_operator_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
registry_index: RegistryIndex
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Commits the given operator record. Read more
source§fn store_package_record<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
package_name: &'life2 PackageName,
record_id: &'life3 RecordId,
record: &'life4 ProtoEnvelope<PackageRecord>,
missing: &'life5 IndexSet<&'life6 AnyHash>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
fn store_package_record<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
package_name: &'life2 PackageName,
record_id: &'life3 RecordId,
record: &'life4 ProtoEnvelope<PackageRecord>,
missing: &'life5 IndexSet<&'life6 AnyHash>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
Stores the given package record. Read more
source§fn reject_package_record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
reason: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn reject_package_record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
reason: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Rejects the given package record. Read more
source§fn commit_package_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
registry_index: RegistryIndex
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn commit_package_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
registry_index: RegistryIndex
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Commits the given package record. Read more
source§fn is_content_missing<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
digest: &'life3 AnyHash
) -> Pin<Box<dyn Future<Output = Result<bool, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn is_content_missing<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
digest: &'life3 AnyHash
) -> Pin<Box<dyn Future<Output = Result<bool, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Determines if the given content digest is missing for the record. Read more
source§fn set_content_present<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
digest: &'life3 AnyHash
) -> Pin<Box<dyn Future<Output = Result<bool, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn set_content_present<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId,
digest: &'life3 AnyHash
) -> Pin<Box<dyn Future<Output = Result<bool, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Sets the present flag for the given record and content digest. Read more
source§fn store_checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
_checkpoint_id: &'life1 AnyHash,
ts_checkpoint: SerdeEnvelope<TimestampedCheckpoint>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
_checkpoint_id: &'life1 AnyHash,
ts_checkpoint: SerdeEnvelope<TimestampedCheckpoint>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stores a new checkpoint.
source§fn get_latest_checkpoint<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<SerdeEnvelope<TimestampedCheckpoint>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_latest_checkpoint<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<SerdeEnvelope<TimestampedCheckpoint>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets the latest checkpoint.
source§fn get_checkpoint<'life0, 'async_trait>(
&'life0 self,
log_length: RegistryLen
) -> Pin<Box<dyn Future<Output = Result<SerdeEnvelope<TimestampedCheckpoint>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_checkpoint<'life0, 'async_trait>(
&'life0 self,
log_length: RegistryLen
) -> Pin<Box<dyn Future<Output = Result<SerdeEnvelope<TimestampedCheckpoint>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get checkpoint by log length.
source§fn get_operator_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
registry_log_length: RegistryLen,
since: Option<&'life2 RecordId>,
limit: u16
) -> Pin<Box<dyn Future<Output = Result<Vec<PublishedProtoEnvelope<OperatorRecord>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_operator_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
registry_log_length: RegistryLen,
since: Option<&'life2 RecordId>,
limit: u16
) -> Pin<Box<dyn Future<Output = Result<Vec<PublishedProtoEnvelope<OperatorRecord>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gets the operator records for the given registry log length.
source§fn get_package_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
registry_log_length: RegistryLen,
since: Option<&'life2 RecordId>,
limit: u16
) -> Pin<Box<dyn Future<Output = Result<Vec<PublishedProtoEnvelope<PackageRecord>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_package_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
registry_log_length: RegistryLen,
since: Option<&'life2 RecordId>,
limit: u16
) -> Pin<Box<dyn Future<Output = Result<Vec<PublishedProtoEnvelope<PackageRecord>>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gets the package records for the given registry log length.
source§fn get_operator_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId
) -> Pin<Box<dyn Future<Output = Result<Record<OperatorRecord>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_operator_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId
) -> Pin<Box<dyn Future<Output = Result<Record<OperatorRecord>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gets an operator record.
source§fn get_package_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId
) -> Pin<Box<dyn Future<Output = Result<Record<PackageRecord>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_package_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record_id: &'life2 RecordId
) -> Pin<Box<dyn Future<Output = Result<Record<PackageRecord>, DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gets a package record.
source§fn verify_package_record_signature<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record: &'life2 ProtoEnvelope<PackageRecord>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn verify_package_record_signature<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
log_id: &'life1 LogId,
record: &'life2 ProtoEnvelope<PackageRecord>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verifies the signature of a package record. Read more
source§fn verify_can_publish_package<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operator_log_id: &'life1 LogId,
package_name: &'life2 PackageName
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn verify_can_publish_package<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operator_log_id: &'life1 LogId,
package_name: &'life2 PackageName
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verifies the package name is unique in a case insensitive way and that the
package namespace is defined for this registry and is not imported
from another registry.
source§fn verify_timestamped_checkpoint_signature<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operator_log_id: &'life1 LogId,
ts_checkpoint: &'life2 SerdeEnvelope<TimestampedCheckpoint>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn verify_timestamped_checkpoint_signature<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operator_log_id: &'life1 LogId,
ts_checkpoint: &'life2 SerdeEnvelope<TimestampedCheckpoint>
) -> Pin<Box<dyn Future<Output = Result<(), DataStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verifies the TimestampedCheckpoint signature.
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryDataStore
impl Send for MemoryDataStore
impl Sync for MemoryDataStore
impl Unpin for MemoryDataStore
impl !UnwindSafe for MemoryDataStore
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more