Module type Smart.CLIENT

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
module Decoder : DECODER with module Hash := Hash and module Reference := Reference and module Common := Common

The Decoder module constrained by the same Hash module.

module Encoder : ENCODER with module Hash := Hash and module Reference := Reference and module Common := Common

The Encoder module constrained by the same Hash module.

type context

The type context.

val capabilities : context -> Capability.t list

capabilities context returns the current shared capabilities between the client and the server.

val set_capabilities : context -> Capability.t list -> unit

set_capabilities context cs sets the current capabilities of the context.

type result = [
| `Refs of Common.advertised_refs
| `ShallowUpdate of Common.shallow_update
| `Negociation of Common.acks
| `NegociationResult of Common.negociation_result
| `PACK of Decoder.flow
| `Flush
| `Nothing
| `ReadyPACK of Cstruct.t
| `ReportStatus of Common.report_status
| `SmartError of string
]

The possible repsonse of the server.

type process = [
| `Read of Cstruct.t * int * int * (int -> process)
| `Write of Cstruct.t * int * int * (int -> process)
| `Error of Decoder.error * Cstruct.t * int
| result
]

The expected actions by the context.

val encode : Encoder.action -> (context -> process) -> context -> process

encode action k ctx starts to encode an action in the context ctx and call k at the end of the encoding.

val decode : 'a Decoder.transaction -> ('a -> context -> process) -> context -> process

decode t k ctx starts to decode an expected Decoder.transaction t and call k at the end of the decoding.

val pp_result : result Fmt.t

Pretty-print of result.

type action = [
| `GitProtoRequest of Common.git_proto_request
| `Shallow of Hash.t list
| `UploadRequest of Common.upload_request
| `UpdateRequest of Common.update_request
| `Has of Hash.Set.t
| `Done
| `Flush
| `ReceivePACK
| `SendPACK of int
| `FinishPACK of Reference.Set.t
]

Close to Encoder.action but more exhaustive and context-dependant.

val run : context -> action -> process

run ctx action sends an action to the server and schedule a specific Decoder.transaction then.

context request makes a new context and the continuation of the transport.