universal.consensus.register
Class Registry

java.lang.Object
  |
  +--universal.consensus.register.Registry

public class Registry
extends java.lang.Object

Each time a new consensus is started for a new position in the total order, a registry is added to the hashtable of the register. One registry contains the value that it has received in the WriteMessage from the leader for this position in the total order. It also contains the last time this server has received a ReadMessage and the last time it has received the WriteMessage.


Field Summary
private  java.lang.String filename
          Could be useful if we want to instantiate the crashRecovery model as in paxos
 int lastread
          The last time it has received a ReadMessage from the leader for the position in the total order that this regitry has been instantiated.
 int lastwrite
          The last time it has received a WriteMessage from the leader for the position in the total order that this regitry has been instantiated.
 universal.Outcome out
          The Outcome that was in the WriteMessage from the leader
protected  universal.Universal uni
          The object Universal that this Registry is linked to
 
Constructor Summary
Registry(universal.Universal uni)
           
 
Method Summary
 universal.consensus.register.AckListener acklistener()
           
 universal.consensus.register.ReadResult read(int k, int K)
          Read for the round number k and the position in the total order K.
 universal.communication.Sender sender()
           
 universal.consensus.register.WriteResult write(int k, universal.Outcome out, int K)
          Try to write the value out for the round number k and the position in the total order K.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastread

public int lastread
The last time it has received a ReadMessage from the leader for the position in the total order that this regitry has been instantiated.


lastwrite

public int lastwrite
The last time it has received a WriteMessage from the leader for the position in the total order that this regitry has been instantiated.


out

public universal.Outcome out
The Outcome that was in the WriteMessage from the leader


filename

private java.lang.String filename
Could be useful if we want to instantiate the crashRecovery model as in paxos


uni

protected universal.Universal uni
The object Universal that this Registry is linked to

Constructor Detail

Registry

public Registry(universal.Universal uni)
Method Detail

read

public universal.consensus.register.ReadResult read(int k,
                                                    int K)
Read for the round number k and the position in the total order K. It sends a ReadMessage and then wait for a majority + 1 of replicated server to acknowledge. It returns an object ReadResult which as two variable. One boolean which is true if the leader hasn't received NackReadMessage. One Outcome which is null if we have received one NackReadMessage or if no request has already been processed for the position K in the total order. Otherwise it contains the outcome (Request, Reply, Update) that has been decided for the position K.


sender

public universal.communication.Sender sender()

acklistener

public universal.consensus.register.AckListener acklistener()

write

public universal.consensus.register.WriteResult write(int k,
                                                      universal.Outcome out,
                                                      int K)
Try to write the value out for the round number k and the position in the total order K. It sends a WriteMessage which contains the value out that it wants to write and then wait for a majority + 1 of replicated server to acknowledge. It returns an object WriteResult which is a boolean that is true if the leader hasn't received any NackWriteMessage. WriteResult contains also an other variable but that is useful only if we want to implement the crash recovery model as it was done in paxos.