11use std:: sync:: Arc ;
22
3- use anyhow:: { Context , Result } ;
3+ use anyhow:: Result ;
44use graph:: prelude:: {
55 BlockPtr , DeploymentHash , NodeId , SubgraphRegistrarError , SubgraphStore as SubgraphStoreTrait ,
66} ;
@@ -12,11 +12,6 @@ use graph::{
1212} ;
1313use graph_store_postgres:: SubgraphStore ;
1414
15- pub struct DevModeContext {
16- pub watch : bool ,
17- pub updates_rx : Receiver < ( DeploymentHash , SubgraphName ) > ,
18- }
19- 2015/// Cleanup a subgraph
2116/// This is used to remove a subgraph before redeploying it when using the watch flag
2217fn cleanup_dev_subgraph (
@@ -62,7 +57,7 @@ async fn deploy_subgraph(
6257 } )
6358}
6459
65- pub async fn drop_and_recreate_subgraph (
60+ async fn drop_and_recreate_subgraph (
6661 logger : & Logger ,
6762 subgraph_store : Arc < SubgraphStore > ,
6863 subgraph_registrar : Arc < impl SubgraphRegistrar > ,
@@ -124,37 +119,3 @@ pub async fn watch_subgraph_updates(
124119 error ! ( logger, "Subgraph watcher terminated unexpectedly" ; "action" => "exiting" ) ;
125120 std:: process:: exit ( 1 ) ;
126121}
127- 128- /// Parse an alias string into a tuple of (alias_name, manifest, Option<build_dir>)
129- pub fn parse_alias ( alias : & str ) -> anyhow:: Result < ( String , String , Option < String > ) > {
130- let mut split = alias. split ( ':' ) ;
131- let alias_name = split. next ( ) ;
132- let alias_value = split. next ( ) ;
133- 134- if alias_name. is_none ( ) || alias_value. is_none ( ) || split. next ( ) . is_some ( ) {
135- return Err ( anyhow:: anyhow!(
136- "Invalid alias format: expected 'alias=[BUILD_DIR:]manifest', got '{}'" ,
137- alias
138- ) ) ;
139- }
140- 141- let alias_name = alias_name. unwrap ( ) . to_owned ( ) ;
142- let ( manifest, build_dir) = parse_manifest_arg ( alias_value. unwrap ( ) )
143- . with_context ( || format ! ( "While parsing alias '{}'" , alias) ) ?;
144- 145- Ok ( ( alias_name, manifest, build_dir) )
146- }
147- 148- /// Parse a manifest string into a tuple of (manifest, Option<build_dir>)
149- pub fn parse_manifest_arg ( value : & str ) -> anyhow:: Result < ( String , Option < String > ) > {
150- match value. split_once ( ':' ) {
151- Some ( ( manifest, build_dir) ) if !manifest. is_empty ( ) => {
152- Ok ( ( manifest. to_owned ( ) , Some ( build_dir. to_owned ( ) ) ) )
153- }
154- Some ( _) => Err ( anyhow:: anyhow!(
155- "Invalid manifest arg: missing manifest in '{}'" ,
156- value
157- ) ) ,
158- None => Ok ( ( value. to_owned ( ) , None ) ) ,
159- }
160- }
0 commit comments