Skip to main content

Node

Struct Node 

Source
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

Source

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.

Source

pub fn default(config: &CommandControl, certificates: Certificates) -> Self

👎Deprecated since 0.0.28:

Renamed to Node::new() to follow Rust conventions

Creates a new Node instance with the given configuration and certificates.

Source

pub fn get_identifier(&self) -> String

Returns the unique identifier for this node as a string.

Source

pub fn get_protocol(&self) -> String

👎Deprecated since 0.0.28:

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.

Source

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.

Source

pub fn get_address(&self) -> Uri

👎Deprecated since 0.0.28:

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().

Source

pub fn try_get_address(&self) -> Option<Uri>

Returns the parsed URI address for this node, or None if the URI is invalid.

Source

pub fn get_process_id(&self) -> u32

Returns the OS process ID of this node.

Source

pub fn get_certificate(&self) -> Vec<u8>

Returns a copy of the certificate bytes for this node.

Source

pub fn get_failures(&self) -> u8

Returns the current failure count for this node.

Source

pub fn get_features(&self) -> &Features

Returns a reference to this node’s registered features.

Source

pub fn get_services(&self) -> &Services

Returns a reference to this node’s registered services.

Source

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
Source

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.

Source

pub fn get_created_at(&self) -> DateTime<Utc>

Returns the timestamp when this node was created.

Source

pub fn get_last_updated_at(&self) -> DateTime<Utc>

Returns the timestamp when this node was last updated.

Trait Implementations§

Source§

impl AsByteVector for &Node

Source§

fn as_byte_vector(&self) -> Vec<u8>

Convert this type to a byte vector
Source§

impl Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Node

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Node

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !Freeze for Node

§

impl !RefUnwindSafe for Node

§

impl !UnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more