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;

    // Provided method
    fn worker_control_task_queue_enabled(&self) -> bool { ... }
}
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.

Provided Methods§

Source

fn worker_control_task_queue_enabled(&self) -> bool

Returns whether this shared worker is polling the worker control task queue.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§