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 Freeze for MemoryDataStore
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more