pub struct KVStore<Key, Ct> { /* private fields */ }Expand description
The KVStore is a specialized encrypted HashMap
- Keys are clear numbers
- Values are RadixCiphertext or SignedRadixCiphertext
It supports getting/modifying existing pairs of (key,value) using an encrypted key.
To serialize a KVStore it must first be compressed with KVStore::compress
Implementations§
Source§impl<Key, Ct> KVStore<Key, Ct>
impl<Key, Ct> KVStore<Key, Ct>
Sourcepub fn get(&self, key: &Key) -> Option<&Ct>where
Key: Ord,
pub fn get(&self, key: &Key) -> Option<&Ct>where
Key: Ord,
Returns the value stored for the key if any
Key is in clear, see ServerKey::kv_store_get if you wish to query using an encrypted key
Sourcepub fn get_mut(&mut self, key: &Key) -> Option<&mut Ct>where
Key: Ord,
pub fn get_mut(&mut self, key: &Key) -> Option<&mut Ct>where
Key: Ord,
Returns the value stored for the key if any
Key is in clear, see ServerKey::kv_store_get if you wish to query using an encrypted key
Sourcepub fn insert(&mut self, key: Key, value: Ct) -> Option<Ct>where
Key: Ord,
Ct: IntegerRadixCiphertext,
pub fn insert(&mut self, key: Key, value: Ct) -> Option<Ct>where
Key: Ord,
Ct: IntegerRadixCiphertext,
Sourcepub fn clear_get(&self, key: &Key) -> Option<&Ct>where
Key: Ord,
pub fn clear_get(&self, key: &Key) -> Option<&Ct>where
Key: Ord,
Returns the value associated to the key given in clear
pub fn contains_key(&self, key: &Key) -> boolwhere
Key: Ord,
pub fn iter(&self) -> impl Iterator<Item = (&Key, &Ct)>
Source§impl<Key, Ct> KVStore<Key, Ct>
impl<Key, Ct> KVStore<Key, Ct>
Sourcepub fn compress(
&self,
compression_key: &CompressionKey,
) -> CompressedKVStore<Key, Ct>
pub fn compress( &self, compression_key: &CompressionKey, ) -> CompressedKVStore<Key, Ct>
Compress the KVStore to be able to serialize it
Trait Implementations§
Auto Trait Implementations§
impl<Key, Ct> Freeze for KVStore<Key, Ct>
impl<Key, Ct> RefUnwindSafe for KVStore<Key, Ct>where
Key: RefUnwindSafe,
Ct: RefUnwindSafe,
impl<Key, Ct> Send for KVStore<Key, Ct>
impl<Key, Ct> Sync for KVStore<Key, Ct>
impl<Key, Ct> Unpin for KVStore<Key, Ct>
impl<Key, Ct> UnsafeUnpin for KVStore<Key, Ct>
impl<Key, Ct> UnwindSafe for KVStore<Key, Ct>where
Key: RefUnwindSafe,
Ct: RefUnwindSafe,
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> 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