pub struct GroupMember { /* private fields */ }Expand description
One member of one group.
Implementations§
Source§impl GroupMember
impl GroupMember
pub fn new(group_id: impl Into<String>, topics: Vec<String>) -> Self
Sourcepub fn with_protocol(self, protocol: RebalanceProtocol) -> Self
pub fn with_protocol(self, protocol: RebalanceProtocol) -> Self
Use the cooperative protocol (KIP-429) rather than the eager one.
pub fn protocol(&self) -> RebalanceProtocol
Sourcepub fn lost(&self) -> &[TopicPartition]
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.
pub fn group_id(&self) -> &str
pub fn state(&self) -> MemberState
pub fn generation(&self) -> i32
pub fn member_id(&self) -> &str
pub fn is_leader(&self) -> bool
Sourcepub fn assignment(&self) -> &[TopicPartition]
pub fn assignment(&self) -> &[TopicPartition]
What this member currently owns. Empty unless MemberState::Stable.
Sourcepub fn can_commit(&self) -> bool
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.
Sourcepub fn subscription(&self) -> Subscription
pub fn subscription(&self) -> Subscription
The subscription this member sends in JoinGroup.
Sourcepub fn set_topics(&mut self, topics: Vec<String>)
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.
Sourcepub fn request_rejoin(&mut self)
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.
Sourcepub fn on_join(
&mut self,
error: i16,
generation: i32,
member_id: &str,
leader_id: &str,
members: Vec<Subscription>,
) -> Step
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.
Sourcepub fn on_sync(&mut self, error: i16, assigned: Vec<TopicPartition>) -> Step
pub fn on_sync(&mut self, error: i16, assigned: Vec<TopicPartition>) -> Step
SyncGroup answered, carrying this member’s assignment.
Sourcepub fn on_heartbeat(&mut self, error: i16) -> Step
pub fn on_heartbeat(&mut self, error: i16) -> Step
A Heartbeat answered.
Sourcepub fn on_leave(&mut self)
pub fn on_leave(&mut self)
Leaving deliberately, so the group rebalances now rather than at the session timeout.
The assignment the leader computed, for the leader’s own SyncGroup.
Trait Implementations§
Source§impl Clone for GroupMember
impl Clone for GroupMember
Source§fn clone(&self) -> GroupMember
fn clone(&self) -> GroupMember
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more