Skip to main content

krabka_metadata/
transaction_version.rs

1//! KIP-890 `transaction.version` feature-level constants, matching Kafka's
2//! `TransactionVersion`, which defines `TV_0` to `TV_2` only.
3//!
4//! 0 means classic (KIP-98) non-flexible txn-state records, 1 means flexible
5//! (tagged) txn-state records, and 2 means an epoch bump on completion plus
6//! server-side `AddPartitionsToTxn` verification. Both `TV_1` and `TV_2`
7//! bootstrap at 4.0-IV2.
8//!
9//! KIP-939 two-phase commit is not a transaction version. Kafka gates it on
10//! the broker config `transaction.two.phase.commit.enable` and the
11//! `TWO_PHASE_COMMIT` ACL, and asks for no finalized level beyond `TV_2`.
12
13pub const TRANSACTION_VERSION_FEATURE: &str = "transaction.version";
14pub const TRANSACTION_VERSION_MIN: i16 = 0;
15/// `TransactionVersion.LATEST_PRODUCTION`, `TV_2`, on Kafka 4.3.1 and trunk.
16pub const TRANSACTION_VERSION_MAX: i16 = 2;
17
18/// metadata.version at or above which transaction.version becomes a bootstrap
19/// default.
20///
21/// Both `TV_1` and `TV_2` bootstrap at 4.0-IV2 (level 24), so the per-release
22/// default jumps 0 -> 2 at level 24. This is a bootstrap-default input only,
23/// NOT a hard `UpdateFeatures` dependency.
24pub const TV1_METADATA_LEVEL: i16 = 24; // 4.0-IV2
25pub const TV2_METADATA_LEVEL: i16 = 24; // 4.0-IV2