package carton

  1. Overview
  2. Docs

First-pass of a PACK file.

From a stream, it is possible to infer information needed then to apply a second analyse to extract all objects of a the given PACK file. From Git, this pass appears when the client clone/fetch and the program counts how many objects the PACK file has.

$ git clone ...
remote: Enumerating objects: 105, done.
remote: Counting objects: 100% (105/105), done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 305 (delta 41), reused 75 (delta 23), pack-reused 200
Receiving objects: 100% (305/305), 104.46 KiB | 0 bytes/s, done. # first pass

Parameters

module Uid : sig ... end

Signature

type optint = Optint.t
type kind =
  1. | Base of [ `A | `B | `C | `D ]
  2. | Ofs of {
    1. sub : int;
    2. source : weight;
    3. target : weight;
    }
  3. | Ref of {
    1. ptr : Uid.t;
    2. source : weight;
    3. target : weight;
    }
    (*

    Type of PACK objects.

    *)
type entry = {
  1. offset : int64;
    (*

    Absolute offset into the given PACK file.

    *)
  2. kind : kind;
    (*

    Kind of the object.

    *)
  3. size : weight;
    (*

    Length of the inflated object.

    *)
  4. consumed : int;
    (*

    Length of the deflated object (as it is into the PACK file).

    *)
  5. crc : optint;
    (*

    Check-sum of the entry (header plus the deflated object).

    *)
}

Type of a PACK entry.

val check_header : 's Carton__.Sigs.scheduler -> ('fd, 's) read -> 'fd -> (int * string * int, 's) Carton__.Sigs.io
type decoder

The type for decoders.

type src = [
  1. | `Channel of in_channel
  2. | `String of string
  3. | `Manual
]

The type for input sources. With a `Manual source the client must provide input with src.

type decode = [
  1. | `Await of decoder
  2. | `Peek of decoder
  3. | `Entry of entry * decoder
  4. | `End of Uid.t
  5. | `Malformed of string
]
type header =
  1. | Consumed of Bigstringaf.t
  2. | None
val decoder : o:Bigstringaf.t -> allocate:(int -> De.window) -> src -> decoder
val decode : decoder -> decode
val number : decoder -> int
val version : decoder -> int
val count : decoder -> int
val src_rem : decoder -> int
val src : decoder -> Bigstringaf.t -> int -> int -> decoder
OCaml

Innovation. Community. Security.