pub trait SharedNamespaceWorkerTrait {
// Required methods
fn namespace(&self) -> String;
fn register_callback(
&self,
worker_instance_key: Uuid,
heartbeat_callback: HeartbeatCallback,
);
fn unregister_callback(
&self,
worker_instance_key: Uuid,
) -> (Option<HeartbeatCallback>, bool);
fn num_workers(&self) -> usize;
}Expand description
This trait represents a shared namespace worker that sends worker heartbeats and receives worker commands.
Required Methods§
Sourcefn register_callback(
&self,
worker_instance_key: Uuid,
heartbeat_callback: HeartbeatCallback,
)
fn register_callback( &self, worker_instance_key: Uuid, heartbeat_callback: HeartbeatCallback, )
Registers a heartbeat callback.
Sourcefn unregister_callback(
&self,
worker_instance_key: Uuid,
) -> (Option<HeartbeatCallback>, bool)
fn unregister_callback( &self, worker_instance_key: Uuid, ) -> (Option<HeartbeatCallback>, bool)
Unregisters a heartbeat callback. Returns the callback removed, as well as a bool that indicates if there are no remaining callbacks in the SharedNamespaceWorker, indicating the shared worker itself can be shut down.
Sourcefn num_workers(&self) -> usize
fn num_workers(&self) -> usize
Returns the number of workers registered to this shared worker.