Module Rpc_effect_kernel.Poll_result

The various rpc polling functions in Rpc_effect take a Poll_result.Output_type.t and return the corresponding output type. Some output types are the modules below; others are specific parts of a poll result, such as the last OK response.

Pending_or_error.t, Response_state.t, and Response_state_with_details.t all represent the state as a variant. However, a Pending state (from Pending_or_error) occurs both during the initial query and whenever the query changes, while a No_response_yet state (from Response_state) only occurs during the initial query. Semantically, you can think of Pending_or_error as tracking responses from the currently active query, and Response_state as tracking responses in general.

If you want something particular (e.g. last response) and you don't care as much about the state, try using a specific Output_type (e.g. Last_ok_response) instead of matching.

Can use like this to get a single output:

  let response =
    Rpc_effect.Rpc.poll
      ...
      ~output_type:Response_state_with_details
      ...
  in
  ...

Or this to get multiple outputs:

  let%sub [ last_ok_response; fetching_status ] =
    Rpc_effect.Rpc.poll
      ...
      ~output_type:[ Last_ok_response; Fetching_status ]
      ...
  in
  ...
type ('query, 'response) t

An abstract poll result. You can get more specific information out of it by calling get_output.

val sexp_of_t : ('query -> Sexplib0.Sexp.t) -> ('response -> Sexplib0.Sexp.t) -> ('query, 'response) t -> Sexplib0.Sexp.t
val map_response : ('query, 'response1) t -> f:('response1 -> 'response2) -> ('query, 'response2) t

map_response t ~f transforms the response type by applying f to the response in last_ok_response, if present.

module Fetching_status : sig ... end
module Pending_or_error = Pending_or_error

Pending: The current query is in flight (or hasn't been sent yet) and has not returned a response.

module Response_state : sig ... end

No_response_yet: There is no response yet (for any query).

module Response_state_with_details : sig ... end
module Legacy_record : sig ... end
module Raw_representation : sig ... end
module Heterogeneous_list : sig ... end
module Output_type : sig ... end
val get_output : ('query, 'response) t -> output_type:('query, 'response, 'output) Output_type.t -> 'output
val empty : ('query, 'response) t
module Private : sig ... end
module For_testing : sig ... end