module documentation

Implementation of the reftable refs storage format.

The reftable format is a binary format for storing Git refs that provides better performance and atomic operations compared to the traditional loose refs format.

See: https://git-scm.com/docs/reftable

Class LogBlock A block containing reflog records - simplified for empty blocks only.
Class RefBlock A block containing reference records.
Class RefRecord A reference record in a reftable.
Class ReftableReader Reader for reftable files.
Class ReftableRefsContainer A refs container backed by the reftable format.
Class ReftableWriter Writer for reftable files.
Class RefUpdate A reference update operation.
Class RefValue A reference value with its type.
Function decode_varint_from_stream Decode a variable-length integer from a stream.
Function encode_varint Encode an integer as a variable-width integer.
Constant BLOCK_TYPE_INDEX Undocumented
Constant BLOCK_TYPE_LOG Undocumented
Constant BLOCK_TYPE_OBJ Undocumented
Constant BLOCK_TYPE_REF Undocumented
Constant CRC_DATA_SIZE Undocumented
Constant DEFAULT_BLOCK_SIZE Undocumented
Constant EMBEDDED_FOOTER_MARKER Undocumented
Constant FINAL_PADDING_SIZE Undocumented
Constant HEADER_SIZE_V1 Undocumented
Constant MAX_REASONABLE_BLOCK_SIZE Undocumented
Constant MAX_REASONABLE_SUFFIX_LEN Undocumented
Constant MAX_SYMREF_DEPTH Undocumented
Constant MIN_RECORD_SIZE Undocumented
Constant REF_VALUE_DELETE Undocumented
Constant REF_VALUE_PEELED Undocumented
Constant REF_VALUE_REF Undocumented
Constant REF_VALUE_SYMREF Undocumented
Constant REFTABLE_MAGIC Undocumented
Constant REFTABLE_VERSION Undocumented
Constant SHA1_BINARY_SIZE Undocumented
Constant SHA1_HEX_SIZE Undocumented
Constant SHA1_PEELED_HEX_SIZE Undocumented
Class _ReftableBatchContext Context manager for batching reftable updates.
Function _decode_ref_value Decode a ref value from stream based on its type.
Function _decode_reftable_suffix_and_type Decode suffix_and_type handling both Git's broken and standard formats.
Function _encode_ref_value Encode a ref value based on its type.
Function _encode_reftable_suffix_and_type Encode suffix_and_type using Git-compatible format.
def decode_varint_from_stream(stream: BinaryIO) -> int | None:

Decode a variable-length integer from a stream.

def encode_varint(value: int) -> bytes:

Encode an integer as a variable-width integer.

BLOCK_TYPE_INDEX: bytes =

Undocumented

Value
b'i'
BLOCK_TYPE_LOG: bytes =

Undocumented

Value
b'g'
BLOCK_TYPE_OBJ: bytes =

Undocumented

Value
b'o'
BLOCK_TYPE_REF: bytes =

Undocumented

Value
b'r'
CRC_DATA_SIZE: int =

Undocumented

Value
64
DEFAULT_BLOCK_SIZE: int =

Undocumented

Value
4096
EMBEDDED_FOOTER_MARKER: int =

Undocumented

Value
28
FINAL_PADDING_SIZE: int =

Undocumented

Value
36
HEADER_SIZE_V1: int =

Undocumented

Value
24
MAX_REASONABLE_BLOCK_SIZE: int =

Undocumented

Value
1000000
MAX_REASONABLE_SUFFIX_LEN: int =

Undocumented

Value
100
MAX_SYMREF_DEPTH: int =

Undocumented

Value
5
MIN_RECORD_SIZE: int =

Undocumented

Value
3
REF_VALUE_DELETE: int =

Undocumented

Value
0
REF_VALUE_PEELED: int =

Undocumented

Value
2
REF_VALUE_REF: int =

Undocumented

Value
1
REF_VALUE_SYMREF: int =

Undocumented

Value
3
REFTABLE_MAGIC: bytes =

Undocumented

Value
b'REFT'
REFTABLE_VERSION: int =

Undocumented

Value
1
SHA1_BINARY_SIZE: int =

Undocumented

Value
20
SHA1_HEX_SIZE: int =

Undocumented

Value
40
SHA1_PEELED_HEX_SIZE: int =

Undocumented

Value
80
def _decode_ref_value(stream: BinaryIO, value_type: int) -> bytes:

Decode a ref value from stream based on its type.

def _decode_reftable_suffix_and_type(stream: BinaryIO) -> int | None:

Decode suffix_and_type handling both Git's broken and standard formats.

def _encode_ref_value(value_type: int, value: bytes) -> bytes:

Encode a ref value based on its type.

def _encode_reftable_suffix_and_type(value: int) -> bytes:

Encode suffix_and_type using Git-compatible format.

Git uses an additive format instead of proper LEB128: - Values < 128: Single byte (standard) - Values >= 128: Two bytes where byte1 + byte2 = value