penumbra_app/
action_handler.rsuse std::sync::Arc;
use anyhow::Result;
use async_trait::async_trait;
use cnidarium::{StateRead, StateWrite};
mod actions;
mod transaction;
#[async_trait]
pub trait AppActionHandler {
type CheckStatelessContext: Clone + Send + Sync + 'static;
async fn check_stateless(&self, context: Self::CheckStatelessContext) -> Result<()>;
async fn check_historical<S: StateRead + 'static>(&self, _state: Arc<S>) -> Result<()> {
return Ok(());
}
async fn check_and_execute<S: StateWrite>(&self, state: S) -> Result<()>;
}
use cnidarium_component::ActionHandler as ComponentActionHandler;
#[async_trait]
impl<'a, T: ComponentActionHandler + Sync> AppActionHandler for crate::Compat<'a, T> {
type CheckStatelessContext = T::CheckStatelessContext;
async fn check_stateless(&self, context: Self::CheckStatelessContext) -> Result<()> {
ComponentActionHandler::check_stateless(self.0, context).await
}
async fn check_historical<S: StateRead + 'static>(&self, state: Arc<S>) -> Result<()> {
ComponentActionHandler::check_historical(self.0, state).await
}
async fn check_and_execute<S: StateWrite>(&self, state: S) -> Result<()> {
ComponentActionHandler::check_and_execute(self.0, state).await
}
}