Callee.Streamable_state_rpcSourceHigh level functions for working with callees in the style of Streamable.State_rpc.implement.
type ('q, 's, 'u) implementation :=
'q ->
('s * 'u Async_kernel.Pipe.Reader.t) Core.Or_error.t Async_kernel.Deferred.tCreate a callee which can implement a given rpc.
val add :
('q, 's, 'u) implementation t ->
rpc:('q, 's, 'u) Streamable.State_rpc.t ->
('q, 's, 'u) implementation tExtend a callee to be able to implement a given rpc.
val map_query :
('q1, 's, 'u) implementation t ->
f:('q1 -> 'q2) ->
('q2, 's, 'u) implementation tMap over the query type of a callee.
val map_state :
('q, 's1, 'u) implementation t ->
f:('s2 -> 's1) ->
('q, 's2, 'u) implementation tMap over the state type of a callee.
val map_update :
('q, 's, 'u1) implementation t ->
f:('u2 -> 'u1) ->
('q, 's, 'u2) implementation tMap over the update type of a callee.
Sometimes, Callee.Streamable_state_rpc.map_update is not sufficient. For example, sometimes it might not be possible to convert the response to the desired type, in which case it may be appropriate to drop the value from the pipe entirely. For such cases, use Callee.map_response instead. It gives you access to the pipe itself, not just the values inside it, allowing you to use something like Pipe.filter_map.
val filter_map_update :
('q, 's, 'u1) implementation t ->
f:('u2 -> 'u1 option) ->
('q, 's, 'u2) implementation tMap over the update type of a callee, possibly filtering out some updates.