pub struct ComponentId {
pub uuid: Uuid,
pub namespace: String,
pub name: String,
}Expand description
Identifier for a Component in the ORCS architecture.
A Component is a functional domain boundary that communicates via the EventBus. Examples include:
builtin::llm- LLM integration (chat, complete, embed)builtin::tool- Tool execution (read, write, bash)builtin::hil- Human-in-the-loop (approve, reject)plugin::my-tool- User-defined extensions
§UUID Strategy
- Builtin components: Use UUID v5 (deterministic from name)
- Custom components: Use UUID v4 (random)
This ensures builtin components have consistent UUIDs across processes and machines, enabling reliable routing and comparison.
§Equality Semantics
PartialEq compares all fields including UUID. For FQN-only
comparison (ignoring UUID), use fqn_eq.
§Example
use orcs_types::ComponentId;
// Builtin: deterministic UUID
let llm1 = ComponentId::builtin("llm");
let llm2 = ComponentId::builtin("llm");
assert_eq!(llm1, llm2); // Same UUID, same component
// Custom: random UUID per instance
let p1 = ComponentId::new("plugin", "tool");
let p2 = ComponentId::new("plugin", "tool");
assert_ne!(p1, p2); // Different UUIDs
assert!(p1.fqn_eq(&p2)); // But same FQNFields§
§uuid: UuidGlobally unique identifier.
namespace: StringNamespace (e.g., “builtin”, “plugin”, “wasm”).
name: StringComponent name within namespace.
Implementations§
Source§impl ComponentId
impl ComponentId
Sourcepub fn new(namespace: impl Into<String>, name: impl Into<String>) -> ComponentId
pub fn new(namespace: impl Into<String>, name: impl Into<String>) -> ComponentId
Creates a new ComponentId with a random UUID v4.
Use this for custom/plugin components where each instance should have a unique identity.
§Example
use orcs_types::ComponentId;
let plugin = ComponentId::new("plugin", "my-tool");
assert_eq!(plugin.namespace, "plugin");
assert_eq!(plugin.name, "my-tool");
assert_eq!(plugin.fqn(), "plugin::my-tool");Sourcepub fn builtin(name: impl Into<String>) -> ComponentId
pub fn builtin(name: impl Into<String>) -> ComponentId
Creates a builtin component ID with a deterministic UUID v5.
The UUID is derived from the ORCS namespace UUID and the component name using SHA-1. This ensures:
- Same name always produces same UUID
- Different names produce different UUIDs
- UUIDs are consistent across processes/machines
§Example
use orcs_types::ComponentId;
let llm1 = ComponentId::builtin("llm");
let llm2 = ComponentId::builtin("llm");
let tool = ComponentId::builtin("tool");
assert_eq!(llm1.uuid, llm2.uuid); // Same name = same UUID
assert_ne!(llm1.uuid, tool.uuid); // Different name = different UUID
assert!(llm1.is_builtin());Sourcepub fn fqn(&self) -> String
pub fn fqn(&self) -> String
Returns the fully qualified name in namespace::name format.
§Example
use orcs_types::ComponentId;
let id = ComponentId::builtin("llm");
assert_eq!(id.fqn(), "builtin::llm");Sourcepub fn fqn_eq(&self, other: &ComponentId) -> bool
pub fn fqn_eq(&self, other: &ComponentId) -> bool
Compares two ComponentIds by FQN only, ignoring UUID.
This is useful when you want to check if two components represent the same logical component, even if they were created as separate instances.
§Example
use orcs_types::ComponentId;
let p1 = ComponentId::new("plugin", "tool");
let p2 = ComponentId::new("plugin", "tool");
assert_ne!(p1, p2); // Different UUIDs
assert!(p1.fqn_eq(&p2)); // Same FQNSourcepub fn matches(&self, namespace: &str, name: &str) -> bool
pub fn matches(&self, namespace: &str, name: &str) -> bool
Checks if this component matches the given namespace and name.
§Example
use orcs_types::ComponentId;
let llm = ComponentId::builtin("llm");
assert!(llm.matches("builtin", "llm"));
assert!(!llm.matches("builtin", "tool"));Sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
Returns true if this is a builtin component.
§Example
use orcs_types::ComponentId;
let builtin = ComponentId::builtin("llm");
let plugin = ComponentId::new("plugin", "tool");
assert!(builtin.is_builtin());
assert!(!plugin.is_builtin());Sourcepub fn child(name: impl Into<String>) -> ComponentId
pub fn child(name: impl Into<String>) -> ComponentId
Creates a child component ID with a deterministic UUID v5.
The UUID is derived from the ORCS namespace UUID and the child name using SHA-1.
§Example
use orcs_types::ComponentId;
let child = ComponentId::child("worker-1");
assert_eq!(child.namespace, "child");
assert_eq!(child.name, "worker-1");Trait Implementations§
Source§impl Clone for ComponentId
impl Clone for ComponentId
Source§fn clone(&self) -> ComponentId
fn clone(&self) -> ComponentId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComponentId
impl Debug for ComponentId
Source§impl<'de> Deserialize<'de> for ComponentId
impl<'de> Deserialize<'de> for ComponentId
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ComponentId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ComponentId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for ComponentId
impl Display for ComponentId
impl Eq for ComponentId
Source§impl Hash for ComponentId
impl Hash for ComponentId
Source§impl PartialEq for ComponentId
impl PartialEq for ComponentId
Source§impl Serialize for ComponentId
impl Serialize for ComponentId
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 ComponentId
Auto Trait Implementations§
impl Freeze for ComponentId
impl RefUnwindSafe for ComponentId
impl Send for ComponentId
impl Sync for ComponentId
impl Unpin for ComponentId
impl UnsafeUnpin for ComponentId
impl UnwindSafe for ComponentId
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§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<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 moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.