pub struct NodeApi(/* private fields */);
Implementations§
Source§impl NodeApi
impl NodeApi
Sourcepub fn start_server(&self, ip_port_addr: &str) -> Result<Server>
pub fn start_server(&self, ip_port_addr: &str) -> Result<Server>
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 theServiceStatus
enum.
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 theServiceStatus
enum.
§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