pub struct ServiceControl { /* private fields */ }Expand description
Service control, used to send commands externally at runtime
Implementations§
Source§impl ServiceControl
impl ServiceControl
Sourcepub fn dial(
&self,
address: Multiaddr,
target: TargetProtocol,
) -> Result<(), SendErrorKind>
pub fn dial( &self, address: Multiaddr, target: TargetProtocol, ) -> Result<(), SendErrorKind>
Initiate a connection request to address
Sourcepub fn raw_session<T>(
&self,
raw_session: T,
remote_address: Multiaddr,
info: RawSessionInfo,
) -> Result<(), SendErrorKind>
pub fn raw_session<T>( &self, raw_session: T, remote_address: Multiaddr, info: RawSessionInfo, ) -> Result<(), SendErrorKind>
Receive an established connection session and build the tentacle protocol on top of it.
Sourcepub fn disconnect(&self, session_id: SessionId) -> Result<(), SendErrorKind>
pub fn disconnect(&self, session_id: SessionId) -> Result<(), SendErrorKind>
Disconnect a connection
Sourcepub fn send_message_to(
&self,
session_id: SessionId,
proto_id: ProtocolId,
data: Bytes,
) -> Result<(), SendErrorKind>
pub fn send_message_to( &self, session_id: SessionId, proto_id: ProtocolId, data: Bytes, ) -> Result<(), SendErrorKind>
Send message
Sourcepub fn quick_send_message_to(
&self,
session_id: SessionId,
proto_id: ProtocolId,
data: Bytes,
) -> Result<(), SendErrorKind>
pub fn quick_send_message_to( &self, session_id: SessionId, proto_id: ProtocolId, data: Bytes, ) -> Result<(), SendErrorKind>
Send message on quick channel
Sourcepub fn filter_broadcast(
&self,
target: TargetSession,
proto_id: ProtocolId,
data: Bytes,
) -> Result<(), SendErrorKind>
pub fn filter_broadcast( &self, target: TargetSession, proto_id: ProtocolId, data: Bytes, ) -> Result<(), SendErrorKind>
Send data to the specified protocol for the specified sessions.
Sourcepub fn quick_filter_broadcast(
&self,
target: TargetSession,
proto_id: ProtocolId,
data: Bytes,
) -> Result<(), SendErrorKind>
pub fn quick_filter_broadcast( &self, target: TargetSession, proto_id: ProtocolId, data: Bytes, ) -> Result<(), SendErrorKind>
Send data to the specified protocol for the specified sessions on quick channel.
Sourcepub fn future_task<T>(&self, task: T) -> Result<(), SendErrorKind>
pub fn future_task<T>(&self, task: T) -> Result<(), SendErrorKind>
Send a future task
Sourcepub fn open_protocol(
&self,
session_id: SessionId,
proto_id: ProtocolId,
) -> Result<(), SendErrorKind>
pub fn open_protocol( &self, session_id: SessionId, proto_id: ProtocolId, ) -> Result<(), SendErrorKind>
Try open a protocol
If the protocol has been open, do nothing
Sourcepub fn open_protocols(
&self,
session_id: SessionId,
target: TargetProtocol,
) -> Result<(), SendErrorKind>
pub fn open_protocols( &self, session_id: SessionId, target: TargetProtocol, ) -> Result<(), SendErrorKind>
Try open protocol
If the protocol has been open, do nothing
Sourcepub fn close_protocol(
&self,
session_id: SessionId,
proto_id: ProtocolId,
) -> Result<(), SendErrorKind>
pub fn close_protocol( &self, session_id: SessionId, proto_id: ProtocolId, ) -> Result<(), SendErrorKind>
Try close a protocol
If the protocol has been closed, do nothing
Sourcepub fn set_service_notify(
&self,
proto_id: ProtocolId,
interval: Duration,
token: u64,
) -> Result<(), SendErrorKind>
pub fn set_service_notify( &self, proto_id: ProtocolId, interval: Duration, token: u64, ) -> Result<(), SendErrorKind>
Set a service notify token
Sourcepub fn remove_service_notify(
&self,
proto_id: ProtocolId,
token: u64,
) -> Result<(), SendErrorKind>
pub fn remove_service_notify( &self, proto_id: ProtocolId, token: u64, ) -> Result<(), SendErrorKind>
remove a service notify token
Sourcepub fn set_session_notify(
&self,
session_id: SessionId,
proto_id: ProtocolId,
interval: Duration,
token: u64,
) -> Result<(), SendErrorKind>
pub fn set_session_notify( &self, session_id: SessionId, proto_id: ProtocolId, interval: Duration, token: u64, ) -> Result<(), SendErrorKind>
Set a session notify token
Sourcepub fn remove_session_notify(
&self,
session_id: SessionId,
proto_id: ProtocolId,
token: u64,
) -> Result<(), SendErrorKind>
pub fn remove_session_notify( &self, session_id: SessionId, proto_id: ProtocolId, token: u64, ) -> Result<(), SendErrorKind>
Remove a session notify token
Sourcepub fn close(&self) -> Result<(), SendErrorKind>
pub fn close(&self) -> Result<(), SendErrorKind>
Close service
Order:
- close all listens
- try close all session’s protocol stream
- try close all session
- close service
Sourcepub fn shutdown(&self) -> Result<(), SendErrorKind>
pub fn shutdown(&self) -> Result<(), SendErrorKind>
Shutdown service, don’t care anything, may cause partial message loss
Trait Implementations§
Source§impl Clone for ServiceControl
impl Clone for ServiceControl
Source§fn clone(&self) -> ServiceControl
fn clone(&self) -> ServiceControl
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServiceControl
impl Debug for ServiceControl
Source§impl From<ServiceAsyncControl> for ServiceControl
impl From<ServiceAsyncControl> for ServiceControl
Source§fn from(control: ServiceAsyncControl) -> ServiceControl
fn from(control: ServiceAsyncControl) -> ServiceControl
Auto Trait Implementations§
impl !Freeze for ServiceControl
impl !RefUnwindSafe for ServiceControl
impl Send for ServiceControl
impl Sync for ServiceControl
impl Unpin for ServiceControl
impl !UnwindSafe for ServiceControl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more