FinalizeStoreTrait

Trait FinalizeStoreTrait 

Source
pub trait FinalizeStoreTrait<N: Network> {
    // Required methods
    fn contains_mapping_confirmed(
        &self,
        program_id: &ProgramID<N>,
        mapping_name: &Identifier<N>,
    ) -> Result<bool>;
    fn contains_mapping_speculative(
        &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§

Source

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 is confirmed to exist.

Source

fn contains_mapping_speculative( &self, program_id: &ProgramID<N>, mapping_name: &Identifier<N>, ) -> Result<bool>

Returns true if the given program ID and mapping name exist. This method was added to support execution of constructors during deployment. Prior to supporting program upgrades, contains_mapping_confirmed was used to check that a mapping exists before executing a command like set, get, remove, etc. However, during deployment, the mapping only speculatively exists, so contains_mapping_speculative should be used instead. This usage is safe because the mappings used in a program are statically verified to exist in FinalizeTypes::from_* before the deployment or upgrade’s constructor is executed.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Implementors§