pub enum NodeRef {
Plain(String),
Keyed {
name: String,
instance_id: Option<String>,
camera_id: Option<String>,
},
}Expand description
A single entry in a target’s node list, either a plain node identifier or a named instance for a node that needs to run as more than one instance under the same target.
Variants§
Plain(String)
A node running as its default, single instance.
Keyed
A node running as one of several keyed instances of the same node type, and/or with a
camera_id override (video-streamer’s relay/diagnostics identity). LAB-4747 tracks
letting one video-streamer process stream multiple cameras at once - a separate,
not-yet-started follow-up to this field. instance_id and camera_id are deliberately
independent: instance_id is
this process’s own identity (so e.g. two video-streamer processes under the same
robot_id don’t collide in the dashboard’s node registry), while camera_id is purely
which camera this video-streamer reports to the relay - the two never need to match,
and either can be set without the other.
Fields
instance_id: Option<String>Which instance of name this is (e.g. real or sim). Optional - a keyed entry
may exist purely to set camera_id with no need for a distinct process identity.
camera_id: Option<String>video-streamer-specific: which camera this process reports to the relay/dashboard
(sets MECHA10_CAMERA_ID on the spawned process’s environment - see
VideoStreamerNode::init()/run() in mecha10-nodes). Threaded directly through
mecha10.json rather than the node’s own configs/config.json so it never depends
on mecha10-api’s node-catalog schema being in sync with the node’s actual struct.
Implementations§
Source§impl NodeRef
impl NodeRef
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The node identifier (e.g. "@mecha10/camera"), regardless of entry shape.
Sourcepub fn instance_id(&self) -> Option<&str>
pub fn instance_id(&self) -> Option<&str>
The instance id, if this entry names a specific keyed instance.
Sourcepub fn camera_id(&self) -> Option<&str>
pub fn camera_id(&self) -> Option<&str>
The camera_id override, if this entry sets one. See the Keyed variant’s doc comment -
independent of instance_id.
Sourcepub fn wire_identifier(&self) -> String
pub fn wire_identifier(&self) -> String
The plain-string identifier this entry round-trips to wherever the CLI’s node-spawning
pipeline (mecha10 dev’s CliLifecycleManager/spawn_nodes_by_name, all the way down
to ProcessService::spawn_node_runner/spawn_node_direct) still deals in bare
Vec<String> node identifiers, rather than threading NodeRef itself through every
layer. A plain entry’s identifier is just its name, unchanged; a keyed entry’s instance
id is encoded as a "::" -suffixed segment, and a camera_id as a trailing "#"
-suffixed segment ("name::instance_id#camera_id", "name#camera_id" when
instance_id is absent) - neither "::" nor "#" can appear in a node identifier
(see the name/package patterns in schemas/mecha10.schema.json, limited to
[a-z0-9_/-]), so both are unambiguous to split back out (rsplit_once('#') first, then
split_once("::") on what’s left) at the call sites that need them separately (to pass
node-runner --instance-id/--camera-id and set NODE_INSTANCE_ID/MECHA10_CAMERA_ID
on the spawned process’s environment).
Sourcepub fn process_key(&self) -> String
pub fn process_key(&self) -> String
A key that’s unique per distinct (name, instance_id) pair within a target’s nodes
list - name itself for a plain entry, "{name}/{instance_id}" for a keyed one with an
instance id, or just name for a keyed entry that only sets camera_id. Used wherever
a single string key is needed to track/identify a running node process (e.g. the CLI’s
running-node registry, mode-diffing), mirroring the node_id shape the running process
itself reports (Context::with_instance).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NodeRef
impl<'de> Deserialize<'de> for NodeRef
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NodeRef, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NodeRef, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for NodeRef
Source§impl JsonSchema for NodeRef
impl JsonSchema for NodeRef
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Serialize for NodeRef
impl Serialize for NodeRef
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for NodeRef
Auto Trait Implementations§
impl Freeze for NodeRef
impl RefUnwindSafe for NodeRef
impl Send for NodeRef
impl Sync for NodeRef
impl Unpin for NodeRef
impl UnsafeUnpin for NodeRef
impl UnwindSafe for NodeRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more