Ferricstore.Raft.ReplyAwaiter (ferricstore v0.4.2)

Copy Markdown View Source

Alias-backed waiters for replies sent with GenServer.reply/2.

Router sometimes passes explicit {pid, tag} reply targets into the Raft batcher and then waits in the caller process. A plain {self(), ref} target leaves late replies in the caller mailbox after timeout. Process aliases let us turn the reply target off on timeout, so late Raft replies are dropped instead of confusing later receives on the same connection process.

Summary

Types

from()

@type from() :: {reference(), {Ferricstore.Raft.ReplyAwaiter, reference()}}

token()

@type token() :: {reference(), {Ferricstore.Raft.ReplyAwaiter, reference()}}

Functions

await(arg, timeout_ms, timeout_result)

@spec await(token(), timeout(), term()) :: term()

collect(tokens, timeout_ms)

@spec collect([token()], timeout()) ::
  {:ok | :timeout, [{token(), term()}], [token()]}

collect_tagged(token_meta_pairs, timeout_ms)

@spec collect_tagged([{token(), term()}], timeout()) ::
  {:ok | :timeout, [{term(), term()}], [{token(), term()}]}

new()

@spec new() :: {from(), token()}