package git

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

The functor to make the Decoder by a specific hash implementation.

Parameters

module Hash : sig ... end
module Reference : Reference.S with module Hash := Hash
module Common : COMMON with type hash := Hash.t and type reference := Reference.t

Signature

type decoder

The type decoder.

val pp_decoder : decoder Fmt.t

Pretty-printer of decoder.

val extract_payload : decoder -> Cstruct.t
type error = [
  1. | `Expected_char of char
    (*

    Appears when we encountered an other character than what we expected stricly.

    *)
  2. | `Unexpected_char of char
    (*

    Appears when we encountered a character and we don't know what we can do with this.

    *)
  3. | `Unexpected_flush_pkt_line
    (*

    Appears when we encountered a flush packet and we don't expect this.

    *)
  4. | `No_assert_predicate of char -> bool
    (*

    Appears when one character does not respect the predicate.

    *)
  5. | `Expected_string of string
    (*

    Appears when we don't have strictly the string expected.

    *)
  6. | `Unexpected_empty_pkt_line
    (*

    Appears when we encountered an empty packet and we don't expect this.

    *)
  7. | `Malformed_pkt_line
    (*

    Appears when we encountered a flow which does not respect the packet format.

    *)
  8. | `Unexpected_end_of_input
  9. | `Unexpected_pkt_line
  10. | `Unexpected_hashes of Hash.t * Hash.t
]

The type error.

val pp_error : error Fmt.t

Pretty-printer of error.

type 'a state =
  1. | Ok of 'a
    (*

    The end value of the decoding.

    *)
  2. | Read of {
    1. buffer : Cstruct.t;
    2. off : int;
    3. len : int;
    4. continue : int -> 'a state;
    }
    (*

    Means that we expect an input. We provide an Cstruct.t with an offset and a length. The client is able to Cstruct.blit the input in this range. Then, he can call continue with how many byte(s) he read.

    *)
  3. | Error of {
    1. err : error;
    2. buf : Cstruct.t;
    3. committed : int;
    }
    (*

    When we retrieve an error, we return this value with how many byte(s) we processed and the current input.

    *)
type _ transaction =
  1. | HttpReferenceDiscovery : string -> (Common.advertised_refs, [ `Msg of string ]) result transaction
  2. | ReferenceDiscovery : (Common.advertised_refs, [ `Msg of string ]) result transaction
  3. | ShallowUpdate : Common.shallow_update transaction
  4. | Negociation : Hash.Set.t * ack_mode -> Common.acks transaction
  5. | NegociationResult : Common.negociation_result transaction
  6. | PACK : side_band -> flow transaction
  7. | ReportStatus : string list * side_band -> Common.report_status transaction
  8. | HttpReportStatus : string list * side_band -> Common.report_status transaction
  9. | Upload_request : Common.upload_request transaction
  10. | Git_proto_request : Common.git_proto_request transaction
  11. | Update_request : Common.update_request transaction

The type transaction to describe what is expected to decode/receive.

and ack_mode = [
  1. | `Ack
  2. | `Multi_ack
  3. | `Multi_ack_detailed
]

The ACK mode type to describe which mode is shared by the client and the server.

and flow = [
  1. | `Raw of Cstruct.t
  2. | `End
  3. | `Err of Cstruct.t
  4. | `Out of Cstruct.t
]

The representation of the output side-band.

and side_band = [
  1. | `Side_band
  2. | `Side_band_64k
  3. | `No_multiplexe
]

The side-band mode type to describe which mode is shared by the client and the server.

val decode : decoder -> 'result transaction -> 'result state

decode decoder transaction decodes the input represented by decoder in the way of the transaction and returns the value expected and described by transaction or an error.

val decoder : unit -> decoder

decoder () makes a new decoder.

val of_string : string -> 'v transaction -> ('v, error * Cstruct.t * int) result
OCaml

Innovation. Community. Security.