PaxosKV.Learner (paxos_kv v0.4.0)

Summary

Functions

Signals all the Learner processes that an Acceptor on node in the bucket accepted an {id, value} pair under the key key in the PaxosKV key-value store. Acceptors trigger this event when they accept something.

Returns a specification to start this module under a supervisor.

Signals all the Learners that a certain value has been chosen by the cluster in the bucket under the key key in the PaxosKV key-value store.

It tries to figure out if a certain value has already been chosen for a certain key.

Functions

accepted(node, bucket, key, id, value)

Signals all the Learner processes that an Acceptor on node in the bucket accepted an {id, value} pair under the key key in the PaxosKV key-value store. Acceptors trigger this event when they accept something.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

chosen(bucket, key, value)

Signals all the Learners that a certain value has been chosen by the cluster in the bucket under the key key in the PaxosKV key-value store.

get(key, opts)

It tries to figure out if a certain value has already been chosen for a certain key.

In order to decide it first asks the local Learner if it has the answer in it's cache. If not, the Learner asks the Acceptors about the accepted values, and checks if a quorum of Acceptors has the same value. If no quorum present, but there's a valid accepted value accepted by an acceptor, it means a basix paxos round was interrupted in the middle, so in that case it tries to finish the round. If none of the above applies, it just returns {:error, :not_found}.

start_link(opts)