package resto-directory

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type ('o, 'e) t = [
  1. | `Ok of 'o
  2. | `OkChunk of 'o
  3. | `OkStream of 'o stream
  4. | `Created of string option
  5. | `No_content
  6. | `Unauthorized of 'e option
  7. | `Forbidden of 'e option
  8. | `Not_found of 'e option
  9. | `Conflict of 'e option
  10. | `Gone of 'e option
  11. | `Error of 'e option
]

Return type for service handler

Note about the three distinct 200-code constructors:

  • `Ok is for RPCs that return a value that the server should encode as one blob of data. This should be the most common answer for successful returns of simple, reasonably-sized values.
  • `OkChunk is for RPCs that return a value that the server should encode as chunks: multiple blobs, the concatenation of which represents the data. This should be reserved for values that can be fairly large (typically over 4Kb, but this threshold may vary depending on your setup). Data is then transferred using chunked transfer encoding.
  • `OkStream is for RPCs that return a stream of values, not all of which are determined at the time of call.
and 'a stream = {
  1. next : unit -> 'a option Lwt.t;
  2. shutdown : unit -> unit;
}
val return : 'o -> ('o, 'e) t Lwt.t
val return_stream : 'o stream -> ('o, 'e) t Lwt.t