Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State tracks which partitions a node is waiting to receive data for. Used to delay rebalance ACK until initial sync is complete.
Each tracked partition records when it first became pending. A partition counts as pending only while its escape deadline has not elapsed: one that never receives data (legitimately empty on the source) escapes once its deadline passes and stays escaped, no matter how often the routing table is reconciled, because Reconcile preserves the original timestamps. Cluster churn faster than the escape delay therefore cannot starve the rebalance ACK, and expired entries are kept (not deleted) so a subsequent Reconcile cannot resurrect them with a fresh clock.
func (*State) Done ¶
func (s *State) Done() <-chan struct{}
Done returns a channel that closes when initial sync is complete.
func (*State) Expired ¶ added in v0.3.19
Expired reports whether partID is tracked and has outlived its escape deadline. Such a partition no longer holds back PendingEmpty.
func (*State) MarkReceived ¶
MarkReceived marks partition partID as having received data, whether or not it is tracked yet: a mark that precedes the Reconcile of an ongoing install keeps that Reconcile from tracking the partition.
func (*State) PendingEmpty ¶
PendingEmpty returns true if no partition is effectively pending receive: every tracked partition either received data or outlived its escape deadline.
func (*State) Reconcile ¶ added in v0.3.14
Reconcile rebuilds the tracked set from the given partition IDs, which were found empty by a scan taken at scannedAt. Call when the routing table is updated. Partitions already tracked keep their original timestamp (their escape clock never restarts, even after it has expired), new ones start now, entries not in partitionIDs are dropped, and a partition that received data after scannedAt is not tracked: it was delivered while the table was being installed, see receivedAt.
escape is the per-partition deadline after which a tracked partition that received no data stops counting as pending; escape <= 0 disables expiry, so only MarkReceived clears entries.
Closes the previous Done channel to wake any waiters so they can re-check or wait on the new cycle. If nothing is effectively pending, signals done immediately.