kversion

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: BSD-3-Clause Imports: 4 Imported by: 20

Documentation

Overview

Package kversion specifies versions for Kafka request keys.

Kafka technically has internal broker versions that bump multiple times per release. This package only defines releases and tip.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VersionGuessOpt added in v0.6.11

type VersionGuessOpt interface {
	// contains filtered or unexported methods
}

VersionGuessOpt is an option to change how version guessing is done.

func SkipKeys added in v0.6.11

func SkipKeys(keys ...int16) VersionGuessOpt

SkipKeys skips the given keys while guessing versions.

The current default is to skip keys that are only used by brokers:

 4: LeaderAndISR
 5: StopReplica
 6: UpdateMetadata
 7: ControlledShutdown
27: WriteTxnMarkers

func TryRaftBroker added in v0.6.11

func TryRaftBroker() VersionGuessOpt

TryRaftBroker changes from guessing the version for a classical ZooKeeper based broker to guessing for a raft based broker (v2.8.0+).

Note that with raft, there can be a TryRaftController attempt as well.

func TryRaftController added in v0.6.11

func TryRaftController() VersionGuessOpt

TryRaftController changes from guessing the version for a classical ZooKeeper based broker to guessing for a raft based controller broker (v2.8.0+).

Note that with raft, there can be a TryRaftBroker attempt as well. Odds are that if you are an end user speaking to a raft based Kafka cluster, you are speaking to a raft broker. The controller is specifically for broker to broker communication.

type Versions

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

Versions is a list of versions, with each item corresponding to a Kafka key and each item's value corresponding to the max version supported.

Minimum versions are not currently tracked because all keys have a minimum version of zero. The internals of a Versions may change in the future to support minimum versions; the outward facing API of Versions should not change to support this.

As well, supported features may be added in the future.

func FromApiVersionsResponse added in v0.6.2

func FromApiVersionsResponse(r *kmsg.ApiVersionsResponse) *Versions

FromApiVersionsResponse returns a Versions from a kmsg.ApiVersionsResponse.

func Stable

func Stable() *Versions

Stable is a shortcut for the latest _released_ Kafka versions.

This is the default version used in kgo to avoid breaking tip changes.

func Tip

func Tip() *Versions

Tip is the latest defined Kafka key versions; this may be slightly out of date.

func V0_10_0

func V0_10_0() *Versions

func V0_10_1

func V0_10_1() *Versions

func V0_10_2

func V0_10_2() *Versions

func V0_11_0

func V0_11_0() *Versions

func V0_8_0

func V0_8_0() *Versions

func V0_8_1

func V0_8_1() *Versions

func V0_8_2

func V0_8_2() *Versions

func V0_9_0

func V0_9_0() *Versions

func V1_0_0

func V1_0_0() *Versions

func V1_1_0

func V1_1_0() *Versions

func V2_0_0

func V2_0_0() *Versions

func V2_1_0

func V2_1_0() *Versions

func V2_2_0

func V2_2_0() *Versions

func V2_3_0

func V2_3_0() *Versions

func V2_4_0

func V2_4_0() *Versions

func V2_5_0

func V2_5_0() *Versions

func V2_6_0

func V2_6_0() *Versions

func V2_7_0 added in v0.6.2

func V2_7_0() *Versions

func V2_8_0 added in v0.6.12

func V2_8_0() *Versions

func V3_0_0 added in v1.1.1

func V3_0_0() *Versions

func V3_1_0 added in v1.4.0

func V3_1_0() *Versions

func V3_2_0 added in v1.6.0

func V3_2_0() *Versions

func V3_3_0 added in v1.8.0

func V3_3_0() *Versions

func V3_4_0 added in v1.12.0

func V3_4_0() *Versions

func (*Versions) EachMaxKeyVersion added in v0.6.12

func (vs *Versions) EachMaxKeyVersion(fn func(k, v int16))

EachMaxKeyVersion calls fn for each key and max version

func (*Versions) Equal added in v0.6.2

func (vs *Versions) Equal(other *Versions) bool

Equal returns whether two versions are equal.

func (*Versions) HasKey added in v0.6.2

func (vs *Versions) HasKey(k int16) bool

HasKey returns true if the versions contains the given key.

func (*Versions) LookupMaxKeyVersion added in v0.6.2

func (vs *Versions) LookupMaxKeyVersion(k int16) (int16, bool)

LookupMaxKeyVersion returns the version for the given key and whether the key exists. If the key does not exist, this returns (-1, false).

func (*Versions) SetMaxKeyVersion added in v0.6.2

func (vs *Versions) SetMaxKeyVersion(k, v int16)

SetMaxKeyVersion sets the max version for the given key.

Setting a version to -1 unsets the key.

Versions are backed by a slice; if the slice is not long enough, it is extended to fit the key.

func (*Versions) String

func (vs *Versions) String() string

String returns a string representation of the versions; the format may change.

func (*Versions) VersionGuess added in v0.6.3

func (vs *Versions) VersionGuess(opts ...VersionGuessOpt) string

VersionGuess attempts to guess which version of Kafka these versions belong to. If an exact match can be determined, this returns a string in the format v0.#.# or v#.# (depending on whether Kafka is pre-1.0.0 or post). For example, v0.8.0 or v2.7.

Patch numbers are not included in the guess as it is not possible to determine the Kafka patch version being used as a client.

If the version is determined to be higher than kversion knows of or is tip, this package returns "at least v#.#".

Custom versions, or in-between versions, are detected and return slightly more verbose strings.

Options can be specified to change how version guessing is performed, for example, certain keys can be skipped, or the guessing can try evaluating the versions as Raft broker based versions.

Jump to

Keyboard shortcuts

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