Ferricstore.Store.ColdRead (ferricstore v0.4.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

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()