Struct snarkvm_compiler::ProgramMemory
source · [−]pub struct ProgramMemory<N: Network> { /* private fields */ }
Expand description
An in-memory program state storage.
Trait Implementations
sourceimpl<N: Clone + Network> Clone for ProgramMemory<N>
impl<N: Clone + Network> Clone for ProgramMemory<N>
sourcefn clone(&self) -> ProgramMemory<N>
fn clone(&self) -> ProgramMemory<N>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<N: Network> ProgramStorage<N> for ProgramMemory<N>
impl<N: Network> ProgramStorage<N> for ProgramMemory<N>
sourcefn program_id_map(&self) -> &Self::ProgramIDMap
fn program_id_map(&self) -> &Self::ProgramIDMap
Returns the program ID map.
sourcefn mapping_id_map(&self) -> &Self::MappingIDMap
fn mapping_id_map(&self) -> &Self::MappingIDMap
Returns the mapping ID map.
sourcefn key_value_id_map(&self) -> &Self::KeyValueIDMap
fn key_value_id_map(&self) -> &Self::KeyValueIDMap
Returns the key-value ID map.
type ProgramIDMap = MemoryMap<ProgramID<N>, IndexSet<Identifier<N>, RandomState>>
type ProgramIDMap = MemoryMap<ProgramID<N>, IndexSet<Identifier<N>, RandomState>>
The mapping of program ID
to [mapping name]
.
type MappingIDMap = MemoryMap<(ProgramID<N>, Identifier<N>), Field<N>>
type MappingIDMap = MemoryMap<(ProgramID<N>, Identifier<N>), Field<N>>
The mapping of (program ID, mapping name)
to mapping ID
.
type KeyValueIDMap = MemoryMap<Field<N>, IndexMap<Field<N>, Field<N>, RandomState>>
type KeyValueIDMap = MemoryMap<Field<N>, IndexMap<Field<N>, Field<N>, RandomState>>
The mapping of mapping ID
to [(key ID, value ID)]
.
sourcefn start_atomic(&self)
fn start_atomic(&self)
Starts an atomic batch write operation.
sourcefn is_atomic_in_progress(&self) -> bool
fn is_atomic_in_progress(&self) -> bool
Checks if an atomic batch is in progress.
sourcefn abort_atomic(&self)
fn abort_atomic(&self)
Aborts an atomic batch write operation.
sourcefn finish_atomic(&self) -> Result<()>
fn finish_atomic(&self) -> Result<()>
Finishes an atomic batch write operation.
sourcefn initialize_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<()>
fn initialize_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<()>
Initializes the given program ID
and mapping name
in storage.
sourcefn insert_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: Plaintext<N>,
value: Value<N>
) -> Result<()>
fn insert_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: Plaintext<N>,
value: Value<N>
) -> Result<()>
Stores the given (key, value)
pair at the given program ID
and mapping name
in storage.
If the key
already exists, the method returns an error. Read more
sourcefn update_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: Plaintext<N>,
value: Value<N>
) -> Result<()>
fn update_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: Plaintext<N>,
value: Value<N>
) -> Result<()>
Stores the given (key, value)
pair at the given program ID
and mapping name
in storage.
If the key
does not exist, the (key, value)
pair is initialized.
If the key
already exists, the value
is overwritten. Read more
sourcefn remove_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<()>
fn remove_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<()>
Removes the key-value pair for the given program ID
, mapping name
, and key
from storage.
sourcefn remove_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<()>
fn remove_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<()>
Removes the mapping for the given program ID
and mapping name
from storage,
along with all associated key-value pairs in storage. Read more
sourcefn remove_program(&self, program_id: &ProgramID<N>) -> Result<()>
fn remove_program(&self, program_id: &ProgramID<N>) -> Result<()>
Removes the program for the given program ID
from storage,
along with all associated mappings and key-value pairs in storage. Read more
sourcefn contains_program(&self, program_id: &ProgramID<N>) -> Result<bool>
fn contains_program(&self, program_id: &ProgramID<N>) -> Result<bool>
Returns true
if the given program ID
exist.
sourcefn contains_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<bool>
fn contains_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<bool>
Returns true
if the given program ID
and mapping name
exist.
sourcefn contains_key(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<bool>
fn contains_key(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<bool>
Returns true
if the given program ID
, mapping name
, and key
exist.
sourcefn get_mapping_names(
&self,
program_id: &ProgramID<N>
) -> Result<Option<IndexSet<Identifier<N>>>>
fn get_mapping_names(
&self,
program_id: &ProgramID<N>
) -> Result<Option<IndexSet<Identifier<N>>>>
Returns the mapping names for the given program ID
.
sourcefn get_mapping_id(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<Option<Field<N>>>
fn get_mapping_id(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<Option<Field<N>>>
Returns the mapping ID for the given program ID
and mapping name
.
sourcefn get_key_id(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<Option<Field<N>>>
fn get_key_id(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<Option<Field<N>>>
Returns the key ID for the given program ID
, mapping name
, and key
.
sourcefn get_key(&self, key_id: &Field<N>) -> Result<Option<Plaintext<N>>>
fn get_key(&self, key_id: &Field<N>) -> Result<Option<Plaintext<N>>>
Returns the key for the given key ID
.
sourcefn get_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<Option<Value<N>>>
fn get_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<Option<Value<N>>>
Returns the value for the given program ID
, mapping name
, and key
.
sourcefn get_value_from_key_id(&self, key_id: &Field<N>) -> Result<Option<Value<N>>>
fn get_value_from_key_id(&self, key_id: &Field<N>) -> Result<Option<Value<N>>>
Returns the value for the given key ID
.
sourcefn get_checksum(&self) -> Result<Field<N>>
fn get_checksum(&self) -> Result<Field<N>>
Returns the checksum.
Auto Trait Implementations
impl<N> !RefUnwindSafe for ProgramMemory<N>
impl<N> Send for ProgramMemory<N>
impl<N> Sync for ProgramMemory<N>
impl<N> Unpin for ProgramMemory<N>
impl<N> !UnwindSafe for ProgramMemory<N>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more