Ramal.Merge.Result (Ramal v0.2.0)

Copy Markdown View Source

What Ramal.merge/2 returns on success.

  • branch - the branch, now with status :merged
  • records - what the replay wrote, keyed like an overlay (Ramal.Overlay): {:created, record}, {:updated, record} or :deleted per {resource, key}, with the records as the real actions returned them
  • replayed - how many log entries were replayed; entries written by a hook of another action are not counted, because replaying that action ran the hook again
  • stale - the rows that had changed under the branch and that on_stale let through, each %{resource: module, key: term, reason: :changed | :deleted}

Example

%Ramal.Merge.Result{replayed: 2, stale: []} = result

Summary

Types

stale_row()

@type stale_row() :: %{resource: module(), key: term(), reason: :changed | :deleted}

t()

@type t() :: %Ramal.Merge.Result{
  branch: Ramal.Branch.t(),
  records: Ramal.Overlay.t(),
  replayed: non_neg_integer(),
  stale: [stale_row()]
}