pub struct AgentId(/* private fields */);Expand description
An agent-id used to identify software-agents in the borderless-ecosystem.
These ids are version 8 uuids, where
the first four bits of the uuid are set to 0xa, to indicate that it is an agent-id and not another uuid based id.
Example:
afc23cb3-f447-8107-8f93-9bfb8e1d157dAll uuid-based ids used in the borderless-ecosystem have a different prefix, based on what the id is used for. This mechanism ensures that you cannot mistake an agent-id for e.g. a contract-id and vice versa. Even if you convert the agent-id back into a uuid and the result into a contract-id, the results are different.
The implementation of the IDs is compliant with RFC9562, as we utilize standard version 8 uuids.
Implementations§
Source§impl AgentId
impl AgentId
Sourcepub fn into_uuid(self) -> Uuid
pub fn into_uuid(self) -> Uuid
Converts the ID into a uuid::Uuid
pub fn from_bytes(bytes: [u8; 16]) -> AgentId
Sourcepub fn into_bytes(self) -> [u8; 16]
pub fn into_bytes(self) -> [u8; 16]
Returns the underlying bytes
Sourcepub fn merge(&self, other: &AgentId) -> [u8; 16]
pub fn merge(&self, other: &AgentId) -> [u8; 16]
Merges two IDs commutatively
Can be used to construct database keys.
Sourcepub fn merge_compact(&self, other: &AgentId) -> u64
pub fn merge_compact(&self, other: &AgentId) -> u64
Merges and Compacts two IDs into a u64
Can be used to construct database keys.