pub trait FinalizeStoreTrait<N: Network> {
// Required methods
fn contains_mapping_confirmed(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
) -> Result<bool>;
fn contains_key_speculative(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: &Plaintext<N>,
) -> Result<bool>;
fn get_value_speculative(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: &Plaintext<N>,
) -> Result<Option<Value<N>>>;
fn insert_key_value(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: Plaintext<N>,
value: Value<N>,
) -> Result<FinalizeOperation<N>>;
fn update_key_value(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: Plaintext<N>,
value: Value<N>,
) -> Result<FinalizeOperation<N>>;
fn remove_key_value(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: &Plaintext<N>,
) -> Result<Option<FinalizeOperation<N>>>;
}
Required Methods§
Sourcefn contains_mapping_confirmed(
&self,
program_id: &ProgramID<N>,
mapping_name: &Identifier<N>,
) -> Result<bool>
fn contains_mapping_confirmed( &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_speculative(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: &Plaintext<N>,
) -> Result<bool>
fn contains_key_speculative( &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_value_speculative(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: &Plaintext<N>,
) -> Result<Option<Value<N>>>
fn get_value_speculative( &self, program_id: ProgramID<N>, mapping_name: Identifier<N>, key: &Plaintext<N>, ) -> Result<Option<Value<N>>>
Returns the speculative value for the given program ID
, mapping name
, and key
.
Sourcefn insert_key_value(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: Plaintext<N>,
value: Value<N>,
) -> Result<FinalizeOperation<N>>
fn insert_key_value( &self, program_id: ProgramID<N>, mapping_name: Identifier<N>, key: Plaintext<N>, value: Value<N>, ) -> Result<FinalizeOperation<N>>
Stores the given (key, value)
pair at the given program ID
and mapping name
in storage.
If the mapping name
is not initialized, an error is returned.
If the key
already exists, the method returns an error.
Sourcefn update_key_value(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: Plaintext<N>,
value: Value<N>,
) -> Result<FinalizeOperation<N>>
fn update_key_value( &self, program_id: ProgramID<N>, mapping_name: Identifier<N>, key: Plaintext<N>, value: Value<N>, ) -> Result<FinalizeOperation<N>>
Stores the given (key, value)
pair at the given program ID
and mapping name
in storage.
If the mapping name
is not initialized, an error is returned.
If the key
does not exist, the (key, value)
pair is initialized.
If the key
already exists, the value
is overwritten.
Sourcefn remove_key_value(
&self,
program_id: ProgramID<N>,
mapping_name: Identifier<N>,
key: &Plaintext<N>,
) -> Result<Option<FinalizeOperation<N>>>
fn remove_key_value( &self, program_id: ProgramID<N>, mapping_name: Identifier<N>, key: &Plaintext<N>, ) -> Result<Option<FinalizeOperation<N>>>
Removes the key-value pair for the given program ID
, mapping name
, and key
from storage.
If the key
does not exist, the method returns None
.