Skip to main content

SharedNamespaceWorkerTrait

Trait SharedNamespaceWorkerTrait 

Source
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§

Source

fn namespace(&self) -> String

Namespace that the shared namespace worker is connected to.

Source

fn register_callback( &self, worker_instance_key: Uuid, heartbeat_callback: HeartbeatCallback, )

Registers a heartbeat callback.

Source

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.

Source

fn num_workers(&self) -> usize

Returns the number of workers registered to this shared worker.

Implementors§