Rpc_effect_kernel.Poll_resultThe 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
...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.tmap_response t ~f transforms the response type by applying f to the response in last_ok_response, if present.
module Fetching_status : sig ... endmodule Pending_or_error = Pending_or_errorPending: The current query is in flight (or hasn't been sent yet) and has not returned a response.
module Response_state : sig ... endNo_response_yet: There is no response yet (for any query).
module Response_state_with_details : sig ... endmodule Legacy_record : sig ... endmodule Raw_representation : sig ... endmodule Heterogeneous_list : sig ... endmodule Output_type : sig ... endval get_output :
('query, 'response) t ->
output_type:('query, 'response, 'output) Output_type.t ->
'outputval empty : ('query, 'response) tmodule Private : sig ... endmodule For_testing : sig ... end