Struct tentacle::service::ServiceControl[][src]

pub struct ServiceControl { /* fields omitted */ }

Service control, used to send commands externally at runtime

Implementations

impl ServiceControl[src]

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

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

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

Create a new listener

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

Initiate a connection request to address

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

Disconnect a connection

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

Send message

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

Send message on quick channel

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

Send data to the specified protocol for the specified sessions.

pub fn quick_filter_broadcast(
    &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 fn future_task<T>(&self, task: T) -> Result<(), SendErrorKind> where
    T: Future<Output = ()> + 'static + Send
[src]

Send a future task

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

Try open a protocol

If the protocol has been open, do nothing

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

Try open protocol

If the protocol has been open, do nothing

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

Try close a protocol

If the protocol has been closed, do nothing

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

Set a service notify token

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

remove a service notify token

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

Set a session notify token

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

Remove a session notify token

pub fn close(&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 fn shutdown(&self) -> Result<(), SendErrorKind>[src]

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

Trait Implementations

impl Clone for ServiceControl[src]

fn clone(&self) -> ServiceControl[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl From<ServiceAsyncControl> for ServiceControl[src]

fn from(control: ServiceAsyncControl) -> Self[src]

Performs the conversion.

impl From<ServiceControl> for ServiceAsyncControl[src]

fn from(control: ServiceControl) -> Self[src]

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V