[−][src]Struct libp2p_core::nodes::tasks::Manager
Implementation of Stream
that handles a collection of nodes.
Methods
impl<I, O, H, E, HE, T, C> Manager<I, O, H, E, HE, T, C>
[src]
pub fn new() -> Self
[src]
Creates a new task manager.
pub fn add_reach_attempt<F, M>(
&mut self,
future: F,
user_data: T,
handler: H
) -> TaskId where
F: Future<Item = (C, M), Error = E> + Send + 'static,
H: IntoNodeHandler<C> + Send + 'static,
H::Handler: NodeHandler<Substream = Substream<M>, InEvent = I, OutEvent = O, Error = HE> + Send + 'static,
E: Error + Send + 'static,
HE: Error + Send + 'static,
I: Send + 'static,
O: Send + 'static,
<H::Handler as NodeHandler>::OutboundOpenInfo: Send + 'static,
M: StreamMuxer + Send + Sync + 'static,
M::OutboundSubstream: Send + 'static,
C: Send + 'static,
[src]
&mut self,
future: F,
user_data: T,
handler: H
) -> TaskId where
F: Future<Item = (C, M), Error = E> + Send + 'static,
H: IntoNodeHandler<C> + Send + 'static,
H::Handler: NodeHandler<Substream = Substream<M>, InEvent = I, OutEvent = O, Error = HE> + Send + 'static,
E: Error + Send + 'static,
HE: Error + Send + 'static,
I: Send + 'static,
O: Send + 'static,
<H::Handler as NodeHandler>::OutboundOpenInfo: Send + 'static,
M: StreamMuxer + Send + Sync + 'static,
M::OutboundSubstream: Send + 'static,
C: Send + 'static,
Adds to the manager a future that tries to reach a node.
This method spawns a task dedicated to resolving this future and processing the node's events.
pub fn add_connection<M, Handler>(
&mut self,
user_data: T,
muxer: M,
handler: Handler
) -> TaskId where
H: IntoNodeHandler<C, Handler = Handler> + Send + 'static,
Handler: NodeHandler<Substream = Substream<M>, InEvent = I, OutEvent = O, Error = HE> + Send + 'static,
E: Error + Send + 'static,
HE: Error + Send + 'static,
I: Send + 'static,
O: Send + 'static,
<H::Handler as NodeHandler>::OutboundOpenInfo: Send + 'static,
M: StreamMuxer + Send + Sync + 'static,
M::OutboundSubstream: Send + 'static,
C: Send + 'static,
[src]
&mut self,
user_data: T,
muxer: M,
handler: Handler
) -> TaskId where
H: IntoNodeHandler<C, Handler = Handler> + Send + 'static,
Handler: NodeHandler<Substream = Substream<M>, InEvent = I, OutEvent = O, Error = HE> + Send + 'static,
E: Error + Send + 'static,
HE: Error + Send + 'static,
I: Send + 'static,
O: Send + 'static,
<H::Handler as NodeHandler>::OutboundOpenInfo: Send + 'static,
M: StreamMuxer + Send + Sync + 'static,
M::OutboundSubstream: Send + 'static,
C: Send + 'static,
Adds an existing connection to a node to the collection.
This method spawns a task dedicated to processing the node's events.
No NodeReached
event will be emitted for this task, since the node has already been
reached.
#[must_use]
pub fn start_broadcast(&mut self, event: &I) -> AsyncSink<()> where
I: Clone,
[src]
I: Clone,
Start sending an event to all the tasks, including the pending ones.
After starting a broadcast make sure to finish it with complete_broadcast
,
otherwise starting another broadcast or sending an event directly to a
task would overwrite the pending broadcast.
#[must_use]
pub fn complete_broadcast(&mut self) -> Async<()>
[src]
Complete a started broadcast.
pub fn task(&mut self, id: TaskId) -> Option<TaskEntry<I, T>>
[src]
Grants access to an object that allows controlling a task of the collection.
Returns None
if the task id is invalid.
pub fn tasks<'a>(&'a self) -> impl Iterator<Item = TaskId> + 'a
[src]
Returns a list of all the active tasks.
pub fn poll(&mut self) -> Async<Event<I, O, H, E, HE, T, C>>
[src]
Provides an API similar to Stream
, except that it cannot produce an error.
Trait Implementations
Auto Trait Implementations
impl<I, O, H, E, HE, T, C> Unpin for Manager<I, O, H, E, HE, T, C> where
I: Unpin,
T: Unpin,
I: Unpin,
T: Unpin,
impl<I, O, H, E, HE, T, C = PeerId> !Sync for Manager<I, O, H, E, HE, T, C>
impl<I, O, H, E, HE, T, C> Send for Manager<I, O, H, E, HE, T, C> where
C: Send,
E: Send,
H: Send,
HE: Send,
I: Send,
O: Send,
T: Send,
C: Send,
E: Send,
H: Send,
HE: Send,
I: Send,
O: Send,
T: Send,
impl<I, O, H, E, HE, T, C = PeerId> !RefUnwindSafe for Manager<I, O, H, E, HE, T, C>
impl<I, O, H, E, HE, T, C = PeerId> !UnwindSafe for Manager<I, O, H, E, HE, T, C>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self