Struct tentacle::builder::MetaBuilder [−][src]
pub struct MetaBuilder { /* fields omitted */ }
Expand description
Builder for protocol meta
Implementations
Define protocol id
It is just an internal index of the system that identifies the open/close and message transfer for the specified protocol.
Define protocol name, default is “/p2p/protocol_id”
Used to interact with the remote service to determine whether the protocol is supported.
If not found, the protocol connection(not session just sub stream) will be closed,
and return a ProtocolSelectError
event.
Define protocol support versions, default is vec!["0.0.1".to_owned()]
Used to interact with the remote service to confirm that both parties open the same version of the protocol.
If not found, the protocol connection(not session just sub stream) will be closed,
and return a ProtocolSelectError
event.
Define protocol codec, default is LengthDelimitedCodec
pub fn service_handle<T: FnOnce() -> ProtocolHandle<Box<dyn ServiceProtocol + Send + Unpin + 'static>>>(
self,
service_handle: T
) -> Self
pub fn service_handle<T: FnOnce() -> ProtocolHandle<Box<dyn ServiceProtocol + Send + Unpin + 'static>>>(
self,
service_handle: T
) -> Self
Define protocol service handle, default is neither
pub fn session_handle<T: FnMut() -> ProtocolHandle<Box<dyn SessionProtocol + Send + Unpin + 'static>> + Send + 'static>(
self,
session_handle: T
) -> Self
pub fn session_handle<T: FnMut() -> ProtocolHandle<Box<dyn SessionProtocol + Send + Unpin + 'static>> + Send + 'static>(
self,
session_handle: T
) -> Self
Define protocol session handle, default is neither
Define the spawn process of the protocol read part
Mutually exclusive with protocol handle
Protocol version selection rule, default is select_version
Unified processing of messages before they are sent
Unified processing of messages before user received
Set a flag to control function behavior
Combine the configuration of this builder to create a ProtocolMeta