Skip to content

Commit

Permalink
commit intf file
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Aug 15, 2019
1 parent 473eab9 commit 9bcd976
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions lwt/httpaf_lwt_intf.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
open Httpaf

module type IO = sig
type socket
type addr

(** The region [[off, off + len)] is where read bytes can be written to *)
val read
: socket
-> Bigstringaf.t
-> off:int
-> len:int
-> [ `Eof | `Ok of int ] Lwt.t

val writev
: socket
-> Faraday.bigstring Faraday.iovec list
-> [ `Closed | `Ok of int ] Lwt.t

val shutdown_send : socket -> unit

val shutdown_receive : socket -> unit

val close : socket -> unit Lwt.t
end

module type Server = sig
type socket

type addr

val create_connection_handler
: ?config : Config.t
-> request_handler : (addr -> socket Server_connection.request_handler)
-> error_handler : (addr -> Server_connection.error_handler)
-> addr
-> socket
-> unit Lwt.t
end

module type Client = sig
type t

type socket

val create_connection
: ?config : Config.t
-> socket
-> t Lwt.t

val request
: t
-> Request.t
-> error_handler : Client_connection.error_handler
-> response_handler : Client_connection.response_handler
-> [`write] Body.t

val shutdown: t -> unit

val is_closed : t -> bool
end

0 comments on commit 9bcd976

Please sign in to comment.