pub trait ChainState:
DeserializeOwned
+ Serialize
+ Clone
+ Debug
+ Sync
+ Send
+ 'static {
// Required method
fn table_name() -> &'static str;
// Provided methods
fn create<'a, 'b, 'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn read_one<'a, 'life0, 'life1, 'async_trait, C>(
filters: &'life0 Filters,
context: &'life1 C,
) -> Pin<Box<dyn Future<Output = Option<Self>> + Send + 'async_trait>>
where C: 'async_trait + HandlerContext<'a>,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn read_many<'a, 'life0, 'life1, 'async_trait, C>(
filters: &'life0 Filters,
context: &'life1 C,
) -> Pin<Box<dyn Future<Output = Vec<Self>> + Send + 'async_trait>>
where C: 'async_trait + HandlerContext<'a>,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn update<'a, 'b, 'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
updates: &'life1 Updates,
context: &'life2 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn delete<'a, 'b, 'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn to_view(&self) -> HashMap<String, String> { ... }
fn to_complete_view<'a, 'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
table_name: &'life1 str,
client: &'life2 ChaindexingRepoTxnClient<'a>,
event: &'life3 Event,
) -> Pin<Box<dyn Future<Output = HashMap<String, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Expand description
States derived from different contracts within a chain
Required Methods§
Sourcefn table_name() -> &'static str
fn table_name() -> &'static str
Table of the state as specified in StateMigrations
Provided Methods§
Sourcefn create<'a, 'b, 'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'a, 'b, 'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Inserts state in the state’s table
Sourcefn read_one<'a, 'life0, 'life1, 'async_trait, C>(
filters: &'life0 Filters,
context: &'life1 C,
) -> Pin<Box<dyn Future<Output = Option<Self>> + Send + 'async_trait>>where
C: 'async_trait + HandlerContext<'a>,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_one<'a, 'life0, 'life1, 'async_trait, C>(
filters: &'life0 Filters,
context: &'life1 C,
) -> Pin<Box<dyn Future<Output = Option<Self>> + Send + 'async_trait>>where
C: 'async_trait + HandlerContext<'a>,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns a single state matching filters. Panics if there are multiple.
Sourcefn read_many<'a, 'life0, 'life1, 'async_trait, C>(
filters: &'life0 Filters,
context: &'life1 C,
) -> Pin<Box<dyn Future<Output = Vec<Self>> + Send + 'async_trait>>where
C: 'async_trait + HandlerContext<'a>,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_many<'a, 'life0, 'life1, 'async_trait, C>(
filters: &'life0 Filters,
context: &'life1 C,
) -> Pin<Box<dyn Future<Output = Vec<Self>> + Send + 'async_trait>>where
C: 'async_trait + HandlerContext<'a>,
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns states matching filters
Sourcefn update<'a, 'b, 'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
updates: &'life1 Updates,
context: &'life2 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update<'a, 'b, 'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
updates: &'life1 Updates,
context: &'life2 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Updates state with the specified updates
Sourcefn delete<'a, 'b, 'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'a, 'b, 'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 PureHandlerContext<'a, 'b>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'b: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes state from the state’s table
fn to_view(&self) -> HashMap<String, String>
fn to_complete_view<'a, 'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
table_name: &'life1 str,
client: &'life2 ChaindexingRepoTxnClient<'a>,
event: &'life3 Event,
) -> Pin<Box<dyn Future<Output = HashMap<String, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
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.