kazoo

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model represent Kafka consumer group data model stored in ZooKeeper. It provides high level functions to deal with group member subscriptions and topic partition ownership. A model is bound to a particular member of a particular consumer group.

func NewModel

func NewModel(zkConn *zk.Conn, chroot, group, memberID string, log *logrus.Entry) Model

NewModel creates a model instance bound to a member of a consumer group.

func (*Model) CreatePartitionOwner

func (m *Model) CreatePartitionOwner(topic string, partition int32) error

CreatePartitionOwner creates a partition owner znode, but only if none exists for the given topic-partition. An error is returned if a partition owner znode exists but belongs to another member.

func (*Model) DeleteGroupIfEmpty

func (m *Model) DeleteGroupIfEmpty() error

DeleteGroupIfEmpty deletes group data structures in ZooKeeper, if it is empty.

func (*Model) DeletePartitionOwner

func (m *Model) DeletePartitionOwner(topic string, partition int32) error

DeletePartitionOwner deletes a partition owner znode, but only if belongs to the bound member, an error is returned otherwise.

func (*Model) EnsureMemberSubscription

func (m *Model) EnsureMemberSubscription(topics []string) error

EnsureMemberSubscription creates, updates or even deletes a member specification znode to ensure that the bound member is subscribed to the given topics.

func (*Model) FetchGroupSubscriptions

func (m *Model) FetchGroupSubscriptions() (map[string][]string, <-chan none.T, context.CancelFunc, error)

FetchGroupSubscriptions retrieves bound group member specification records and returns memberID-to-topic-list map, along with a channel that will be sent a message when either the number of members or subscription of any of them changes.

func (*Model) GetPartitionOwner

func (m *Model) GetPartitionOwner(topic string, partition int32) (string, error)

Jump to

Keyboard shortcuts

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