Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file smart_git_intf.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165moduletypeAPPEND=sigtype'ard=<rd:unit;..>as'atype'awr=<wr:unit;..>as'atype'amode=|Rd:<rd:unit>mode|Wr:<wr:unit>mode|RdWr:<rd:unit;wr:unit>modetypettypeuidtype'afdtypeerrortype+'afibervalpp_error:errorFmt.tvalcreate:?trunc:bool->mode:'amode->t->uid->('afd,error)resultfibervalmap:t->'mrdfd->pos:int64->int->Bigstringaf.tvalappend:t->'mwrfd->string->unitfibervalmove:t->src:uid->dst:uid->(unit,error)resultfibervalclose:t->'mfd->(unit,error)resultfiberendmoduletypeUID=sigincludeCarton.UIDincludeSigs.UIDwithtypet:=tvalhash:t->intendmoduletypeHTTP=sigtypeerrorvalpp_error:errorFmt.tvalget:ctx:Mimic.ctx->?headers:(string*string)list->Uri.t->(unit*string,error)resultLwt.tvalpost:ctx:Mimic.ctx->?headers:(string*string)list->Uri.t->string->(unit*string,error)resultLwt.tendmoduletypeSMART_GIT=sigmoduletypeAPPEND=APPENDmoduletypeUID=UIDmoduletypeHTTP=HTTPmoduleEndpoint:sigtypet=private{scheme:[`SSHofstring|`Git|`HTTPof(string*string)list|`HTTPSof(string*string)list|`Schemeofstring];port:intoption;path:string;hostname:string;}valpp:tFmt.tvalof_string:string->(t,[>`Msgofstring])resultvalwith_headers_if_http:(string*string)list->t->t(** [with_headers_if_http hdrs edn] if endpoint [edn] is [`HTTP] or [`HTTPS]
adds [hdrs] to [edn] *)valto_ctx:t->Mimic.ctx->Mimic.ctxend(** {3 Mimic values.}
When the user use an [Endpoint.t] to {!Make.fetch} or {!Make.push}, we fill the given Mimic's [ctx]
with some available informations such as:
- if we want to {!Make.fetch} ([`Rd]) or {!Make.push} ([`Wr])
- the scheme/protocol that the user would like to use ([git://], SSH or HTTP - with or without TLS)
- the path of the git repository
- the host (an IP adress or a domain name)
- the SSH user iff the user would like to use SSH
- the port that the user would like to use
From this informations, the {b end}-user can process them through the Mimic API (with {!Mimic.fold})
and describe how to create needed values to start {i a} protocol from them.
For example, if the user wants to use [mirage-tcpip] which needs an IP address and a port,
he is able to re-use/map/fold {!git_host} and {!git_port} to craft what [mirage-tcpip]
really needs.
Of course, such job is definitely outside the scope of [ocaml-git] and permits to us to be free
about protocol implementations. An example of the plumbing needed is able with [git-mirage] which
re-use these values to be able to start a [mirage-tcpip] connection, a [awa-ssh] connection
of a [cohttp] (with or without [ocaml-tls]) connection. *)typehandshake=uri0:Uri.t->uri1:Uri.t->Mimic.flow->unitLwt.tvalgit_capabilities:[`Rd|`Wr]Mimic.valuevalgit_scheme:[`Git|`SSH|`HTTP|`HTTPS|`Schemeofstring]Mimic.valuevalgit_path:stringMimic.valuevalgit_hostname:stringMimic.valuevalgit_ssh_user:stringMimic.valuevalgit_port:intMimic.valuevalgit_http_headers:(string*string)listMimic.valuevalgit_transmission:[`Git|`Exec|`HTTPofUri.t*handshake]Mimic.valuevalgit_uri:Uri.tMimic.valuemoduleMake(Scheduler:Sigs.SCHEDwithtype+'as='aLwt.t)(Pack:APPENDwithtype+'afiber='aLwt.t)(Index:APPENDwithtype+'afiber='aLwt.t)(Uid:UID)(Ref:Sigs.REF):sigvalfetch:?push_stdout:(string->unit)->?push_stderr:(string->unit)->?bounds:int->?threads:int->ctx:Mimic.ctx->(Uid.t,_,Uid.t*intref*int64,'g,Scheduler.t)Sigs.access*Uid.tCarton_lwt.Thin.light_load*Uid.tCarton_lwt.Thin.heavy_load->(Uid.t,Uid.t*intref*int64,'g)Sigs.store->Endpoint.t->?version:[>`V1]->?capabilities:Smart.Capability.tlist->?deepen:[`Depthofint|`Timestampofint64]->[`All|`SomeofRef.tlist|`None]->Pack.t->Index.t->src:Pack.uid->dst:Pack.uid->idx:Index.uid->([`PackofUid.t*(Ref.t*Uid.t)list|`Empty],([>`Exnofexn|Mimic.error]as'err))resultLwt.tvalpush:ctx:Mimic.ctx->(Uid.t,Ref.t,Uid.tPck.t,'g,Scheduler.t)Sigs.access*Uid.tCarton_lwt.Thin.light_load*Uid.tCarton_lwt.Thin.heavy_load->(Uid.t,Uid.tPck.t,'g)Sigs.store->Endpoint.t->?version:[>`V1]->?capabilities:Smart.Capability.tlist->[`CreateofRef.t|`DeleteofRef.t|`UpdateofRef.t*Ref.t]list->(unit,([>`Exnofexn|Mimic.error]as'err))resultLwt.tendend