Up

module Packed_value

: sig

Packed values.

#
type copy = {
# offset
: int;
# length
: int;
}

Copy arguments.

#
type hunk =
# | Insert of string
# | Copy of copy
(*A delta hunk can either insert a string of copy the contents of a base object.*)
#
type 'a delta = {
# source
: 'a;
# source_length
: int;
# result_length
: int;
# hunks
: hunk list;
}

Delta objects.

#
type t =
# | Raw_value of string
# | Ref_delta of SHA.t delta
# | Off_delta of int delta
(*Packed values.*)
#
val pretty : t -> string

Human readable representation of a packed value.

#
module V2 : sig
include Object.S with type t := t
#
val crc32 : t -> int32

Return the CRC-32 of the packed value. Useful when creating pack index files.

end
#
module V3 : sig
include Object.S with type t := t
#
val crc32 : t -> int32

Return the CRC-32 of the packed value. Useful when creating pack index files.

end
#
val result_length : t -> int

Return the lenght of the result object.

#
val source_length : t -> int

Return the lenght of the base (source) object.

Conversion to values

#
val add_hunk : Buffer.t -> source:string -> pos:int -> hunk -> unit

Append a hunk to a buffer. source is the original object the hunk refers to (with the given offset).

#
val add_delta : Buffer.t -> string delta -> unit

Append a delta to a buffer.

#
val add_inflated_value : read:(SHA.t -> string Lwt.t) -> offsets:SHA.t Misc.IntMap.t -> pos:int -> Buffer.t -> t -> unit Lwt.t

Append the inflated representation of a packed value to a given buffer. Use the same paramaters as to_value.

#
val add_inflated_value_sync : read:(SHA.t -> string) -> offsets:SHA.t Misc.IntMap.t -> pos:int -> Buffer.t -> t -> unit

Same as add_inflated_value but with a synchronous read function.

Position independant packed values

#
module PIC : sig

Position-independant packed values.

#
type kind =
# | Raw of string
#
type t = {
# kind
: kind;
# sha1
: SHA.t;
}
#
val pretty : t -> string

Human readable representation.

#
val to_value : t -> Value.t

to_value p unpacks the packed position-independant value p.

#
val raw : SHA.t -> Cstruct.t -> t

Build a raw value.

#
module Map : Map.S with type key = t
end
#
val to_pic : PIC.t Misc.IntMap.t -> PIC.t SHA.Map.t -> int * SHA.t * t -> PIC.t

Position-independant packed value. Convert Off_delta and Ref_delta to PIC.Link using the provided indexes.

#
val of_pic : int PIC.Map.t -> pos:int -> PIC.t -> t

Position dependent packed value. Convert a PIC.Link into to the corresponding Off_delta, using the provided indexes.

end