[−][src]Struct nakadion::publisher::partitioner::Partitioner
Determines partitions based on hashes
Implementations
impl Partitioner<DefaultBuildHasher>
[src]
pub fn new(partitions: Vec<PartitionId>) -> Self
[src]
Create a new instance with the given partitions.
The order of the given partitions will not be changed.
Panics
If partitions is empty
pub fn new_sorted(partitions: Vec<PartitionId>) -> Self
[src]
Create a new instance with the given partitions.
The partitions will be sorted by first trying to convert the partitions to numbers and sorting by these. Otherwise they will be sorted ba their contained string.
Panics
If partitions is empty
pub async fn from_event_type<C>(
event_type: &EventTypeName,
api_client: &C
) -> Result<Self, NakadiApiError> where
C: MonitoringApi,
[src]
event_type: &EventTypeName,
api_client: &C
) -> Result<Self, NakadiApiError> where
C: MonitoringApi,
Create a new instance for the partitions of the given event type.
The partitions will be sorted by first trying to convert the partitions to numbers and sorting by these. Otherwise they will be sorted ba their contained string.
Fails if the event type has no partitions.
impl<B> Partitioner<B> where
B: BuildHasher + Clone,
[src]
B: BuildHasher + Clone,
pub fn new_with_hasher(partitions: Vec<PartitionId>, build_hasher: B) -> Self
[src]
Create a new instance with the given partitions and a provided hashing algorithm.
The order of the given partitions will not be changed.
Panics
If partitions is empty
pub fn new_sorted_with_hasher(
partitions: Vec<PartitionId>,
build_hasher: B
) -> Self
[src]
partitions: Vec<PartitionId>,
build_hasher: B
) -> Self
Create a new instance with the given partitions and a provided hashing algorithm.
The partitions will be sorted by first trying to convert the partitions to numbers and sorting by these. Otherwise they will be sorted by their string representation.
Panics
If partitions is empty
pub async fn from_event_type_with_hasher<C>(
event_type: &EventTypeName,
api_client: &C,
build_hasher: B
) -> Result<Self, NakadiApiError> where
C: MonitoringApi,
[src]
event_type: &EventTypeName,
api_client: &C,
build_hasher: B
) -> Result<Self, NakadiApiError> where
C: MonitoringApi,
Create a new instance for the partitions of the given event type and a provided hashing algorithm.
The partitions will be sorted by first trying to convert the partitions to numbers and sorting by these. Otherwise they will be sorted by their string representation.
Fails if the event type has no partitions.
pub fn partition_for_key<H>(&self, partition_key: &H) -> &PartitionId where
H: Hash,
[src]
H: Hash,
Returns the partition that matches the given key
pub fn assign<E: PartitionKeyExtractable + PartitionAssignable>(
&self,
event: &mut E
)
[src]
&self,
event: &mut E
)
Determines and assigns partitions
pub fn partitions(&self) -> &[PartitionId]ⓘ
[src]
Returns the partitions as used by the Partitioner
Trait Implementations
impl<B: Clone + BuildHasher> Clone for Partitioner<B>
[src]
pub fn clone(&self) -> Partitioner<B>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<B> RefUnwindSafe for Partitioner<B> where
B: RefUnwindSafe,
[src]
B: RefUnwindSafe,
impl<B> Send for Partitioner<B> where
B: Send,
[src]
B: Send,
impl<B> Sync for Partitioner<B> where
B: Sync,
[src]
B: Sync,
impl<B> Unpin for Partitioner<B> where
B: Unpin,
[src]
B: Unpin,
impl<B> UnwindSafe for Partitioner<B> where
B: UnwindSafe,
[src]
B: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,