DataStore

Trait DataStore 

Source
pub trait DataStore: Send + Sync {
Show 23 methods // Required methods 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_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_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 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 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 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 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 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 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 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 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 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 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_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_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_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_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_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_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_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 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_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_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;
}
Expand description

Implemented by data stores.

Required Methods§

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.

This is an expensive operation and should only be performed on startup.

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.

This is an expensive operation and should only be performed on startup.

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 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.

The record must be in the pending state.

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.

The record must be in a pending state.

If validation succeeds, the record will be considered part of the log.

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.

The missing set is the set of content digests that are currently missing from data storage.

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.

The record must be in the pending state.

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.

The record must be in a pending state.

If validation succeeds, the record will be considered part of the log.

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.

The record must be in a pending state.

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.

The record must be in a pending state.

Returns true if the record has all of its content present as a result of this update.

Returns false if the given digest was already marked present.

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_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 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_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.

This is different from validate_package_record in that only the signature on the envelope is verified.

It does not attempt to validate the record itself.

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.

Implementors§