Trait cnidarium::StateWrite

source ·
pub trait StateWrite: StateRead + Send + Sync {
    // Required methods
    fn put_raw(&mut self, key: String, value: Vec<u8>);
    fn delete(&mut self, key: String);
    fn nonverifiable_put_raw(&mut self, key: Vec<u8>, value: Vec<u8>);
    fn nonverifiable_delete(&mut self, key: Vec<u8>);
    fn object_put<T: Clone + Any + Send + Sync>(
        &mut self,
        key: &'static str,
        value: T,
    );
    fn object_delete(&mut self, key: &'static str);
    fn object_merge(
        &mut self,
        objects: BTreeMap<&'static str, Option<Box<dyn Any + Send + Sync>>>,
    );
    fn record(&mut self, event: Event);
}
Expand description

Write access to chain state.

Required Methods§

source

fn put_raw(&mut self, key: String, value: Vec<u8>)

Puts raw bytes into the verifiable key-value store with the given key.

source

fn delete(&mut self, key: String)

Delete a key from the verifiable key-value store.

source

fn nonverifiable_put_raw(&mut self, key: Vec<u8>, value: Vec<u8>)

Puts raw bytes into the non-verifiable key-value store with the given key.

source

fn nonverifiable_delete(&mut self, key: Vec<u8>)

Delete a key from non-verifiable key-value storage.

source

fn object_put<T: Clone + Any + Send + Sync>( &mut self, key: &'static str, value: T, )

Puts an object into the ephemeral object store with the given key.

§Panics

If the object is already present in the store, but its type is not the same as the type of value.

source

fn object_delete(&mut self, key: &'static str)

Deletes a key from the ephemeral object store.

source

fn object_merge( &mut self, objects: BTreeMap<&'static str, Option<Box<dyn Any + Send + Sync>>>, )

Merge a set of object changes into this StateWrite.

Unlike object_put, this avoids re-boxing values and messing up the downcasting.

source

fn record(&mut self, event: Event)

Record that an ABCI event occurred while building up this set of state changes.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, S: StateWrite + Send + Sync> StateWrite for &'a mut S

source§

fn put_raw(&mut self, key: String, value: OwnedValue)

source§

fn delete(&mut self, key: String)

source§

fn nonverifiable_delete(&mut self, key: Vec<u8>)

source§

fn nonverifiable_put_raw(&mut self, key: Vec<u8>, value: Vec<u8>)

source§

fn object_put<T: Clone + Any + Send + Sync>( &mut self, key: &'static str, value: T, )

source§

fn object_delete(&mut self, key: &'static str)

source§

fn object_merge( &mut self, objects: BTreeMap<&'static str, Option<Box<dyn Any + Send + Sync>>>, )

source§

fn record(&mut self, event: Event)

Implementors§