@@ -13,14 +13,13 @@ use graph::blockchain::block_stream::{BlockStreamMetrics, TriggersAdapterWrapper
1313use graph:: blockchain:: { Blockchain , BlockchainKind , DataSource , NodeCapabilities } ;
1414use graph:: components:: metrics:: gas:: GasMetrics ;
1515use graph:: components:: metrics:: subgraph:: DeploymentStatusMetric ;
16- use graph:: components:: store:: ReadStore ;
16+ use graph:: components:: store:: SourceableStore ;
1717use graph:: components:: subgraph:: ProofOfIndexingVersion ;
1818use graph:: data:: subgraph:: { UnresolvedSubgraphManifest , SPEC_VERSION_0_0_6 } ;
1919use graph:: data:: value:: Word ;
2020use graph:: data_source:: causality_region:: CausalityRegionSeq ;
2121use graph:: env:: EnvVars ;
2222use graph:: prelude:: { SubgraphInstanceManager as SubgraphInstanceManagerTrait , * } ;
23- use graph:: semver:: Version ;
2423use graph:: { blockchain:: BlockchainMap , components:: store:: DeploymentLocator } ;
2524use graph_runtime_wasm:: module:: ToAscPtr ;
2625use graph_runtime_wasm:: RuntimeHostBuilder ;
@@ -230,50 +229,28 @@ impl<S: SubgraphStore> SubgraphInstanceManager<S> {
230229 }
231230 }
232231
233- pub async fn hashes_to_read_store < C : Blockchain > (
232+ pub async fn get_sourceable_stores < C : Blockchain > (
234233 & self ,
235- logger : & Logger ,
236- link_resolver : & Arc < dyn LinkResolver > ,
237234 hashes : Vec < DeploymentHash > ,
238- max_spec_version : Version ,
239235 is_runner_test : bool ,
240- ) -> anyhow:: Result < Vec < ( DeploymentHash , Arc < dyn ReadStore > ) > > {
241- let mut writable_stores = Vec :: new ( ) ;
242- let subgraph_store = self . subgraph_store . clone ( ) ;
243-
236+ ) -> anyhow:: Result < Vec < Arc < dyn SourceableStore > > > {
244237 if is_runner_test {
245- return Ok ( writable_stores ) ;
238+ return Ok ( Vec :: new ( ) ) ;
246239 }
247240
248- for hash in hashes {
249- let file_bytes = link_resolver
250- . cat ( logger, & hash. to_ipfs_link ( ) )
251- . await
252- . map_err ( SubgraphAssignmentProviderError :: ResolveError ) ?;
253- let raw: serde_yaml:: Mapping = serde_yaml:: from_slice ( & file_bytes)
254- . map_err ( |e| SubgraphAssignmentProviderError :: ResolveError ( e. into ( ) ) ) ?;
255- let manifest = UnresolvedSubgraphManifest :: < C > :: parse ( hash. cheap_clone ( ) , raw) ?;
256- let manifest = manifest
257- . resolve ( & link_resolver, & logger, max_spec_version. clone ( ) )
258- . await ?;
241+ let mut sourceable_stores = Vec :: new ( ) ;
242+ let subgraph_store = self . subgraph_store . clone ( ) ;
259243
244+ for hash in hashes {
260245 let loc = subgraph_store
261246 . active_locator ( & hash) ?
262247 . ok_or_else ( || anyhow ! ( "no active deployment for hash {}" , hash) ) ?;
263248
264- let readable_store = subgraph_store
265- . clone ( )
266- . readable (
267- logger. clone ( ) ,
268- loc. id . clone ( ) ,
269- Arc :: new ( manifest. template_idx_and_name ( ) . collect ( ) ) ,
270- )
271- . await ?;
272-
273- writable_stores. push ( ( loc. hash , readable_store) ) ;
249+ let sourceable_store = subgraph_store. clone ( ) . sourceable ( loc. id . clone ( ) ) . await ?;
250+ sourceable_stores. push ( sourceable_store) ;
274251 }
275252
276- Ok ( writable_stores )
253+ Ok ( sourceable_stores )
277254 }
278255
279256 pub async fn build_subgraph_runner < C > (
@@ -539,27 +516,21 @@ impl<S: SubgraphStore> SubgraphInstanceManager<S> {
539516
540517 let decoder = Box :: new ( Decoder :: new ( decoder_hook) ) ;
541518
542- let subgraph_data_source_read_stores = self
543- . hashes_to_read_store :: < C > (
544- & logger,
545- & link_resolver,
546- subgraph_ds_source_deployments,
547- manifest. spec_version . clone ( ) ,
548- is_runner_test,
549- )
519+ let subgraph_data_source_stores = self
520+ . get_sourceable_stores :: < C > ( subgraph_ds_source_deployments, is_runner_test)
550521 . await ?;
551522
552523 let triggers_adapter = Arc :: new ( TriggersAdapterWrapper :: new (
553524 triggers_adapter,
554- subgraph_data_source_read_stores . clone ( ) ,
525+ subgraph_data_source_stores . clone ( ) ,
555526 ) ) ;
556527
557528 let inputs = IndexingInputs {
558529 deployment : deployment. clone ( ) ,
559530 features,
560531 start_blocks,
561532 end_blocks,
562- source_subgraph_stores : subgraph_data_source_read_stores ,
533+ source_subgraph_stores : subgraph_data_source_stores ,
563534 stop_block,
564535 max_end_block,
565536 store,
0 commit comments