[][src]Struct nakadion::publisher::partitioner::Partitioner

pub struct Partitioner<B: BuildHasher + Clone = DefaultBuildHasher> { /* fields omitted */ }

Determines partitions based on hashes

Methods

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]

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]

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]

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 ba their contained string.

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]

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 ba their contained string.

Fails if the event type has no partitions.

pub fn assign<E: PartitionKeyExtractable + PartitionAssignable>(
    self,
    event: &mut E
)
[src]

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]

Auto Trait Implementations

impl<B> RefUnwindSafe for Partitioner<B> where
    B: RefUnwindSafe

impl<B> Send for Partitioner<B> where
    B: Send

impl<B> Sync for Partitioner<B> where
    B: Sync

impl<B> Unpin for Partitioner<B> where
    B: Unpin

impl<B> UnwindSafe for Partitioner<B> where
    B: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,