snarkvm_ledger_store::helpers::memory::internal

Struct NestedMemoryMap

Source
pub struct NestedMemoryMap<M: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, K: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> { /* private fields */ }

Trait Implementations§

Source§

impl<M: Clone + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, K: Clone + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Clone for NestedMemoryMap<M, K, V>

Source§

fn clone(&self) -> NestedMemoryMap<M, K, V>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, K: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> Default for NestedMemoryMap<M, K, V>

Source§

fn default() -> Self

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

impl<M: Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, K: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> FromIterator<(M, K, V)> for NestedMemoryMap<M, K, V>

Source§

fn from_iter<I: IntoIterator<Item = (M, K, V)>>(iter: I) -> Self

Initializes a new NestedMemoryMap from the given iterator.

Source§

impl<'a, M: 'a + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, K: 'a + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: 'a + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> NestedMap<'a, M, K, V> for NestedMemoryMap<M, K, V>

Source§

fn insert(&self, map: M, key: K, value: V) -> Result<()>

Inserts the given map-key-value pair.

Source§

fn remove_map(&self, map: &M) -> Result<()>

Removes the given map.

Source§

fn remove_key(&self, map: &M, key: &K) -> Result<()>

Removes the key-value pair for the given map and key.

Source§

fn start_atomic(&self)

Begins an atomic operation. Any further calls to insert and remove will be queued without an actual write taking place until finish_atomic is called.

Source§

fn is_atomic_in_progress(&self) -> bool

Checks whether an atomic operation is currently in progress. This can be done to ensure that lower-level operations don’t start and finish their individual atomic write batch if they are already part of a larger one.

Source§

fn atomic_checkpoint(&self)

Saves the current list of pending operations, so that if atomic_rewind is called, we roll back all future operations, and return to the start of this checkpoint.

Source§

fn clear_latest_checkpoint(&self)

Removes the latest atomic checkpoint.

Source§

fn atomic_rewind(&self)

Removes all pending operations to the last atomic_checkpoint (or to start_atomic if no checkpoints have been created).

Source§

fn abort_atomic(&self)

Aborts the current atomic operation.

Source§

fn finish_atomic(&self) -> Result<()>

Finishes an atomic operation, performing all the queued writes.

Source§

impl<'a, M: 'a + Copy + Clone + PartialEq + Eq + Hash + Serialize + for<'de> Deserialize<'de> + Send + Sync, K: 'a + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync, V: 'a + Clone + PartialEq + Eq + Serialize + for<'de> Deserialize<'de> + Send + Sync> NestedMapRead<'a, M, K, V> for NestedMemoryMap<M, K, V>

Source§

fn len_map_confirmed(&self, map: &M) -> Result<usize>

Returns the number of confirmed entries in the map.

Source§

fn contains_key_confirmed(&self, map: &M, key: &K) -> Result<bool>

Returns true if the given key exists in the map.

Source§

fn contains_key_speculative(&self, map: &M, key: &K) -> Result<bool>

Returns true if the given key exists in the map. This method first checks the atomic batch, and if it does not exist, then checks the map.

Source§

fn get_map_confirmed(&'a self, map: &M) -> Result<Vec<(K, V)>>

Returns the confirmed key-value pairs for the given map, if it exists.

Source§

fn get_map_speculative(&'a self, map: &M) -> Result<Vec<(K, V)>>

Returns the speculative key-value pairs for the given map, if it exists.

Source§

fn get_value_confirmed(&'a self, map: &M, key: &K) -> Result<Option<Cow<'a, V>>>

Returns the value for the given key from the map, if it exists.

Source§

fn get_value_pending(&self, map: &M, key: &K) -> Option<Option<V>>

Returns the current value for the given key if it is scheduled to be inserted as part of an atomic batch.

If the key does not exist, returns None. If the key is removed in the batch, returns Some(None). If the key is inserted in the batch, returns Some(Some(value)).

Source§

fn iter_pending(&'a self) -> Self::PendingIterator

Returns an iterator visiting each map-key-value pair in the atomic batch.

Source§

fn iter_confirmed(&'a self) -> Self::Iterator

Returns an iterator visiting each confirmed map-key-value pair.

Source§

fn keys_confirmed(&'a self) -> Self::Keys

Returns an iterator over each confirmed key.

Source§

fn values_confirmed(&'a self) -> Self::Values

Returns an iterator over each confirmed value.

Source§

type Iterator = IntoIter<(Cow<'a, M>, Cow<'a, K>, Cow<'a, V>)>

Source§

type Keys = IntoIter<(Cow<'a, M>, Cow<'a, K>)>

Source§

type PendingIterator = Map<IntoIter<(M, Option<K>, Option<V>)>, fn(_: (M, Option<K>, Option<V>)) -> (Cow<'a, M>, Option<Cow<'a, K>>, Option<Cow<'a, V>>)>

Source§

type Values = Map<IntoValues<Vec<u8>, V>, fn(_: V) -> Cow<'a, V>>

Source§

fn is_empty_map_confirmed(&self, map: &M) -> Result<bool>

Checks whether there are any confirmed entries in the map.
Source§

fn get_value_speculative( &'a self, map: &M, key: &K, ) -> Result<Option<Cow<'a, V>>>

Returns the value for the given key from the atomic batch first, if it exists, or return from the map, otherwise.

Auto Trait Implementations§

§

impl<M, K, V> Freeze for NestedMemoryMap<M, K, V>

§

impl<M, K, V> !RefUnwindSafe for NestedMemoryMap<M, K, V>

§

impl<M, K, V> Send for NestedMemoryMap<M, K, V>

§

impl<M, K, V> Sync for NestedMemoryMap<M, K, V>

§

impl<M, K, V> Unpin for NestedMemoryMap<M, K, V>

§

impl<M, K, V> !UnwindSafe for NestedMemoryMap<M, K, V>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V