package conduit-lwt

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

Module Resolver_lwtSource

Resolve URIs to endpoints using the Lwt library

Sourcemodule IO : Conduit.IO with type 'a t = 'a Lwt.t

IO module compatible with Conduit.IO that uses Lwt

Sourcemodule type S = Resolver.S with type svc = Resolver.service and type 'a io = 'a Lwt.t

Module type that specialises Conduit.RESOLVER to use Lwt threads

include S
Sourcetype 'a io = 'a Lwt.t

Abstract type of the cooperative threading library used, normally defined via the IO module type

Sourcetype t

State handle for a running resolver

include Sexplib0.Sexpable.S with type t := t
Sourceval t_of_sexp : Sexplib0.Sexp.t -> t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t

Abstract type for a service entry, which maps a URI scheme into a protocol handler and TCP port

Sourceval sexp_of_svc : svc -> Sexplib0.Sexp.t
Sourceval svc_of_sexp : Sexplib0.Sexp.t -> svc
Sourcetype rewrite_fn = svc -> Uri.t -> Conduit.endp io

A rewrite function resolves a service and a URI into a concrete endpoint.

Sourcetype service_fn = string -> svc option io

A service function maps the string (such as http or ftp) from a URI scheme into a service description that includes enough metadata about the service to subsequently resolve it into an endpoint.

f ++ g is the composition of the service functions f and g.

Sourceval init : ?service:service_fn -> ?rewrites:(string * rewrite_fn) list -> unit -> t

init ?service ?rewrites will initialize the resolver and return a state handler. The service argument should contain the system-specific resolution mechanism for URI schemas.

The rewrites argument can optionally override a subset of the URI domain name with the given rewrite_fn to permit custom resolution rules. For example, a rewrite rule for ".xen" would let the rewrite function resolve hostnames such as "foo.xen" into a shared memory channel for the "foo" virtual machine.

Sourceval add_rewrite : host:string -> f:rewrite_fn -> t -> unit

add_rewrite ~host f t will add to the t resolver the f rewrite rule for all the domain names that shortest-prefix match host

Sourceval set_service : f:service_fn -> t -> unit
Sourceval service : t -> service_fn

service t is the function which is called when trying to resolve a hostname with t.

Sourceval resolve_uri : ?rewrites:(string * rewrite_fn) list -> uri:Uri.t -> t -> Conduit.endp io

resolve_uri ?rewrites ~uri t will use t to resolve the uri into a concrete endpoint. Any rewrites that are passed in will be overlayed on the existing rules within the t resolver, but not otherwise modify it.

OCaml

Innovation. Community. Security.