Struct snarkvm_compiler::ProgramStore
source · [−]pub struct ProgramStore<N: Network, P: ProgramStorage<N>> { /* private fields */ }Expand description
The program store.
Implementations
sourceimpl<N: Network, P: ProgramStorage<N>> ProgramStore<N, P>
impl<N: Network, P: ProgramStorage<N>> ProgramStore<N, P>
sourcepub fn initialize_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<()>
pub fn initialize_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<()>
Initializes the given program ID and mapping name in storage.
sourcepub fn insert_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: Plaintext<N>,
value: Value<N>
) -> Result<()>
pub 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.
sourcepub fn update_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: Plaintext<N>,
value: Value<N>
) -> Result<()>
pub 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.
sourcepub fn remove_key_value(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<()>
pub 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.
sourcepub fn remove_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<()>
pub 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.
sourcepub fn remove_program(&self, program_id: &ProgramID<N>) -> Result<()>
pub 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.
sourcepub fn start_atomic(&self)
pub fn start_atomic(&self)
Starts an atomic batch write operation.
sourcepub fn abort_atomic(&self)
pub fn abort_atomic(&self)
Aborts an atomic batch write operation.
sourcepub fn finish_atomic(&self) -> Result<()>
pub fn finish_atomic(&self) -> Result<()>
Finishes an atomic batch write operation.
sourceimpl<N: Network, P: ProgramStorage<N>> ProgramStore<N, P>
impl<N: Network, P: ProgramStorage<N>> ProgramStore<N, P>
sourcepub fn contains_program(&self, program_id: &ProgramID<N>) -> Result<bool>
pub fn contains_program(&self, program_id: &ProgramID<N>) -> Result<bool>
Returns true if the given program ID exist.
sourcepub fn contains_mapping(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>
) -> Result<bool>
pub 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.
sourcepub fn contains_key(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
key: &Plaintext<N>
) -> Result<bool>
pub 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.
sourceimpl<N: Network, P: ProgramStorage<N>> ProgramStore<N, P>
impl<N: Network, P: ProgramStorage<N>> ProgramStore<N, P>
sourcepub fn get_mapping_names(
&self,
program_id: &ProgramID<N>
) -> Result<Option<IndexSet<Identifier<N>>>>
pub fn get_mapping_names(
&self,
program_id: &ProgramID<N>
) -> Result<Option<IndexSet<Identifier<N>>>>
Returns the mapping names for the given program ID.
Trait Implementations
sourceimpl<N: Clone + Network, P: Clone + ProgramStorage<N>> Clone for ProgramStore<N, P>
impl<N: Clone + Network, P: Clone + ProgramStorage<N>> Clone for ProgramStore<N, P>
sourcefn clone(&self) -> ProgramStore<N, P>
fn clone(&self) -> ProgramStore<N, P>
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
Auto Trait Implementations
impl<N, P> RefUnwindSafe for ProgramStore<N, P> where
N: RefUnwindSafe,
P: RefUnwindSafe,
impl<N, P> Send for ProgramStore<N, P> where
P: Send,
impl<N, P> Sync for ProgramStore<N, P>
impl<N, P> Unpin for ProgramStore<N, P> where
N: Unpin,
P: Unpin,
impl<N, P> UnwindSafe for ProgramStore<N, P> where
N: UnwindSafe,
P: UnwindSafe,
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