extenders

package
v0.0.0-...-e78f20e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalancedExtender

type BalancedExtender struct {
	// contains filtered or unexported fields
}

BalancedExtender adds extra partition assignments in a "balanced" way. The current algorithm is:

for each new partition:

set the leader rack to the next rack in the cycle
choose the leader using the picker
for each follower:
  set the rack to either the same one as the leader (if inRack true) or the next one in the
    cycle (if inRack false)
  pick the follower using the picker

func NewBalancedExtender

func NewBalancedExtender(
	brokers []admin.BrokerInfo,
	inRack bool,
	picker pickers.Picker,
) *BalancedExtender

NewBalancedExtender returns a new BalancedExtender instance.

func (*BalancedExtender) Extend

func (b *BalancedExtender) Extend(
	topic string,
	curr []admin.PartitionAssignment,
	extraPartitions int,
) ([]admin.PartitionAssignment, error)

Extend returns partition assignments for the extension of the argument topic.

type Extender

type Extender interface {
	Extend(
		topic string,
		currAssignments []admin.PartitionAssignment,
		newPartitions int,
	) ([]admin.PartitionAssignment, error)
}

Extender is an interface for structs that determine how to add new partitions to an existing topic.

type StaticExtender

type StaticExtender struct {
	Assignments []admin.PartitionAssignment
}

StaticExtender is an Extender that ignores the current state and assigns based on the value of the Assignments field. Generally intended for testing purposes.

func (*StaticExtender) Extend

func (s *StaticExtender) Extend(
	topic string,
	curr []admin.PartitionAssignment,
	newPartitions int,
) ([]admin.PartitionAssignment, error)

Extend returns partition assignments for the extension of the argument topic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL