pub struct NodeApi(/* private fields */);Available on crate feature
nodeapi only.Implementations§
Source§impl NodeApi
impl NodeApi
Sourcepub fn start_server(
&self,
ip_port_addr: &str,
) -> Result<Server<Connection>, Error>
pub fn start_server( &self, ip_port_addr: &str, ) -> Result<Server<Connection>, Error>
Function to create the Ntex HTTP server This function sets up the server and routes. External users can call this function to create and run the server.
Sourcepub fn update_health(&mut self, new_health: NodeHealth)
pub fn update_health(&mut self, new_health: NodeHealth)
Updates the health status of the node.
§Arguments
new_health- The new health status to be set for the node.
Sourcepub fn register_service(
&mut self,
id: &str,
name: &str,
description: &str,
status: ServiceStatus,
) -> Result<(), NodeApiError>
pub fn register_service( &mut self, id: &str, name: &str, description: &str, status: ServiceStatus, ) -> Result<(), NodeApiError>
Registers a new service with the node.
§Arguments
id- A string slice that holds the unique identifier of the service.name- A string slice that holds the name of the service.description- A string slice that holds the description of the service.status- The status of the service, represented by theServiceStatusenum.
Sourcepub fn update_service_status(
&mut self,
service_id: &str,
status: ServiceStatus,
) -> Result<(), NodeApiError>
pub fn update_service_status( &mut self, service_id: &str, status: ServiceStatus, ) -> Result<(), NodeApiError>
Updates the status of a registered service.
§Arguments
service_id- A string slice that holds the unique identifier of the service.status- The new status to be set for the service, represented by theServiceStatusenum.
§Returns
A Result which is Ok(()) if the service status was updated successfully,
or an Err with a message if the service with the specified id was not found.
Sourcepub fn deregister_service(
&mut self,
service_id: &str,
) -> Result<(), NodeApiError>
pub fn deregister_service( &mut self, service_id: &str, ) -> Result<(), NodeApiError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeApi
impl RefUnwindSafe for NodeApi
impl Send for NodeApi
impl Sync for NodeApi
impl Unpin for NodeApi
impl UnwindSafe for NodeApi
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Creates a shared type from an unshared type.