Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discoverer ¶
type Discoverer interface { Initializer Closer TopologyGetter // Adds a listener that will be invoked when there are changes in the number of replicas change. // The func will be invoked using in a single thread, if there are multiple changes it will be invoked sequentially RegisterListener(l TopologyChangeListener) }
Discoverer provides the cluster topology information.
It emits events that others like Gossipper listens to.
func NewDiscoverer ¶
func NewDiscoverer(config conf.DiscovererConfig, localDb localdb.Client) Discoverer
type GenerationState ¶
type GenerationState interface { // Generation gets a snapshot of the active generation by token. // This is part of the hot path. Generation(token Token) *Generation // GenerationInfo gets the information of a past committed generation. // Returns nil when not found. GenerationInfo(id GenId) *Generation // For an old generation, get's the following generation (or two in the case of split). // Returns nil when not found. NextGeneration(id GenId) []Generation // GenerationProposed reads a snapshot of the current committed and proposed generations GenerationProposed(token Token) (committed *Generation, proposed *Generation) // SetProposed compares and sets the proposed/accepted generation. // It's possible to accept multiple generations in the same operation by providing gen2. // // Checks that the previous tx matches or is nil. // Also checks that provided gen.version is equal to committed plus one. SetGenerationProposed(gen *Generation, gen2 *Generation, expectedTx *UUID) error // SetAsCommitted sets the transaction as committed, storing the history and // setting the proposed generation as committed // // Returns an error when transaction does not match SetAsCommitted(token1 Token, token2 *Token, tx UUID, origin int) error // Sets the transaction as committed, storing the history, without checking proposed values. // This can only be called when no other concurrent changes can be made to the generations. // // Returns an error when the data could not be persisted RepairCommitted(gen *Generation) error // Determines whether there's active range containing (but not starting) the token IsTokenInRange(token Token) bool // Determines whether there's history matching the token HasTokenHistory(token Token, clusterSize int) (bool, error) // Gets the last known committed token from the local persistence GetTokenHistory(token Token, clusterSize int) (*Generation, error) // Gets the parent token and range for any given token+range based on the generation information // For example: T3/0 -> T0/2. // When there is no parent, it returns a nil slice ParentRanges(gen *Generation, indices []RangeIndex) []GenerationRanges }
type TopologyChangeListener ¶
type TopologyChangeListener interface {
OnTopologyChange(previousTopology *TopologyInfo, newTopology *TopologyInfo)
}
type TopologyGetter ¶
type TopologyGetter interface { GenerationState // Leader gets the current leader and followers of a given partition key. // // In case partitionKey is empty, the current node is provided Leader(partitionKey string) ReplicationInfo // LocalInfo returns the information of the current broker (self) LocalInfo() *BrokerInfo // Returns broker information from current or previous topology CurrentOrPastBroker(ordinal int) *BrokerInfo // Returns a point-in-time list of all brokers and local info. Topology() *TopologyInfo // Returns a point-in-time list of all brokers. // // The slice is sorted in natural order (i.e. 0, 3, 1, 4, 2, 5) Brokers() []BrokerInfo }
Click to show internal directories.
Click to hide internal directories.