Files
apple-foundationdb/flow/protocolversion/protocol_version.py.template
Vishesh Yadav fc60c2f221 Bump FoundationDB version to 8.0.0 (#12510)
* Bump FoundationDB version to 8.0.0

* Remove restarting tests for older versions

* Bump PREV to 7.4.5 as 7.4.0 release binaries are missing

* Update protocol version templates

* Ignore couple fdb_c config tests

Expects to miss an API function, but recent two versions don't
have any new API functions. Although, we have removed some in
current version.

* Add 8.0 to transaction_profiling_analyzer
2025-10-28 19:28:46 -07:00

108 lines
3.1 KiB
Plaintext

""" Protocol Version
This code is generated by `protocol_version.py`. Do not modify by hand.
"""
class ProtocolVersion:
_supported_protocol_versions = set()
def __init__(self, version: int):
self._version = version
def __hash__(self):
return hash(self._version)
@property
def _version_flag_mask(self) -> int:
return 0x0FFFFFFFFFFFFFFF
@property
def version(self) -> int:
return self._version & self._version_flag_mask
@property
def compatible_protocol_version_mask(self) -> int:
return 0xFFFFFFFFFFFF0000;
@property
def normalized_version(self) -> "ProtocolVersion":
return ProtocolVersion(self.version & self.compatible_protocol_version_mask)
def is_compatible(self, other: "ProtocolVersion") -> bool:
return (other._version & self.compatible_protocol_version_mask) == (self._version & self.compatible_protocol_version_mask)
def _cmp_(self, other: "ProtocolVersion"):
if self.version > other.version:
return 1
elif self.version == other.version:
return 0
else:
return -1
def __gt__(self, other: "ProtocolVersion"):
return self._cmp_(other) > 0
def __lt__(self, other: "ProtocolVersion"):
return self._cmp_(other) < 0
def __eq__(self, other: "ProtocolVersion"):
return self._cmp_(other) == 0
def __ne__(self, other: "ProtocolVersion"):
return self._cmp_(other) != 0
def __ge__(self, other: "ProtocolVersion"):
return self._cmp_(other) >= 0
def __le__(self, other: "ProtocolVersion"):
return self._cmp_(other) <= 0
def is_supported(self) -> bool:
return self in ProtocolVersion._supported_protocol_versions
{% for version, features in all_features.items() %}
{% for feature in features %}
@property
def has_{{ feature | feature_name_transformer }}(self) -> bool:
return self >= ProtocolVersion({{ version | encode_version }})
@staticmethod
def with_{{ feature | feature_name_transformer }}() -> "ProtocolVersion":
return ProtocolVersion({{ version | encode_version }})
{% endfor %}
{% endfor %}
PROTOCOL_VERSION_5_2 = 0x0FDB00A552000001
PROTOCOL_VERSION_6_0 = 0x0FDB00A570010001
PROTOCOL_VERSION_6_1 = 0x0FDB00B061060001
PROTOCOL_VERSION_6_2 = 0x0FDB00B062010001
PROTOCOL_VERSION_6_3 = 0x0FDB00B063010001
PROTOCOL_VERSION_7_0 = 0x0FDB00B070010001
PROTOCOL_VERSION_7_1 = 0x0FDB00B071010000
PROTOCOL_VERSION_7_2 = 0x0FDB00B072000000
PROTOCOL_VERSION_7_3 = 0x0FDB00B073000000
PROTOCOL_VERSION_7_4 = 0x0FDB00B074000000
PROTOCOL_VERSION_8_0 = 0x0FDB00B080000000
def _module_init():
for raw_version in (
PROTOCOL_VERSION_5_2,
PROTOCOL_VERSION_6_0,
PROTOCOL_VERSION_6_1,
PROTOCOL_VERSION_6_2,
PROTOCOL_VERSION_6_3,
PROTOCOL_VERSION_7_0,
PROTOCOL_VERSION_7_1,
PROTOCOL_VERSION_7_2,
PROTOCOL_VERSION_7_3,
PROTOCOL_VERSION_7_4,
PROTOCOL_VERSION_8_0,
):
ProtocolVersion._supported_protocol_versions.add(ProtocolVersion(raw_version))
_module_init()