Algorithm::Paxos::Role::Acceptor - An Acceptor role for the Paxos algorithm


version 0.001


    package MyApp::PaxosBasic;
    use Moose;
    with qw(Algorithm::Paxos::Role::Acceptor);


From Wikipedia

    The Acceptors act as the fault-tolerant "memory" of the protocol. Acceptors
    are collected into groups called Quorums. Any message sent to an Acceptor must
    be sent to a Quorum of Acceptors. Any message received from an Acceptor is
    ignored unless a copy is received from each Acceptor in a Quorum.


last_prepared_id ( ) : $id

Internal method used by the algorithm. Returns the last id for a prepared proposal.

last_accepted_id ( ) : $id

Internal method used by the algorithm. Returns the last id for an accepted proposal.

learners ( ) : @learners

Returns a list of learners.

prepare ( $id ) : $id

One of the two required methods for an Acceptor. When a proposal is made, the first step is to ask acceptors to prepare. If the proposed ID is too low (meaning another proposal is already in process) an exception will be thrown. If the proposal is new the ID returned is 0. If there is a pending proposal the ID for that proposal is returned.

accept ( $id, $value ) : $id, $value

One of two required methods for an Acceptor. After a quorum is reached a proposal is then accepted and submitted to the learners. If all the learners return clean the proposal id and value are returned. If the ID for the proposal exceeds the allowed value (ie we're trying to accept an ID that is lower than a prepared ID) we throw an exception.


Chris Prather <>


This software is copyright (c) 2012 by Chris Prather.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.