pub struct K2Proto {
pub ty: i32,
pub data: Bytes,
pub space: Option<Bytes>,
pub module: Option<String>,
}Expand description
A Kitsune2 wire protocol message.
This is the top-level encoding that will be transferred between Kitsune2 peers. Most communications between peers to make Kitsune2 actually function will be encoded separately inside the payload of TY_MODULE type messages.
Fields§
§ty: i32The type of this message.
data: BytesThe payload or content of this message.
space: Option<Bytes>If the Ty requires that a space be specified, this is it.
Kitsune is divided up into multiple dht “spaces” and peers join and communicate over these spaces. These bytes identify the space within which this message is communicating.
module: Option<String>If the Ty requires a module impl be specified, this is it.
Modules include specific sub-protocols to communicate with each other, so those messages must be routed to the correct module.
This string is the module routing info. E.g. “gossip”, “fetch”, “sharding”.
Implementations§
Source§impl K2Proto
impl K2Proto
Sourcepub fn ty(&self) -> K2WireType
pub fn ty(&self) -> K2WireType
Returns the enum value of ty, or the default if the field is set to an invalid enum value.
Sourcepub fn set_ty(&mut self, value: K2WireType)
pub fn set_ty(&mut self, value: K2WireType)
Sets ty to the provided enum value.
Trait Implementations§
Source§impl Message for K2Proto
impl Message for K2Proto
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.