Struct tentacle::service::ServiceAsyncControl[][src]

pub struct ServiceAsyncControl { /* fields omitted */ }

Service control, used to send commands externally at runtime, All interfaces are async methods

Implementations

impl ServiceAsyncControl[src]

pub fn protocols(&self) -> &Arc<HashMap<ProtocolId, ProtocolInfo>>[src]

Get service protocol message, Map(ID, Name), but can't modify

pub async fn listen(&mut self, address: Multiaddr) -> Result<(), SendErrorKind>[src]

Create a new listener

pub async fn dial(
    &mut self,
    address: Multiaddr,
    target: TargetProtocol
) -> Result<(), SendErrorKind>
[src]

Initiate a connection request to address

pub async fn disconnect(
    &mut self,
    session_id: SessionId
) -> Result<(), SendErrorKind>
[src]

Disconnect a connection

pub async fn send_message_to(
    &mut self,
    session_id: SessionId,
    proto_id: ProtocolId,
    data: Bytes
) -> Result<(), SendErrorKind>
[src]

Send message

pub async fn quick_send_message_to(
    &mut self,
    session_id: SessionId,
    proto_id: ProtocolId,
    data: Bytes
) -> Result<(), SendErrorKind>
[src]

Send message on quick channel

pub async fn filter_broadcast(
    &mut self,
    target: TargetSession,
    proto_id: ProtocolId,
    data: Bytes
) -> Result<(), SendErrorKind>
[src]

Send data to the specified protocol for the specified sessions.

pub async fn quick_filter_broadcast(
    &mut self,
    target: TargetSession,
    proto_id: ProtocolId,
    data: Bytes
) -> Result<(), SendErrorKind>
[src]

Send data to the specified protocol for the specified sessions on quick channel.

pub async fn future_task<T>(&mut self, task: T) -> Result<(), SendErrorKind> where
    T: Future<Output = ()> + 'static + Send
[src]

Send a future task

pub async fn open_protocol(
    &mut self,
    session_id: SessionId,
    proto_id: ProtocolId
) -> Result<(), SendErrorKind>
[src]

Try open a protocol

If the protocol has been open, do nothing

pub async fn open_protocols(
    &mut self,
    session_id: SessionId,
    target: TargetProtocol
) -> Result<(), SendErrorKind>
[src]

Try open protocol

If the protocol has been open, do nothing

pub async fn close_protocol(
    &mut self,
    session_id: SessionId,
    proto_id: ProtocolId
) -> Result<(), SendErrorKind>
[src]

Try close a protocol

If the protocol has been closed, do nothing

pub async fn set_service_notify(
    &mut self,
    proto_id: ProtocolId,
    interval: Duration,
    token: u64
) -> Result<(), SendErrorKind>
[src]

Set a service notify token

pub async fn remove_service_notify(
    &mut self,
    proto_id: ProtocolId,
    token: u64
) -> Result<(), SendErrorKind>
[src]

remove a service notify token

pub async fn set_session_notify(
    &mut self,
    session_id: SessionId,
    proto_id: ProtocolId,
    interval: Duration,
    token: u64
) -> Result<(), SendErrorKind>
[src]

Set a session notify token

pub async fn remove_session_notify(
    &mut self,
    session_id: SessionId,
    proto_id: ProtocolId,
    token: u64
) -> Result<(), SendErrorKind>
[src]

Remove a session notify token

pub async fn close(&mut self) -> Result<(), SendErrorKind>[src]

Close service

Order:

  1. close all listens
  2. try close all session's protocol stream
  3. try close all session
  4. close service

pub async fn shutdown(&mut self) -> Result<(), SendErrorKind>[src]

Shutdown service, don't care anything, may cause partial message loss

Trait Implementations

impl Clone for ServiceAsyncControl[src]

impl From<ServiceAsyncControl> for ServiceControl[src]

impl From<ServiceControl> for ServiceAsyncControl[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,