Struct ibc_relayer::worker::WorkerMap
source · [−]pub struct WorkerMap { /* private fields */ }Expand description
Manage the lifecycle of WorkerHandles associated with Objects.
Implementations
sourceimpl WorkerMap
impl WorkerMap
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new worker map, which will spawn workers with the given channel for sending messages back to the supervisor.
sourcepub fn contains(&self, object: &Object) -> bool
pub fn contains(&self, object: &Object) -> bool
Returns true if there is a spawned WorkerHandle associated with the given Object.
sourcepub fn remove_stopped(&mut self, id: WorkerId, object: Object) -> bool
pub fn remove_stopped(&mut self, id: WorkerId, object: Object) -> bool
Remove the WorkerHandle associated with the given Object from
the map and wait for its thread to terminate.
sourcepub fn to_notify<'a>(
&'a self,
src_chain_id: &'a ChainId
) -> impl Iterator<Item = &'a WorkerHandle>
pub fn to_notify<'a>(
&'a self,
src_chain_id: &'a ChainId
) -> impl Iterator<Item = &'a WorkerHandle>
Returns all the WorkerHandle which are interested in new block events originating
from the chain with the given ChainId.
See: Object::notify_new_block
pub fn notify_new_block(
&self,
src_chain_id: &ChainId,
height: Height,
new_block: NewBlock
)
sourcepub fn get_or_spawn<Chain: ChainHandle>(
&mut self,
object: Object,
src: Chain,
dst: Chain,
config: &Config
) -> &WorkerHandle
pub fn get_or_spawn<Chain: ChainHandle>(
&mut self,
object: Object,
src: Chain,
dst: Chain,
config: &Config
) -> &WorkerHandle
Get a handle to the worker in charge of handling events associated
with the given Object.
This function will spawn a new WorkerHandle if one does not exists already.
sourcepub fn spawn<Chain: ChainHandle>(
&mut self,
src: Chain,
dst: Chain,
object: &Object,
config: &Config
) -> bool
pub fn spawn<Chain: ChainHandle>(
&mut self,
src: Chain,
dst: Chain,
object: &Object,
config: &Config
) -> bool
Spawn a new WorkerHandle, only if one does not exists already.
Returns whether or not the worker was actually spawned.
sourcepub fn objects_for_chain(&self, chain_id: &ChainId) -> Vec<Object>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn objects_for_chain(&self, chain_id: &ChainId) -> Vec<Object>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
List the Objects for which there is an associated worker
for the given chain.
sourcepub fn workers_for_chain(&self, chain_id: &ChainId) -> Vec<&WorkerHandle>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn workers_for_chain(&self, chain_id: &ChainId) -> Vec<&WorkerHandle>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
List the WorkerHandles associated with the given chain.
sourcepub fn handles(&self) -> impl Iterator<Item = &WorkerHandle>
pub fn handles(&self) -> impl Iterator<Item = &WorkerHandle>
Return all the handles to the workers tracked in this map.
sourcepub fn shutdown_worker(&mut self, object: &Object)
pub fn shutdown_worker(&mut self, object: &Object)
Shutdown the worker associated with the given Object, synchronously.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for WorkerMap
impl Send for WorkerMap
impl Sync for WorkerMap
impl Unpin for WorkerMap
impl !UnwindSafe for WorkerMap
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T in a tonic::Request
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more