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 ¶
- func FeatureLevelDescription(name string, level int16) string
- func VersionStrings() []string
- type VersionGuessOpt
- type Versions
- func FromApiVersionsResponse(r *kmsg.ApiVersionsResponse) *Versions
- func FromString(v string) *Versions
- func Stable() *Versions
- func Tip() *Versions
- func V0_8_0() *Versions
- func V0_8_1() *Versions
- func V0_8_2() *Versions
- func V0_9_0() *Versions
- func V0_10_0() *Versions
- func V0_10_1() *Versions
- func V0_10_2() *Versions
- func V0_11_0() *Versions
- func V1_0_0() *Versions
- func V1_1_0() *Versions
- func V2_0_0() *Versions
- func V2_1_0() *Versions
- func V2_2_0() *Versions
- func V2_3_0() *Versions
- func V2_4_0() *Versions
- func V2_5_0() *Versions
- func V2_6_0() *Versions
- func V2_7_0() *Versions
- func V2_8_0() *Versions
- func V3_0_0() *Versions
- func V3_1_0() *Versions
- func V3_2_0() *Versions
- func V3_3_0() *Versions
- func V3_4_0() *Versions
- func V3_5_0() *Versions
- func V3_6_0() *Versions
- func V3_7_0() *Versions
- func V3_8_0() *Versions
- func V3_9_0() *Versions
- func V4_0_0() *Versions
- func V4_1_0() *Versions
- func V4_2_0() *Versions
- func V4_3_0() *Versions
- func V4_4_0() *Versions
- func (vs *Versions) EachFinalizedFeature(fn func(name string, level int16))
- func (vs *Versions) EachMaxKeyVersion(fn func(k, v int16))
- func (vs *Versions) EachSupportedFeature(fn func(name string, min, max int16))
- func (vs *Versions) Equal(other *Versions) bool
- func (vs *Versions) HasKey(k int16) bool
- func (vs *Versions) LookupMaxKeyVersion(k int16) (int16, bool)
- func (vs *Versions) SetMaxKeyVersion(k, v int16)
- func (vs *Versions) String() string
- func (vs *Versions) VersionGuess(opts ...VersionGuessOpt) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FeatureLevelDescription ¶ added in v1.22.0
FeatureLevelDescription describes one level of a feature in a sentence with the KIP or issue to search for, or returns "" for a level kversion does not know. The wording carries no stability guarantee.
func VersionStrings ¶ added in v1.16.0
func VersionStrings() []string
VersionStrings returns all recognized versions, minus any patch, that can be used as input to FromString.
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.
func TryRaftBroker
deprecated
added in
v0.6.11
func TryRaftBroker() VersionGuessOpt
TryRaftBroker previously attempted to version guess selecting for a raft broker.
Deprecated: Zookeeper, KRaft broker, and KRaft controller are all checked and the best pick is chosen.
func TryRaftController
deprecated
added in
v0.6.11
func TryRaftController() VersionGuessOpt
TryRaftController previously attempted to version guest selecting for a raft controller.
Deprecated: Zookeeper, KRaft broker, and KRaft controller are all checked and the best pick is chosen.
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.
Versions from 3.3 on also carry the KIP-584 features a broker of that release advertises; see EachSupportedFeature and EachFinalizedFeature.
func FromApiVersionsResponse ¶ added in v0.6.2
func FromApiVersionsResponse(r *kmsg.ApiVersionsResponse) *Versions
FromApiVersionsResponse returns a Versions from a kmsg.ApiVersionsResponse. The features are what the response advertised; a response before v3 carries none.
func FromString ¶ added in v1.16.0
FromString returns a Versions from v. The expected input is:
- for v0, v0.#.# or v0.#.#.#
- for v1, v1.# or v1.#.#
The "v" is optional.
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. The stable version is only bumped once kgo internally supports all features in the release.
func Tip ¶
func Tip() *Versions
Tip is the latest defined Kafka key versions; this may be slightly out of date.
func (*Versions) EachFinalizedFeature ¶ added in v1.22.0
EachFinalizedFeature calls fn for each feature and its finalized level. A release finalizes the levels a new cluster is formatted with. If this is from FromApiVersionsResponse, the levels are the cluster's levels. This is empty for a broker that has not learned of finalized cluster features yet.
func (*Versions) EachMaxKeyVersion ¶ added in v0.6.12
EachMaxKeyVersion calls fn for each key and max version
func (*Versions) EachSupportedFeature ¶ added in v1.22.0
EachSupportedFeature calls fn for each feature this version supports, with the lowest and highest level a broker can run. If this is from FromApiVersionsResponse, the levels are what the broker advertised.
func (*Versions) Equal ¶ added in v0.6.2
Equal returns whether two versions are equal. Features are ignored.
func (*Versions) HasKey ¶ added in v0.6.2
HasKey returns true if the versions contains the given key.
func (*Versions) LookupMaxKeyVersion ¶ added in v0.6.2
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
SetMaxKeyVersion sets the max version for the given key. Setting a version to -1 removes the key entirely.
func (*Versions) 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 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.
Internally, this function tries guessing the version against both KRaft and Kafka APIs. The more exact match is returned.