Ferricstore.Store.ColdRead (ferricstore v0.11.0)

Copy Markdown View Source

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

current_keyed_read()

@type current_keyed_read() ::
  {binary(), non_neg_integer(), binary(), keyed_read_token()}

current_keyed_resolution()

@type current_keyed_resolution() ::
  {:cold, binary(), non_neg_integer(), keyed_read_token()}
  | {:hot, binary(), keyed_read_token()}
  | :missing
  | {:error, term()}

current_keyed_result()

@type current_keyed_result() ::
  {:value, binary(), keyed_read_token()} | :missing | {:error, term()}

keyed_read_token()

@type keyed_read_token() :: term()

result()

@type result() :: {:ok, term()} | {:error, term()}

submit_fun()

@type submit_fun() :: (pid(), pos_integer() -> :ok | {:error, term()})

Functions

pread_at(path, offset, timeout_ms)

@spec pread_at(binary(), non_neg_integer(), timeout()) :: result()

pread_at(path, offset, expected_key, timeout_ms)

@spec pread_at(binary(), non_neg_integer(), binary(), timeout()) :: result()

pread_batch(locations, timeout_ms)

@spec pread_batch([{binary(), non_neg_integer()}], timeout()) :: result()

pread_batch_keyed(locations, timeout_ms)

@spec pread_batch_keyed([{binary(), non_neg_integer(), binary()}], timeout()) ::
  result()

pread_keyed(path, offset, expected_key, timeout_ms)

@spec pread_keyed(binary(), non_neg_integer(), binary(), timeout()) :: result()