phoenix_pubsub v1.0.2 Phoenix.Tracker.State
Provides an ORSWOT CRDT.
Summary
Functions
Returns the causal context for the set
Compacts a sets causal history
Returns the dize of the delta
Extracts the set’s elements from ets into a mergeable list
Returns all elements for the pid
Returns the element matching the pid, topic, and key
Returns a list of elements for the topic who belong to an online replica
Checks if set has a non-empty delta
Adds a new element to the set
Removes all elements from the set for the given pid
Removes an element from the set
Merges two sets, or a delta into a set
Creates a new set for the replica
Returns a list of elements in the set belonging to an online replica
Removes all elements for replicas that are permanently gone
Marks a replica as down in the set and returns left users
Marks a replica as up in the set and returns rejoined users
Resets the set’s delta
Types
clock :: pos_integer
delta :: %Phoenix.Tracker.State{clouds: term, context: term, delta: term, mode: :delta, pids: term, range: term, replica: term, replicas: term, values: term}
ets_id :: pos_integer
key :: term
name :: term
pid_lookup :: {pid, topic, key}
Functions
Compacts a sets causal history.
Called as needed and after merges.
Extracts the set’s elements from ets into a mergeable list.
Used when merging two sets.
Returns the element matching the pid, topic, and key.
Returns a list of elements for the topic who belong to an online replica.
Adds a new element to the set.
Specs
Merges two sets, or a delta into a set.
Returns a 3-tuple of the updated set, and the joined and left elements.
Examples
iex> {s1, joined, left} =
Phoenix.Tracker.State.merge(s1, Phoenix.Tracker.State.extract(s2))
{%Phoenix.Tracker.State{}, [...], [...]}
Creates a new set for the replica.
Examples
iex> Phoenix.Tracker.State.new(:replica1)
%Phoenix.Tracker.State{...}
Returns a list of elements in the set belonging to an online replica.
Removes all elements for replicas that are permanently gone.
Marks a replica as down in the set and returns left users.
Marks a replica as up in the set and returns rejoined users.