Skip to content

Commit c7ca25a

Browse files
committed
graph: Better comments
1 parent 9069486 commit c7ca25a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

core/src/subgraph/context/instance/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ pub(crate) struct SubgraphInstance<C: Blockchain, T: RuntimeHostBuilder<C>> {
2222
pub(super) static_data_sources: Arc<Vec<DataSource<C>>>,
2323
host_metrics: Arc<HostMetrics>,
2424

25-
/// The hosts represent the data sources in the subgraph. There is one host per data source.
25+
/// The hosts represent the onchain data sources in the subgraph. There is one host per data source.
2626
/// Data sources with no mappings (e.g. direct substreams) have no host.
2727
///
2828
/// Onchain hosts must be created in increasing order of block number. `fn hosts_for_trigger`
2929
/// will return the onchain hosts in the same order as they were inserted.
3030
onchain_hosts: OnchainHosts<C, T>,
3131

32-
// TODO(krishna): Describe subgraph_hosts
32+
/// `subgraph_hosts` represent subgraph data sources declared in the manifest. These are a special
33+
/// kind of data source that depends on the data from another source subgraph.
3334
subgraph_hosts: OnchainHosts<C, T>,
3435

3536
offchain_hosts: OffchainHosts<C, T>,

graph/src/blockchain/block_stream.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ impl<C: Blockchain> BlockWithTriggers<C> {
315315
}
316316
}
317317

318+
/// The `TriggersAdapterWrapper` wraps the chain-specific `TriggersAdapter`, enabling chain-agnostic
319+
/// handling of subgraph datasource triggers. Without this wrapper, we would have to duplicate the same
320+
/// logic for each chain, increasing code repetition.
318321
pub struct TriggersAdapterWrapper<C: Blockchain> {
319322
pub adapter: Arc<dyn TriggersAdapter<C>>,
320323
pub source_subgraph_stores: Vec<(DeploymentHash, Arc<dyn ReadStore>)>,

graph/src/blockchain/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ impl From<web3::Error> for IngestorError {
248248
}
249249
}
250250

251+
/// The `TriggerFilterWrapper` is a higher-level wrapper around the chain-specific `TriggerFilter`,
252+
/// enabling subgraph-based trigger filtering for subgraph datasources. This abstraction is necessary
253+
/// because subgraph filtering operates at a higher level than chain-based filtering. By using this wrapper,
254+
/// we reduce code duplication, allowing subgraph-based filtering to be implemented once, instead of
255+
/// duplicating it across different chains.
251256
#[derive(Debug)]
252257
pub struct TriggerFilterWrapper<C: Blockchain> {
253258
pub chain_filter: Arc<C::TriggerFilter>,

0 commit comments

Comments
 (0)