View Source EchoPubSub.Producer.Registration (EchoPubSub v0.2.2)

Registers a remote worker before its first batch: {:register, node, missed_writes?} when the producer has no cursor for it, {:resume, node} when only its worker restarted. Runs in a task; finish/5 folds the reply into the producer state.

Summary

Functions

Applies the task's result. On :ok the node is registered and keeps any cursor it had, so a restarted worker still gets what its old one missed. On :error it waits for the retry flush with the same start cursor.

Whether pid still needs registering: never registered, or its worker restarted since.

Whether a registration task for node is running (not a failed one waiting to retry).

Starts the registration task for pid on node.

Functions

Link to this function

finish(state, node, start, pid, atom)

View Source

Applies the task's result. On :ok the node is registered and keeps any cursor it had, so a restarted worker still gets what its old one missed. On :error it waits for the retry flush with the same start cursor.

Link to this function

needed?(state, pid, node)

View Source
@spec needed?(EchoPubSub.Producer.State.t(), pid(), node()) :: boolean()

Whether pid still needs registering: never registered, or its worker restarted since.

@spec running?(EchoPubSub.Producer.State.t(), node()) :: boolean()

Whether a registration task for node is running (not a failed one waiting to retry).

Starts the registration task for pid on node.