fn handle_state_store_request<REv>(
        &mut self,
        _effect_builder: EffectBuilder<REv>,
        req: StateStoreRequest,
    ) -> Result<Effects<Event>, Error>
    where
        Self: Component<REv>,
    {
        // Incoming requests are fairly simple database write. Errors are handled one level above on
        // the call stack, so all we have to do is load or store a value.
        match req {
            StateStoreRequest::Save {
                key,
                data,
                responder,
            } => {
                let mut txn = self.env.begin_rw_txn()?;
                txn.put(self.state_store_db, &key, &data, WriteFlags::default())?;
                txn.commit()?;
                Ok(responder.respond(()).ignore())
            }
            StateStoreRequest::Load { key, responder } => {
                let bytes = self.read_state_store(&key)?;
                Ok(responder.respond(bytes).ignore())
            }
        }
    }
/// Handles a state store request.
Handles a state store request.
Handles a state store request .
fn handle_state_store_request<REv>(
        &mut self,
        _effect_builder: EffectBuilder<REv>,
        req: StateStoreRequest,
    ) -> Result<Effects<Event>, Error>
    where
        Self: Component<REv>,
    {
        // Incoming requests are fairly simple database write. Errors are handled one level above on
        // the call stack, so all we have to do is load or store a value.
        match req {
            StateStoreRequest::Save {
                key,
                data,
                responder,
            } => {
                let mut txn = self.env.begin_rw_txn()?;
                txn.put(self.state_store_db, &key, &data, WriteFlags::default())?;
                txn.commit()?;
                Ok(responder.respond(()).ignore())
            }
            StateStoreRequest::Load { key, responder } => {
                let bytes = self.read_state_store(&key)?;
                Ok(responder.respond(bytes).ignore())
            }
        }
    }
fn handle_state_store_request < REv > ( & mut self , _effect_builder : EffectBuilder < REv > , req : StateStoreRequest , ) -> Result < Effects < Event > , Error > where Self : Component < REv > , { // Incoming requests are fairly simple database write. Errors are handled one level above on // the call stack, so all we have to do is load or store a value. match req { StateStoreRequest :: Save { key , data , responder , } => { let mut txn = self . env . begin_rw_txn ( ) ? ; txn . put ( self . state_store_db , & key , & data , WriteFlags :: default ( ) ) ? ; txn . commit ( ) ? ; Ok ( responder . respond ( ( ) ) . ignore ( ) ) } StateStoreRequest :: Load { key , responder } => { let bytes = self . read_state_store ( & key ) ? ; Ok ( responder . respond ( bytes ) . ignore ( ) ) } } }
Handles a state store request.
Handles a state store request .
&mut self
_effect_builder
EffectBuilder<REv>
req
StateStoreRequest
&mut self
_effect_builder
EffectBuilder<REv>
req
StateStoreRequest