pub struct Partitioning {
pub kind: PartitioningKind,
pub length: u8,
pub value: Vec<u8>,
}Expand description
Partitioning is used to specify to which partition the messages should be sent.
It has the following kinds:
Balanced- the partition ID is calculated by the server using the round-robin algorithm.PartitionId- the partition ID is provided by the client.MessagesKey- the partition ID is calculated by the server using the hash of the provided messages key.
Fields§
§kind: PartitioningKindThe kind of partitioning.
length: u8The length of the value payload.
value: Vec<u8>The binary value payload.
Implementations§
Source§impl Partitioning
impl Partitioning
Sourcepub fn balanced() -> Self
pub fn balanced() -> Self
Partition the messages using the balanced round-robin algorithm on the server.
Sourcepub fn partition_id(partition_id: u32) -> Self
pub fn partition_id(partition_id: u32) -> Self
Partition the messages using the provided partition ID.
Sourcepub fn messages_key(value: &[u8]) -> Result<Self, IggyError>
pub fn messages_key(value: &[u8]) -> Result<Self, IggyError>
Partition the messages using the provided messages key.
Sourcepub fn messages_key_str(value: &str) -> Result<Self, IggyError>
pub fn messages_key_str(value: &str) -> Result<Self, IggyError>
Partition the messages using the provided messages key as str.
Sourcepub fn messages_key_u32(value: u32) -> Self
pub fn messages_key_u32(value: u32) -> Self
Partition the messages using the provided messages key as u32.
Sourcepub fn messages_key_u64(value: u64) -> Self
pub fn messages_key_u64(value: u64) -> Self
Partition the messages using the provided messages key as u64.
Sourcepub fn messages_key_u128(value: u128) -> Self
pub fn messages_key_u128(value: u128) -> Self
Partition the messages using the provided messages key as u128.
Sourcepub fn from_partitioning(partitioning: &Partitioning) -> Self
pub fn from_partitioning(partitioning: &Partitioning) -> Self
Create the partitioning from the provided partitioning.
Sourcepub fn from_raw_bytes(bytes: &[u8]) -> Result<Self, IggyError>
pub fn from_raw_bytes(bytes: &[u8]) -> Result<Self, IggyError>
Create the partitioning from a raw byte slice.
Sourcepub const fn maximum_byte_size() -> usize
pub const fn maximum_byte_size() -> usize
Maximum size of the Partitioning struct
Trait Implementations§
Source§impl BytesSerializable for Partitioning
impl BytesSerializable for Partitioning
Source§fn from_bytes(bytes: Bytes) -> Result<Self, IggyError>where
Self: Sized,
fn from_bytes(bytes: Bytes) -> Result<Self, IggyError>where
Self: Sized,
Source§fn write_to_buffer(&self, bytes: &mut BytesMut)
fn write_to_buffer(&self, bytes: &mut BytesMut)
Source§fn get_buffer_size(&self) -> usize
fn get_buffer_size(&self) -> usize
Source§impl Clone for Partitioning
impl Clone for Partitioning
Source§fn clone(&self) -> Partitioning
fn clone(&self) -> Partitioning
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Partitioning
impl Debug for Partitioning
Source§impl Default for Partitioning
impl Default for Partitioning
Source§impl<'de> Deserialize<'de> for Partitioning
impl<'de> Deserialize<'de> for Partitioning
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Partitioning
impl Display for Partitioning
Source§impl Hash for Partitioning
impl Hash for Partitioning
Source§impl PartialEq for Partitioning
impl PartialEq for Partitioning
Source§impl Serialize for Partitioning
impl Serialize for Partitioning
Source§impl Sizeable for Partitioning
impl Sizeable for Partitioning
fn get_size_bytes(&self) -> IggyByteSize
impl Eq for Partitioning
impl StructuralPartialEq for Partitioning
Auto Trait Implementations§
impl Freeze for Partitioning
impl RefUnwindSafe for Partitioning
impl Send for Partitioning
impl Sync for Partitioning
impl Unpin for Partitioning
impl UnsafeUnpin for Partitioning
impl UnwindSafe for Partitioning
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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