package async_durable

  1. Overview
  2. Docs

This module is designed to help processess maintain update subscriptions that will automatically recover from lost connections. It exposes to the client when the subscription has been lost or recovered, so the client can choose how to handle a lost connection.

module Update : sig ... end
val create : ?time_source:Async_kernel.Time_source.t -> Async_rpc_kernel.Rpc.Connection.t Async_durable__.Durable.t -> ('query, 'response, 'error) Async_rpc_kernel.Rpc.Pipe_rpc.t -> query:'query -> resubscribe_delay:Core.Time.Span.t -> ('response, 'error) Update.t Async_kernel.Pipe.Reader.t

create will immediately dispatch the the supplied Rpc.Pipe_rpc.t with query over the Rpc.Connection.t Async_durable.t. If a connection attempt fails or if the subscription closes, it waits resubscribe_delay and dispatches again to create a new subscription. The pipe returned by create contains all the responses that come over the internal subscription, as well as updates about the state of the t.

Closing the returned pipe will permanently close the subscription.

val create_or_fail : ?time_source:Async_kernel.Time_source.t -> Async_rpc_kernel.Rpc.Connection.t Async_durable__.Durable.t -> ('query, 'response, 'error) Async_rpc_kernel.Rpc.Pipe_rpc.t -> query:'query -> resubscribe_delay:Core.Time.Span.t -> (('response, 'error) Update.t Async_kernel.Pipe.Reader.t, 'error) Core.Result.t Core.Or_error.t Async_kernel.Deferred.t

create_or_fail will return an Error e if the initial attempt to dispatch the supplied Rpc.Pipe_rpc.t does not succeed, or an Ok (Error 'error) if the initial dispatch returns a server side rpc error.

create_versioned, create_or_fail_versioned, create_versioned', create_or_fail_versioned' are identical to create and create_or_fail but work for Caller_converts and Both_converts Versioned Pipe RPCs.

val create_versioned : ?time_source:Async_kernel.Time_source.t -> Async_rpc_kernel.Versioned_rpc.Connection_with_menu.t Async_durable__.Durable.t -> (module Async_rpc_kernel.Versioned_rpc.Both_convert.Pipe_rpc.S with type caller_error = 'error and type caller_query = 'query and type caller_response = 'response) -> query:'query -> resubscribe_delay:Core.Time.Span.t -> ('response Core.Or_error.t, 'error) Update.t Async_kernel.Pipe.Reader.t
val create_versioned' : ?time_source:Async_kernel.Time_source.t -> Async_rpc_kernel.Versioned_rpc.Connection_with_menu.t Async_durable__.Durable.t -> (module Async_rpc_kernel.Versioned_rpc.Caller_converts.Pipe_rpc.S with type error = 'error and type query = 'query and type response = 'response) -> query:'query -> resubscribe_delay:Core.Time.Span.t -> ('response Core.Or_error.t, 'error) Update.t Async_kernel.Pipe.Reader.t
val create_or_fail_versioned : ?time_source:Async_kernel.Time_source.t -> Async_rpc_kernel.Versioned_rpc.Connection_with_menu.t Async_durable__.Durable.t -> (module Async_rpc_kernel.Versioned_rpc.Both_convert.Pipe_rpc.S with type caller_error = 'error and type caller_query = 'query and type caller_response = 'response) -> query:'query -> resubscribe_delay:Core.Time.Span.t -> (('response Core.Or_error.t, 'error) Update.t Async_kernel.Pipe.Reader.t, 'error) Core.Result.t Core.Or_error.t Async_kernel.Deferred.t
val create_or_fail_versioned' : ?time_source:Async_kernel.Time_source.t -> Async_rpc_kernel.Versioned_rpc.Connection_with_menu.t Async_durable__.Durable.t -> (module Async_rpc_kernel.Versioned_rpc.Caller_converts.Pipe_rpc.S with type error = 'error and type query = 'query and type response = 'response) -> query:'query -> resubscribe_delay:Core.Time.Span.t -> (('response Core.Or_error.t, 'error) Update.t Async_kernel.Pipe.Reader.t, 'error) Core.Result.t Core.Or_error.t Async_kernel.Deferred.t
OCaml

Innovation. Community. Security.