Algorithm-Paxos

 view release on metacpan or  search on metacpan

lib/Algorithm/Paxos.pm  view on Meta::CPAN

=head1 DESCRIPTION

NOTE: This is Alpha level code. The algorithm works, I'm fairly certain it
works to spec it does not have anything near fully test coverage and it hasn't
been used in anything resembling a production environment yet. I'm releasing
it because I think it'll be useful and I don't want it lost on github.

From L<Wikipedia|http://en.wikipedia.org/wiki/Paxos_algorithm>

    Paxos is a family of protocols for solving consensus in a network of
    unreliable processors. Consensus is the process of agreeing on one result
    among a group of participants. This problem becomes difficult when the
    participants or their communication medium may experience failures.

This package implements a basic version of the Basic Paxos protocol and
provides an API (and hooks) for extending into a more complicated solution as
needed.

=head1 SEE ALSO 

=over 4

lib/Algorithm/Paxos/Role/Acceptor.pm  view on Meta::CPAN

proposal.

=head2 learners ( ) : @learners

Returns a list of learners.

=head2 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.

=head2 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.

lib/Algorithm/Paxos/Role/Learner.pm  view on Meta::CPAN

    1;
    __END__

=head1 DESCRIPTION

From L<Wikipedia|http://en.wikipedia.org/wiki/Paxos_algorithm>

    Learners act as the replication factor for the protocol. Once a Client
    request has been agreed on by the Acceptors, the Learner may take action
    (i.e.: execute the request and send a response to the client). To improve
    availability of processing, additional Learners can be added.

=head1 METHODS

=head2 learn ( $id, $value ) 

This is the main interface between Acceptors and Leaners. When a value is
choosen by the cluster, C<learn> is passed the id and value and is recorded in
stable storage. The default implementation stores everything in an in-memory
HashRef.



( run in 0.460 second using v1.01-cache-2.11-cpan-8d75d55dd25 )