Add python types to represent LSNs, tenant IDs and timeline IDs. (#2351)

For better ergonomics. I always found it weird that we used UUID to
actually mean a tenant or timeline ID. It worked because it happened
to have the same length, 16 bytes, but it was hacky.
This commit is contained in:
Heikki Linnakangas
2022-09-02 10:16:47 +03:00
committed by GitHub
parent f0a0d7bb7a
commit 47bd307cb8
31 changed files with 599 additions and 494 deletions
-11
View File
@@ -61,17 +61,6 @@ def global_counter() -> int:
return _global_counter
def lsn_to_hex(num: int) -> str:
"""Convert lsn from int to standard hex notation."""
return "{:X}/{:X}".format(num >> 32, num & 0xFFFFFFFF)
def lsn_from_hex(lsn_hex: str) -> int:
"""Convert lsn from hex notation to int."""
l, r = lsn_hex.split("/")
return (int(l, 16) << 32) + int(r, 16)
def print_gc_result(row):
log.info("GC duration {elapsed} ms".format_map(row))
log.info(