Struct copra::protocol::ProtoCodec
[−]
[src]
pub struct ProtoCodec { /* fields omitted */ }
Server side codec that can deduce protocol from byte stream
Server can provide services to clients that use different protocols.
When a new connection is established, the server try each protocol until
it succeeds in decoding the request. Since copra
use keep-alive connections
to exchange messages, this match is cached so that the protocol resolution
overhead is only incurred when receiving the first request.
Methods
impl ProtoCodec
[src]
fn new(protos: &[Box<RpcProtocol>]) -> Self
[src]
Create a new codec that support multiple protocols.
Trait Implementations
impl Debug for ProtoCodec
[src]
impl Decoder for ProtoCodec
[src]
type Item = (RequestId, RequestPackage)
The type of decoded frames.
type Error = Error
The type of unrecoverable frame decoding errors. Read more
fn decode(
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
[src]
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
Attempts to decode a frame from the provided buffer of bytes. Read more
fn decode_eof(
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
[src]
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
A default method available to be called when there are no more bytes available to be read from the underlying I/O. Read more