Skip to main content

GroupMember

Struct GroupMember 

Source
pub struct GroupMember { /* private fields */ }
Expand description

One member of one group.

Implementations§

Source§

impl GroupMember

Source

pub fn new(group_id: impl Into<String>, topics: Vec<String>) -> Self

Source

pub fn with_protocol(self, protocol: RebalanceProtocol) -> Self

Use the cooperative protocol (KIP-429) rather than the eager one.

Source

pub fn protocol(&self) -> RebalanceProtocol

Source

pub fn lost(&self) -> &[TopicPartition]

What the last sync took away, for the caller to stop reading before it rejoins. Cooperative only; empty under the eager protocol, which revokes everything instead.

Source

pub fn group_id(&self) -> &str

Source

pub fn topics(&self) -> &[String]

What this member is subscribed to.

Source

pub fn state(&self) -> MemberState

Source

pub fn generation(&self) -> i32

Source

pub fn member_id(&self) -> &str

Source

pub fn is_leader(&self) -> bool

Source

pub fn assignment(&self) -> &[TopicPartition]

What this member currently owns. Empty unless MemberState::Stable.

Source

pub fn can_commit(&self) -> bool

Whether offsets may be committed right now.

Only in MemberState::Stable. Committing mid-rebalance is how a member writes an offset for a partition another member already owns — the coordinator would reject it as a stale generation, but only if the generation had already moved, and between revocation and rejoin it has not. The rule is cheaper than reasoning about the race.

Source

pub fn step(&self) -> Step

What to do next, given where we are.

Source

pub fn subscription(&self) -> Subscription

The subscription this member sends in JoinGroup.

Source

pub fn set_topics(&mut self, topics: Vec<String>)

Change what this member wants to read. Forces a rejoin, because the group has to agree on the subscription before it can be assigned.

Source

pub fn request_rejoin(&mut self)

Rejoin at the next step, keeping the subscription as it is.

For a change the group must agree on that is not a change of topics: a subscribed topic growing partitions is the case that exists. Only the leader computes an assignment, and it does so from metadata at join time — so the group learns about new partitions by rejoining, and nothing else makes it rejoin. Without this, a stable group keeps its old assignment until some unrelated rebalance happens to come along, and the new partitions go unread until then.

Source

pub fn on_join( &mut self, error: i16, generation: i32, member_id: &str, leader_id: &str, members: Vec<Subscription>, ) -> Step

JoinGroup answered.

members is non-empty only for the leader. Returns the next step.

Source

pub fn on_sync(&mut self, error: i16, assigned: Vec<TopicPartition>) -> Step

SyncGroup answered, carrying this member’s assignment.

Source

pub fn on_heartbeat(&mut self, error: i16) -> Step

A Heartbeat answered.

Source

pub fn on_leave(&mut self)

Leaving deliberately, so the group rebalances now rather than at the session timeout.

Source

pub fn my_share(&self, assignment: &Assignment) -> Vec<TopicPartition>

The assignment the leader computed, for the leader’s own SyncGroup.

Trait Implementations§

Source§

impl Clone for GroupMember

Source§

fn clone(&self) -> GroupMember

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GroupMember

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.