pub trait HandlerContext: Send {
// Required methods
fn load_entity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entity_type: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<Entity>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn save_entity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entity_type: &'life1 str,
entity: &'life2 Entity,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn entity_remove(
&mut self,
entity_type: &str,
id: &str,
) -> Result<(), Error>;
fn data_source_network(&self) -> String;
fn data_source_context(&self) -> DataSourceContext;
fn data_source_string_param(&self) -> String;
fn data_source_create(
&mut self,
template: &str,
params: &[String],
) -> Result<(), Error>;
fn data_source_create_with_context(
&mut self,
template: &str,
params: &[String],
context: DataSourceContext,
) -> Result<(), Error>;
}Required Methods§
fn load_entity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entity_type: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<Entity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_entity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
entity_type: &'life1 str,
entity: &'life2 Entity,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn entity_remove(&mut self, entity_type: &str, id: &str) -> Result<(), Error>
Sourcefn data_source_network(&self) -> String
fn data_source_network(&self) -> String
Returns the current data source’s network name.
Sourcefn data_source_context(&self) -> DataSourceContext
fn data_source_context(&self) -> DataSourceContext
Returns the current data source’s context (set via createWithContext). Returns an empty context if none was provided.
Sourcefn data_source_string_param(&self) -> String
fn data_source_string_param(&self) -> String
Mirrors graph-ts dataSource.stringParam().
Returns the UTF-8 string interpretation of the datasource address/source bytes.
For file/offchain datasources, this is the source identifier (e.g., content hash).
For onchain templates, the result depends on how graph-node populates
dataSource.address() — typically the hex-decoded contract address bytes
interpreted as UTF-8, which may not produce a meaningful string.
Sourcefn data_source_create(
&mut self,
template: &str,
params: &[String],
) -> Result<(), Error>
fn data_source_create( &mut self, template: &str, params: &[String], ) -> Result<(), Error>
Create a dynamic data source from a template.
params are template-specific: for onchain templates, typically [address_hex].
Sourcefn data_source_create_with_context(
&mut self,
template: &str,
params: &[String],
context: DataSourceContext,
) -> Result<(), Error>
fn data_source_create_with_context( &mut self, template: &str, params: &[String], context: DataSourceContext, ) -> Result<(), Error>
Create a dynamic data source from a template with context.
params are template-specific: for onchain templates, typically [address_hex].