package shared-memory-ring

  1. Overview
  2. Docs

The back-end of the shared ring, which reads requests and writes responses to the remote domain.

type ('a, 'b) t

Type of a backend. 'a is the response type, and 'b is the request id type (e.g. int or int64).

val init : sring:sring -> ('a, 'b) t

init ~sring is an initialized backend attached to shared ring sring.

val slot : ('a, 'b) t -> int -> Cstruct.t

slot backend idx retrieves the request/response slot at idx as an Cstruct.t. idx should be less than nr_ents.

val nr_ents : ('a, 'b) t -> int

nr_ents backend is the number of slots in the underlying shared ring.

val next_res_id : ('a, 'b) t -> int

next_res_id backend advances the response producer and return the latest slot id.

val push_responses : ('a, 'b) t -> unit

push_responses backend updates the shared response producer.

val push_responses_and_check_notify : ('a, 'b) t -> bool

push_responses_and_check_notify backend updates the shared response producer, and returns true if an event notification is required to wake up the remote domain.

val more_to_do : ('a, 'b) t -> bool

more_to_do backend returns true if there are outstanding requests on the ring which we should immediately process without waiting for an event notification.

val ack_requests : ('a, 'b) t -> (Cstruct.t -> unit) -> unit

ack_requests t fn applies fn slot to each slot containing a new request.

val to_string : ('a, 'b) t -> string

to_string backend pretty-prints the ring metadata.