A mirror of an edge (spec/04 §1): the last values a reading process holds of a node
another process owns, and the sequence they are as of. Macaw.Live.Edge is the owner's
side.
new/2takes a join's answer whole;take/3reads a publication: the next sequence is applied, its values merged over the held ones; one at or below the held sequence is a repeat and ignored; one past the next is a gap, which the reader answers by joining again and taking the answer whole withwhole/2, so no change is applied twice or lost;land/3puts state values into the reader'sMacaw.StatewithMacaw.State.put/2, judged by the reader's own declaration: a value it refuses is dropped, its faults kept indroppedfor the reader'sinfo/1.
Summary
Functions
State values carried by the mirror put into the reader's state (spec/04 §1): {mirror, state, changed}, changed the names whose values changed in name order. Each is judged
by the reader's declaration as Macaw.State.restore/3 judges a stored value
(Macaw.State.put/2); a value it refuses is left out, the state's own value kept, and
its faults appended to the mirror's dropped. A visitor's overlay the visit carries
is taken as the visit holds it, its name {:overlay, source} first among changed
(Macaw.Live.Scopes.land/2).
A mirror of key holding a join's answer.
A publication read (spec/04 §1): {:applied, mirror, changed} for the next sequence,
changed its values; :repeat for one at or below the held sequence; :gap for one
past the next, which the reader answers by joining again (whole/2).
A join's answer taken whole, after a gap or the owner's :DOWN: {mirror, changed},
changed the values that differ from the ones held.
Types
@type t() :: %Macaw.Live.Edge.Mirror{ dropped: [Macaw.Base.Fault.t()], key: term(), seq: integer() | nil, values: map() }
A mirror: the edge's key, the sequence held, the values and the faults dropped.
Functions
@spec land(t(), Macaw.State.t(), map()) :: {t(), Macaw.State.t(), list()}
State values carried by the mirror put into the reader's state (spec/04 §1): {mirror, state, changed}, changed the names whose values changed in name order. Each is judged
by the reader's declaration as Macaw.State.restore/3 judges a stored value
(Macaw.State.put/2); a value it refuses is left out, the state's own value kept, and
its faults appended to the mirror's dropped. A visitor's overlay the visit carries
is taken as the visit holds it, its name {:overlay, source} first among changed
(Macaw.Live.Scopes.land/2).
A mirror of key holding a join's answer.
iex> mirror = Macaw.Live.Edge.Mirror.new("wall", {:ok, 7, %{"pick" => nil}})
iex> {mirror.seq, mirror.values}
{7, %{"pick" => nil}}
A publication read (spec/04 §1): {:applied, mirror, changed} for the next sequence,
changed its values; :repeat for one at or below the held sequence; :gap for one
past the next, which the reader answers by joining again (whole/2).
iex> alias Macaw.Live.Edge.Mirror
iex> mirror = Mirror.new("wall", {:ok, 7, %{"pick" => nil}})
iex> {:applied, mirror, %{"pick" => "a"}} = Mirror.take(mirror, 8, %{"pick" => "a"})
iex> {Mirror.take(mirror, 8, %{"pick" => "b"}), Mirror.take(mirror, 10, %{"pick" => "c"})}
{:repeat, :gap}
A join's answer taken whole, after a gap or the owner's :DOWN: {mirror, changed},
changed the values that differ from the ones held.