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,
        callbacks: WorkerCallbacks,
    );
    fn unregister_callback(
        &self,
        worker_instance_key: Uuid,
    ) -> (Option<WorkerCallbacks>, 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, callbacks: WorkerCallbacks, )

Registers worker callbacks.

Source

fn unregister_callback( &self, worker_instance_key: Uuid, ) -> (Option<WorkerCallbacks>, bool)

Unregisters worker callbacks. Returns the callbacks 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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§