cnidarium

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§