async_js
A small library that provide Async support for JavaScript platforms
1024" x-on:close-sidebar="sidebar=window.innerWidth > 1024 && true">
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
val create :
name:string ->
version:int ->
bin_query:'query Bin_prot.Type_class.t ->
bin_response:'response Bin_prot.Type_class.t ->
( 'query, 'response ) t
val name : ( _, _ ) t -> string
the same values as were passed to create.
val version : ( _, _ ) t -> int
val description : ( _, _ ) t -> Description.t
val query_type_id : ( 'query, _ ) t -> 'query Core.Type_equal.Id.t
val response_type_id : ( _, 'response ) t -> 'response Core.Type_equal.Id.t
val bin_query : ( 'query, _ ) t -> 'query Bin_prot.Type_class.t
val bin_response : ( _, 'response ) t -> 'response Bin_prot.Type_class.t
val implement :
?on_exception:On_exception.t ->
( 'query, 'response ) t ->
( 'connection_state -> 'query -> 'response Async_kernel.Deferred.t ) ->
'connection_state Implementation.t
If the function that implements the RPC raises, the implementer does not see the exception. Instead, it is sent as an error to the caller of the RPC, i.e. the process that called dispatch
or one of its alternatives.
val implement' :
?on_exception:On_exception.t ->
( 'query, 'response ) t ->
( 'connection_state -> 'query -> 'response ) ->
'connection_state Implementation.t
implement'
is different from implement
in that:
1. 'response
is immediately serialized and scheduled for delivery to the RPC dispatcher.
2. Less allocation happens, as none of the Async-related machinery is necessary.
implement
also tries to do 1 when possible, but it is guaranteed to happen with implement'
.
val dispatch' :
( 'query, 'response ) t ->
{Connection}2.t ->
'query ->
'response Async_rpc_kernel.Rpc_result.t Async_kernel.Deferred.t
dispatch'
exposes Rpc_result.t
as output. Passing it through rpc_result_to_or_error
gives you the same result as dispatch
val rpc_result_to_or_error :
( 'query, 'response ) t ->
{Connection}2.t ->
'response Async_rpc_kernel.Rpc_result.t ->
'response Core.Or_error.t
val dispatch :
( 'query, 'response ) t ->
{Connection}2.t ->
'query ->
'response Core.Or_error.t Async_kernel.Deferred.t
val dispatch_exn :
( 'query, 'response ) t ->
{Connection}2.t ->
'query ->
'response Async_kernel.Deferred.t
module Expert : sig ... end