RaftEx.Server.Effects
(raft_ex v0.1.0)
View Source
Pure helpers for building and combining Raft effect lists.
Effects are accumulated in reverse order during log application for efficiency, then reversed once at the end. All functions in this module follow that convention unless documented otherwise.
Summary
Functions
Append a reply effect (or notification) to the accumulator based on the
command's reply_mode.
Emit an {idx, term} acknowledgement for :after_log_append commands.
Emit an error reply to the command's from field (if present).
Prepend machine-emitted effects onto the accumulator.
Wrap a non-empty notifys map into a {:notify, map} effect prepended to
prior. Returns prior unchanged when notifys is empty.
Functions
Append a reply effect (or notification) to the accumulator based on the
command's reply_mode.
Returns {effects, notifys} where notifys is a %{pid => [corr_data]}
map of pending pipeline notifications.
@spec after_log_append_reply(tuple(), non_neg_integer(), non_neg_integer(), list()) :: list()
Emit an {idx, term} acknowledgement for :after_log_append commands.
Emit an error reply to the command's from field (if present).
@spec append_machine_effects( RaftEx.Machine.effects() | RaftEx.Machine.effect(), list() ) :: list()
Prepend machine-emitted effects onto the accumulator.
Wrap a non-empty notifys map into a {:notify, map} effect prepended to
prior. Returns prior unchanged when notifys is empty.