MemoryDataStore

Struct 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§

Source§

impl MemoryDataStore

Source

pub fn new() -> Self

Trait Implementations§

Source§

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

Verifies the TimestampedCheckpoint signature.
Source§

impl Default for MemoryDataStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,