pub struct Node { /* private fields */ }Expand description
Represents a single server instance (node) in the Product OS cluster.
Each node has a unique identifier, machine ID, URI, and tracks its own capabilities, services, features, and failure count.
Implementations§
Source§impl Node
impl Node
Sourcepub fn new(config: &CommandControl, certificates: Certificates) -> Self
pub fn new(config: &CommandControl, certificates: Certificates) -> Self
Creates a new Node instance with the given configuration and certificates.
Generates a unique UUID, retrieves the machine ID, and initialises the node with the configured URL address.
§Panics
Panics if the machine UID cannot be retrieved or if the configured URL address is not a valid URI.
Sourcepub fn default(config: &CommandControl, certificates: Certificates) -> Self
👎Deprecated since 0.0.28: Renamed to Node::new() to follow Rust conventions
pub fn default(config: &CommandControl, certificates: Certificates) -> Self
Renamed to Node::new() to follow Rust conventions
Creates a new Node instance with the given configuration and certificates.
Sourcepub fn get_identifier(&self) -> String
pub fn get_identifier(&self) -> String
Returns the unique identifier for this node as a string.
Sourcepub fn get_protocol(&self) -> String
👎Deprecated since 0.0.28: Use try_get_protocol() to avoid potential panics
pub fn get_protocol(&self) -> String
Use try_get_protocol() to avoid potential panics
Returns the URI protocol scheme (e.g., “https”) for this node.
Returns an empty string if the URI has no scheme.
Sourcepub fn try_get_protocol(&self) -> Option<String>
pub fn try_get_protocol(&self) -> Option<String>
Returns the URI protocol scheme (e.g., “https”) for this node, or None if the URI is invalid.
Sourcepub fn get_address(&self) -> Uri
👎Deprecated since 0.0.28: Use try_get_address() to avoid potential panics
pub fn get_address(&self) -> Uri
Use try_get_address() to avoid potential panics
Returns the parsed URI address for this node.
§Panics
Panics if the stored URI string is not valid. This should not happen
if the node was constructed via Node::new().
Sourcepub fn try_get_address(&self) -> Option<Uri>
pub fn try_get_address(&self) -> Option<Uri>
Returns the parsed URI address for this node, or None if the URI is invalid.
Sourcepub fn get_process_id(&self) -> u32
pub fn get_process_id(&self) -> u32
Returns the OS process ID of this node.
Sourcepub fn get_certificate(&self) -> Vec<u8> ⓘ
pub fn get_certificate(&self) -> Vec<u8> ⓘ
Returns a copy of the certificate bytes for this node.
Sourcepub fn get_failures(&self) -> u8
pub fn get_failures(&self) -> u8
Returns the current failure count for this node.
Sourcepub fn get_features(&self) -> &Features
pub fn get_features(&self) -> &Features
Returns a reference to this node’s registered features.
Sourcepub fn get_services(&self) -> &Services
pub fn get_services(&self) -> &Services
Returns a reference to this node’s registered services.
Sourcepub fn match_node(&self, selector: &str, search_value: &str) -> bool
pub fn match_node(&self, selector: &str, search_value: &str) -> bool
Tests whether this node matches a single selector/value pair.
Supported selectors:
"feature"- checks if the node has the named feature"capability"- checks if the node has the named capability (empty capabilities match nothing)"service.kind"- checks if the node has a service of the given kind"service.enabled"- checks if all services match the enabled state"service.active"- checks if all services match the active state
Sourcepub fn match_node_query(&self, query: &BTreeMap<&str, &str>) -> bool
pub fn match_node_query(&self, query: &BTreeMap<&str, &str>) -> bool
Tests whether this node matches all selector/value pairs in the query.
Returns true only if every entry in the query matches.
An empty query always matches.
Sourcepub fn get_created_at(&self) -> DateTime<Utc>
pub fn get_created_at(&self) -> DateTime<Utc>
Returns the timestamp when this node was created.
Sourcepub fn get_last_updated_at(&self) -> DateTime<Utc>
pub fn get_last_updated_at(&self) -> DateTime<Utc>
Returns the timestamp when this node was last updated.