@@ -60,7 +60,7 @@ pub struct BlueprintPlanner {
6060 rx_config : Receiver < ReconfiguratorConfigLoaderState > ,
6161 rx_inventory : Receiver < Option < Arc < Collection > > > ,
6262 rx_blueprint : Receiver < Option < LoadedTargetBlueprint > > ,
63- tx_blueprint : Sender < Option < LoadedTargetBlueprint > > ,
63+ tx_planned : Sender < Option < BlueprintUuid > > ,
6464 blueprint_limit : u64 ,
6565}
6666
@@ -87,19 +87,35 @@ impl BlueprintPlanner {
8787 rx_inventory : Receiver < Option < Arc < Collection > > > ,
8888 rx_blueprint : Receiver < Option < LoadedTargetBlueprint > > ,
8989 ) -> Self {
90- let ( tx_blueprint , _) = watch:: channel ( None ) ;
90+ let ( tx_planned , _) = watch:: channel ( None ) ;
9191 Self {
9292 datastore,
9393 rx_config,
9494 rx_inventory,
9595 rx_blueprint,
96- tx_blueprint ,
96+ tx_planned ,
9797 blueprint_limit : DEFAULT_BLUEPRINT_LIMIT ,
9898 }
9999 }
100100
101- pub fn watcher ( & self ) -> watch:: Receiver < Option < LoadedTargetBlueprint > > {
102- self . tx_blueprint . subscribe ( )
101+ /// Receiving end of a watch channel that holds the most recent blueprint
102+ /// created and set as the current target by this `BlueprintPlanner`.
103+ ///
104+ /// This exact contents of this channel are unlikely to be useful. If you
105+ /// want the current target blueprint, you should use the channel exposed by
106+ /// the `blueprint_loader` task instead. This channel will often be `None`
107+ /// for an extended period of time after Nexus startup (e.g., any time Nexus
108+ /// starts up and there are no planning changes to be made), and even if
109+ /// it's `Some(blueprint_id)`, the stored ID is the last blueprint planned
110+ /// _by this `BlueprintPlanner`_; the current target blueprint may have
111+ /// already been set to something else by other sources (e.g., the
112+ /// `BlueprintPlanner` tasks on other Nexus instances).
113+ ///
114+ /// The primary use of this channel is to be notified when the planner has
115+ /// created a new target blueprint, at which point a concerned party should
116+ /// load the current target.
117+ pub fn watcher ( & self ) -> watch:: Receiver < Option < BlueprintUuid > > {
118+ self . tx_planned . subscribe ( )
103119 }
104120
105121 /// Run a planning iteration to generate a new blueprint.
@@ -312,10 +328,7 @@ impl BlueprintPlanner {
312328
313329 // We have a new target!
314330
315- self . tx_blueprint . send_replace ( Some ( LoadedTargetBlueprint {
316- target,
317- blueprint : Arc :: new ( blueprint) ,
318- } ) ) ;
331+ self . tx_planned . send_replace ( Some ( blueprint. id ) ) ;
319332 Ok ( BlueprintPlannerStatus :: Targeted {
320333 parent_blueprint_id,
321334 blueprint_id,
0 commit comments