pub struct EncryptedBlockStorage<S> { /* private fields */ }Implementations§
Source§impl<S> EncryptedBlockStorage<S>where
S: AnyBlockStorage,
impl<S> EncryptedBlockStorage<S>where
S: AnyBlockStorage,
pub fn new( next: S, key: Secret, algorithm: Algorithm, mapping: EncryptedBlockStorageMapping, ) -> Self
pub fn with_encryption_reference_mode( self, mode: EncryptionReferenceMode, ) -> Self
Sourcepub fn set_storage(&mut self, next: S)
pub fn set_storage(&mut self, next: S)
Set next storage.
Sourcepub async fn insert_mappings(
&self,
mappings: impl IntoIterator<Item = MappedCid>,
)
pub async fn insert_mappings( &self, mappings: impl IntoIterator<Item = MappedCid>, )
Add known mappings.
Sourcepub async fn load_mapping(&self, map: &Cid) -> Result<(), StorageError>
pub async fn load_mapping(&self, map: &Cid) -> Result<(), StorageError>
Load mapping from CID. This will add the mappings to the existing.
Sourcepub async fn flush_mapping(&self) -> Result<Option<Cid>, StorageError>
pub async fn flush_mapping(&self) -> Result<Option<Cid>, StorageError>
Flush mapping to (parent) storage. Returns the encrypted mapping CID. The mapping tree will also only link to encrypted CIDs.
Sourcepub async fn clear_mapping(&self, keep: impl IntoIterator<Item = Cid>)
pub async fn clear_mapping(&self, keep: impl IntoIterator<Item = Cid>)
Clear encryption mapping.
Sourcepub async fn regenerate_mapping(
&mut self,
cids: impl Iterator<Item = Cid>,
) -> Result<Option<Cid>, StorageError>
pub async fn regenerate_mapping( &mut self, cids: impl Iterator<Item = Cid>, ) -> Result<Option<Cid>, StorageError>
This will regenerate and flush the encryption block mapping using supplied CIDs.
Sourcepub async fn insert_mapping(
&self,
encrypted: &Cid,
plain: Option<&Cid>,
) -> Result<bool, StorageError>
👎Deprecated
pub async fn insert_mapping( &self, encrypted: &Cid, plain: Option<&Cid>, ) -> Result<bool, StorageError>
Insert mapping for encrypted block. Returns true if mapping has been changed.
Sourcepub async fn get_unencrypted(&self, cid: &Cid) -> Result<Block, StorageError>
pub async fn get_unencrypted(&self, cid: &Cid) -> Result<Block, StorageError>
Get encrypted cid as unencrypted block.
Sourcepub async fn set_encrypted(&self, block: Block) -> Result<Cid, StorageError>
pub async fn set_encrypted(&self, block: Block) -> Result<Cid, StorageError>
Set encrypted block. Expects the encrypted block belongs to our key.
Errors:
StorageError::InvalidArgument: Block can not be decrypted.
Trait Implementations§
Source§impl<S> BlockStorage for EncryptedBlockStorage<S>where
S: AnyBlockStorage,
impl<S> BlockStorage for EncryptedBlockStorage<S>where
S: AnyBlockStorage,
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Block, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<Block, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get block.
Source§fn set<'life0, 'async_trait>(
&'life0 self,
block: Block,
) -> Pin<Box<dyn Future<Output = Result<Cid, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set<'life0, 'async_trait>(
&'life0 self,
block: Block,
) -> Pin<Box<dyn Future<Output = Result<Cid, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Inserts a block into storage.
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a block.
Source§fn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<BlockStat, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stat<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Result<BlockStat, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stat a block.
Source§fn max_block_size(&self) -> usize
fn max_block_size(&self) -> usize
Maximum accepted block size.
Source§impl<S> BlockStorageContentMapping for EncryptedBlockStorage<S>
impl<S> BlockStorageContentMapping for EncryptedBlockStorage<S>
Source§fn is_content_mapped<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_content_mapped<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Whether the mapping is active.
Source§fn to_plain<'life0, 'life1, 'async_trait>(
&'life0 self,
mapped: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Option<Cid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn to_plain<'life0, 'life1, 'async_trait>(
&'life0 self,
mapped: &'life1 Cid,
) -> Pin<Box<dyn Future<Output = Option<Cid>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<S: Clone> Clone for EncryptedBlockStorage<S>
impl<S: Clone> Clone for EncryptedBlockStorage<S>
Source§fn clone(&self) -> EncryptedBlockStorage<S>
fn clone(&self) -> EncryptedBlockStorage<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S> CloneWithBlockStorageSettings for EncryptedBlockStorage<S>where
S: CloneWithBlockStorageSettings,
impl<S> CloneWithBlockStorageSettings for EncryptedBlockStorage<S>where
S: CloneWithBlockStorageSettings,
fn clone_with_settings(&self, settings: BlockStorageCloneSettings) -> Self
fn without_networking(&self) -> Self
Source§impl<S: Debug> Debug for EncryptedBlockStorage<S>
impl<S: Debug> Debug for EncryptedBlockStorage<S>
Source§impl<S> ExtendedBlockStorage for EncryptedBlockStorage<S>where
S: ExtendedBlockStorage + Clone + 'static,
impl<S> ExtendedBlockStorage for EncryptedBlockStorage<S>where
S: ExtendedBlockStorage + Clone + 'static,
Source§fn set_extended<'life0, 'async_trait>(
&'life0 self,
extended_block: ExtendedBlock,
) -> Pin<Box<dyn Future<Output = Result<Cid, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_extended<'life0, 'async_trait>(
&'life0 self,
extended_block: ExtendedBlock,
) -> Pin<Box<dyn Future<Output = Result<Cid, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Inserts a block into storage.
Auto Trait Implementations§
impl<S> Freeze for EncryptedBlockStorage<S>where
S: Freeze,
impl<S> !RefUnwindSafe for EncryptedBlockStorage<S>
impl<S> Send for EncryptedBlockStorage<S>where
S: Send,
impl<S> Sync for EncryptedBlockStorage<S>where
S: Sync,
impl<S> Unpin for EncryptedBlockStorage<S>where
S: Unpin,
impl<S> UnsafeUnpin for EncryptedBlockStorage<S>where
S: UnsafeUnpin,
impl<S> !UnwindSafe for EncryptedBlockStorage<S>
Blanket Implementations§
Source§impl<T> BlockStorageExt for Twhere
T: BlockStorage + ?Sized,
impl<T> BlockStorageExt for Twhere
T: BlockStorage + ?Sized,
Source§async fn get_value_or_default<T>(
&self,
link: &OptionLink<T>,
) -> Result<T, StorageError>
async fn get_value_or_default<T>( &self, link: &OptionLink<T>, ) -> Result<T, StorageError>
Get value or default from link.
Source§async fn get_value_or_none<T>(
&self,
link: &OptionLink<T>,
) -> Result<Option<T>, StorageError>
async fn get_value_or_none<T>( &self, link: &OptionLink<T>, ) -> Result<Option<T>, StorageError>
Get value or default from link.
Source§async fn set_value<T>(&self, value: &T) -> Result<Link<T>, StorageError>
async fn set_value<T>(&self, value: &T) -> Result<Link<T>, StorageError>
Create link for value.
Source§async fn get_deserialized<T>(&self, item: &Cid<64>) -> Result<T, StorageError>
async fn get_deserialized<T>(&self, item: &Cid<64>) -> Result<T, StorageError>
Get deserialized value.
Source§async fn set_serialized<T>(&self, value: &T) -> Result<Cid<64>, StorageError>
async fn set_serialized<T>(&self, value: &T) -> Result<Cid<64>, StorageError>
Set serialized value.
Source§async fn get_default<T>(
&self,
item: &Option<Cid<64>>,
) -> Result<T, StorageError>
async fn get_default<T>( &self, item: &Option<Cid<64>>, ) -> Result<T, StorageError>
Get deserialized value.
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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