bit_reftable

    Git reftable backend

    git
    reftable
    Download zip
    Author
    Version
    0.48.0
    License
    Apache-2.0
    Last updated
    9 days ago
    Downloads
    1K

    RefRecord

    pub(all) struct RefRecord {
    refname : String
    update_index : UInt64
    value : RefValue
    } derive(Eq)

    impl Show for RefRecord

    RefValue

    impl Show for RefValue

    ReftableFooter

    type ReftableFooter derive(Eq,
    Debug
    )

    ReftableHeader

    pub struct ReftableHeader {
    version : Int
    block_size : Int
    min_update_index : UInt64
    max_update_index : UInt64
    } derive(Eq,
    Debug
    )

    collect_reftable_refs

    Collect all refs from reftable (for show-ref, list-refs).

    decode_ref_record

    fn decode_ref_record(data : Bytes, pos : Int, prev_key : String, header : ReftableHeader) -> (RefRecord, Int)?

    Decode a single ref record from a block's data. prev_key is the previous record's refname for prefix decompression. Returns (RefRecord, bytes_consumed).

    decode_varint

    fn decode_varint(data : Bytes, pos : Int) -> (UInt64, Int)

    Decode a varint from bytes at the given position. Returns (value, bytes_consumed).

    encode_varint

    fn encode_varint(out : Array[Byte], value : UInt64) -> Unit

    Encode a varint (LEB128 variant with zero optimization used by reftable).

    iter_refs

    fn iter_refs(tables : Array[Bytes], prefix : String) -> Array[RefRecord]

    Iterate all refs with a given prefix across stacked tables. Latest table wins for duplicate refnames.

    load_tables

    fn load_tables(fs : &
    RepoFileSystem
    , git_dir : String) -> Array[Bytes] raise
    GitError

    Load all reftable files referenced by tables.list.

    lookup_ref

    fn lookup_ref(data : Bytes, refname : String) -> RefRecord?

    Look up a specific ref in a reftable file.

    lookup_ref_in_stack

    fn lookup_ref_in_stack(tables : Array[Bytes], refname : String) -> RefRecord?

    Look up a ref across multiple stacked tables (newest first).
    fn parse_footer(data : Bytes) -> ReftableFooter?

    Parse a reftable footer from the last 68 bytes.

    parse_header

    fn parse_header(data : Bytes) -> ReftableHeader?

    Parse a reftable header from the first 24 bytes.

    read_refs

    fn read_refs(data : Bytes) -> Array[RefRecord]?

    Read all ref records from a single reftable file. Iterates through ref blocks ('r' type) and decodes all records.

    read_tables_list

    fn read_tables_list(fs : &
    RepoFileSystem
    , git_dir : String) -> Array[String] raise
    GitError

    Read the tables.list file and return table filenames.

    reftable_hash_size

    fn reftable_hash_size(algo? :
    HashAlgorithm
    ) -> Int

    Get hash size for the given algorithm (for future SHA-256 reftable v2 support).

    resolve_ref_reftable

    fn resolve_ref_reftable(fs : &
    RepoFileSystem
    , git_dir : String, refname : String) ->
    ObjectId
    ? raise
    GitError

    Resolve a ref through stacked reftable tables, following symrefs.

    write_reftable

    fn write_reftable(records : Array[RefRecord], block_size : Int, min_update_index : UInt64, max_update_index : UInt64) -> Bytes

    Write a complete reftable file from sorted ref records. Records MUST be sorted by refname. Returns the file contents as Bytes.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io