diff --git a/src/auth.rs b/src/auth.rs index f84a4346..4ded2211 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -28,7 +28,7 @@ impl AuthSettings { /// Check if any of the deployment's subgraphs is authorized. /// /// If the set of authorized subgraphs is empty, then any deployment is authorized (including - /// orphaned deployments with no parent subgraphs). + /// unpublished deployments with no parent subgraphs). pub fn is_any_deployment_subgraph_authorized(&self, subgraphs: &[SubgraphId]) -> bool { self.authorized_subgraphs.is_empty() || subgraphs diff --git a/src/network/pre_processing.rs b/src/network/pre_processing.rs index b019a54a..17777288 100644 --- a/src/network/pre_processing.rs +++ b/src/network/pre_processing.rs @@ -184,11 +184,11 @@ fn try_into_indexer_raw_info( }) } -/// Convert orphaned deployments (not linked to any active subgraph) into internal representation. +/// Convert unpublished deployments (not linked to any active subgraph) into internal representation. /// -/// Orphaned deployments have `activeSubgraphCount: 0`. This function filters out deployments +/// Unpublished deployments have `activeSubgraphCount: 0`. This function filters out deployments /// without a valid manifest or without active allocations. -pub fn into_orphaned_deployments_raw_info( +pub fn into_unpublished_deployments_raw_info( data: impl Iterator, ) -> HashMap { data.filter_map(|deployment| { @@ -215,7 +215,7 @@ pub fn into_orphaned_deployments_raw_info( id: deployment.id, manifest_network: network.clone(), manifest_start_block: manifest.start_block, - subgraphs: Default::default(), // Empty - orphaned + subgraphs: Default::default(), // Empty - unpublished allocations, }, )) @@ -223,8 +223,8 @@ pub fn into_orphaned_deployments_raw_info( .collect() } -/// Extract indexer information from orphaned deployments. -pub fn into_indexers_raw_info_from_orphaned_deployments<'a>( +/// Extract indexer information from unpublished deployments. +pub fn into_indexers_raw_info_from_unpublished_deployments<'a>( data: impl Iterator, ) -> HashMap { let mut indexers = HashMap::new(); diff --git a/src/network/service.rs b/src/network/service.rs index de165668..e7adef52 100644 --- a/src/network/service.rs +++ b/src/network/service.rs @@ -250,9 +250,9 @@ fn spawn_updater_task( /// Fetch the subgraphs information from the graph network subgraph and performs pre-processing /// steps, i.e., validation and conversion into the internal representation. /// -/// 1. Fetch the subgraphs and orphaned deployments from the graph network subgraph. +/// 1. Fetch the subgraphs and unpublished deployments from the graph network subgraph. /// 2. Validate and convert the fetched info into the internal representation. -/// 3. Merge orphaned deployments into the deployments map. +/// 3. Merge unpublished deployments into the deployments map. /// /// If the fetch fails or the response is empty, an error is returned. /// @@ -260,7 +260,7 @@ fn spawn_updater_task( pub async fn fetch_and_preprocess_subgraph_info( client: &mut SubgraphClient, ) -> anyhow::Result { - // Fetch the subgraphs and orphaned deployments from the graph network subgraph + // Fetch the subgraphs and unpublished deployments from the graph network subgraph let data = client.fetch().await?; anyhow::ensure!(!data.subgraphs.is_empty(), "empty subgraph response"); @@ -269,18 +269,19 @@ pub async fn fetch_and_preprocess_subgraph_info( let subgraphs = pre_processing::into_internal_subgraphs_raw_info(data.subgraphs.into_iter()); let mut deployments = pre_processing::into_internal_deployments_raw_info(subgraphs.values()); - // Pre-process orphaned deployments and merge them - let orphaned_indexers = pre_processing::into_indexers_raw_info_from_orphaned_deployments( - data.orphaned_deployments.iter(), + // Pre-process unpublished deployments and merge them + let unpublished_indexers = pre_processing::into_indexers_raw_info_from_unpublished_deployments( + data.unpublished_deployments.iter(), + ); + let unpublished_deployments = pre_processing::into_unpublished_deployments_raw_info( + data.unpublished_deployments.into_iter(), ); - let orphaned_deployments = - pre_processing::into_orphaned_deployments_raw_info(data.orphaned_deployments.into_iter()); - for (id, indexer) in orphaned_indexers { + for (id, indexer) in unpublished_indexers { indexers.entry(id).or_insert(indexer); } - for (id, deployment) in orphaned_deployments { + for (id, deployment) in unpublished_deployments { deployments.entry(id).or_insert(deployment); } diff --git a/src/network/subgraph_client.rs b/src/network/subgraph_client.rs index fae83850..bb879c69 100644 --- a/src/network/subgraph_client.rs +++ b/src/network/subgraph_client.rs @@ -132,12 +132,12 @@ pub struct Client { pub struct FetchResult { /// Active subgraphs with their versions and deployments. pub subgraphs: Vec, - /// Orphaned deployments (not linked to any active subgraph but with active allocations). - pub orphaned_deployments: Vec, + /// Unpublished deployments (not linked to any active subgraph but with active allocations). + pub unpublished_deployments: Vec, } impl Client { - /// Fetch the list of subgraphs and orphaned deployments from the network subgraph. + /// Fetch the list of subgraphs and unpublished deployments from the network subgraph. pub async fn fetch(&mut self) -> anyhow::Result { for indexer in &self.indexers.clone() { match self.fetch_from_indexer(indexer).await { @@ -159,7 +159,7 @@ impl Client { ) -> anyhow::Result { // ref: 9936786a-e286-45f3-9190-8409d8389e88 let query = r#" - query ($block: Block_height!, $first: Int!, $last: String!, $lastOrphaned: String!) { + query ($block: Block_height!, $first: Int!, $last: String!, $lastUnpublished: String!) { meta: _meta(block: $block) { block { number hash timestamp } } results: subgraphs( block: $block @@ -197,12 +197,12 @@ impl Client { } } } - orphanedDeployments: subgraphDeployments( + unpublishedDeployments: subgraphDeployments( block: $block orderBy: id, orderDirection: asc first: $first where: { - id_gt: $lastOrphaned + id_gt: $lastUnpublished activeSubgraphCount: 0 } ) { @@ -238,7 +238,7 @@ impl Client { pub struct QueryData { meta: Meta, results: Vec, - orphaned_deployments: Vec, + unpublished_deployments: Vec, } #[derive(Debug, Deserialize)] pub struct Meta { @@ -254,13 +254,13 @@ impl Client { debug_assert!(self.page_size > 0); let mut query_block: Option = None; let mut last_id: Option = None; - let mut last_orphaned_id: Option = None; + let mut last_unpublished_id: Option = None; let mut subgraphs_done = false; - let mut orphaned_done = false; + let mut unpublished_done = false; let mut results: Vec = Default::default(); - let mut orphaned_results: Vec = Default::default(); + let mut unpublished_results: Vec = Default::default(); - // Pagination uses independent cursors for subgraphs and orphaned deployments. Both + // Pagination uses independent cursors for subgraphs and unpublished deployments. Both // subqueries are included in every request, even after one completes. When one finishes, // its cursor remains at the final value causing subsequent queries to return empty results // for that subquery. This avoids the complexity of dynamically constructing the query string @@ -278,7 +278,7 @@ impl Client { "block": block_height, "first": self.page_size, "last": last_id.clone().unwrap_or_default(), - "lastOrphaned": last_orphaned_id.clone().unwrap_or_default(), + "lastUnpublished": last_unpublished_id.clone().unwrap_or_default(), }, }); let response = self @@ -334,18 +334,18 @@ impl Client { results.append(&mut data.results); } - if !orphaned_done { - last_orphaned_id = data - .orphaned_deployments + if !unpublished_done { + last_unpublished_id = data + .unpublished_deployments .last() .map(|entry| entry.id.to_string()); - if data.orphaned_deployments.len() < self.page_size { - orphaned_done = true; + if data.unpublished_deployments.len() < self.page_size { + unpublished_done = true; } - orphaned_results.append(&mut data.orphaned_deployments); + unpublished_results.append(&mut data.unpublished_deployments); } - if subgraphs_done && orphaned_done { + if subgraphs_done && unpublished_done { break; } } @@ -354,7 +354,7 @@ impl Client { Ok(FetchResult { subgraphs: results, - orphaned_deployments: orphaned_results, + unpublished_deployments: unpublished_results, }) } }