@@ -277,7 +277,6 @@ fn extract_location_id(metadata: &crate::ir::HydroIrMetadata) -> (Option<usize>,
277277 match & metadata. location_kind {
278278 LocationId :: Process ( id) => ( Some ( * id) , Some ( "Process" . to_string ( ) ) ) ,
279279 LocationId :: Cluster ( id) => ( Some ( * id) , Some ( "Cluster" . to_string ( ) ) ) ,
280- LocationId :: External ( id) => ( Some ( * id) , Some ( "External" . to_string ( ) ) ) ,
281280 LocationId :: Tick ( _, inner) => match inner. as_ref ( ) {
282281 LocationId :: Process ( id) => ( Some ( * id) , Some ( "Process" . to_string ( ) ) ) ,
283282 LocationId :: Cluster ( id) => ( Some ( * id) , Some ( "Cluster" . to_string ( ) ) ) ,
@@ -384,12 +383,12 @@ impl HydroLeaf {
384383 seen_tees : & mut HashMap < * const std:: cell:: RefCell < HydroNode > , usize > ,
385384 config : & HydroWriteConfig ,
386385 input : & HydroNode ,
387- metadata : & crate :: ir:: HydroIrMetadata ,
386+ metadata : Option < & crate :: ir:: HydroIrMetadata > ,
388387 label : NodeLabel ,
389388 edge_type : HydroEdgeType ,
390389 ) -> usize {
391390 let input_id = input. build_graph_structure ( structure, seen_tees, config) ;
392- let location_id = setup_location ( structure, metadata ) ;
391+ let location_id = metadata . and_then ( |m| setup_location ( structure, m ) ) ;
393392 let sink_id = structure. add_node ( label, HydroNodeType :: Sink , location_id) ;
394393 structure. add_edge ( input_id, sink_id, edge_type, None ) ;
395394 sink_id
@@ -402,14 +401,28 @@ impl HydroLeaf {
402401 seen_tees,
403402 config,
404403 input,
405- metadata,
404+ Some ( metadata) ,
406405 NodeLabel :: with_exprs ( "for_each" . to_string ( ) , vec ! [ f. clone( ) ] ) ,
407406 HydroEdgeType :: Stream ,
408407 ) ,
409408
410- HydroLeaf :: SendExternal { input, .. } => {
411- input. build_graph_structure ( structure, seen_tees, config)
412- }
409+ HydroLeaf :: SendExternal {
410+ to_external_id,
411+ to_key,
412+ input,
413+ ..
414+ } => build_sink_node (
415+ structure,
416+ seen_tees,
417+ config,
418+ input,
419+ None ,
420+ NodeLabel :: with_exprs (
421+ format ! ( "send_external({}:{})" , to_external_id, to_key) ,
422+ vec ! [ ] ,
423+ ) ,
424+ HydroEdgeType :: Stream ,
425+ ) ,
413426
414427 HydroLeaf :: DestSink {
415428 sink,
@@ -420,7 +433,7 @@ impl HydroLeaf {
420433 seen_tees,
421434 config,
422435 input,
423- metadata,
436+ Some ( metadata) ,
424437 NodeLabel :: with_exprs ( "dest_sink" . to_string ( ) , vec ! [ sink. clone( ) ] ) ,
425438 HydroEdgeType :: Stream ,
426439 ) ,
@@ -436,7 +449,7 @@ impl HydroLeaf {
436449 seen_tees,
437450 config,
438451 input,
439- metadata,
452+ Some ( metadata) ,
440453 NodeLabel :: static_label ( format ! ( "cycle_sink({})" , ident) ) ,
441454 HydroEdgeType :: Cycle ,
442455 ) ,
@@ -561,9 +574,16 @@ impl HydroNode {
561574 build_source_node ( structure, metadata, label)
562575 }
563576
564- HydroNode :: ExternalInput { metadata, .. } => {
565- build_source_node ( structure, metadata, "external_network()" . to_string ( ) )
566- }
577+ HydroNode :: ExternalInput {
578+ from_external_id,
579+ from_key,
580+ metadata,
581+ ..
582+ } => build_source_node (
583+ structure,
584+ metadata,
585+ format ! ( "external_input({}:{})" , from_external_id, from_key) ,
586+ ) ,
567587
568588 HydroNode :: CycleSource {
569589 ident, metadata, ..
@@ -818,10 +838,6 @@ impl HydroNode {
818838 structure. add_location ( * id, "Cluster" . to_string ( ) ) ;
819839 Some ( * id)
820840 }
821- LocationId :: External ( id) => {
822- structure. add_location ( * id, "External" . to_string ( ) ) ;
823- Some ( * id)
824- }
825841 _ => None ,
826842 } ;
827843
0 commit comments