Helpers for synchronous callers that need to wait on Tokio cold-read NIFs.
The NIF sends {:tokio_complete, corr_id, ...} to the pid passed at submit
time. If a caller waits directly and times out, a late completion can remain
in that caller's mailbox. These helpers submit through a short-lived proxy
process, so late completions are consumed or dropped away from the caller.
Summary
Types
@type current_keyed_read() :: {binary(), non_neg_integer(), binary(), keyed_read_token()}
@type current_keyed_resolution() :: {:cold, binary(), non_neg_integer(), keyed_read_token()} | {:hot, binary(), keyed_read_token()} | :missing | {:error, term()}
@type current_keyed_result() :: {:value, binary(), keyed_read_token()} | :missing | {:error, term()}
@type keyed_read_token() :: term()
@type submit_fun() :: (pid(), pos_integer() -> :ok | {:error, term()})
Functions
@spec pread_at(binary(), non_neg_integer(), timeout()) :: result()
@spec pread_at(binary(), non_neg_integer(), binary(), timeout()) :: result()
@spec pread_batch([{binary(), non_neg_integer()}], timeout()) :: result()
@spec pread_batch_keyed([{binary(), non_neg_integer(), binary()}], timeout()) :: result()
@spec pread_keyed(binary(), non_neg_integer(), binary(), timeout()) :: result()