Rice Pastry API

org.mpisws.p2p.transport.peerreview.commitment
Class CommitmentProtocolImpl<Handle extends RawSerializable,Identifier extends RawSerializable>

java.lang.Object
  extended by org.mpisws.p2p.transport.peerreview.commitment.CommitmentProtocolImpl<Handle,Identifier>
All Implemented Interfaces:
CommitmentProtocol<Handle,Identifier>, PeerReviewConstants

public class CommitmentProtocolImpl<Handle extends RawSerializable,Identifier extends RawSerializable>
extends java.lang.Object
implements CommitmentProtocol<Handle,Identifier>, PeerReviewConstants


Field Summary
 int INITIAL_TIMEOUT_MICROS
           
 int MAX_ENTRIES_PER_MS
           
 int MAX_PEERS
           
 int MAX_RETRANSMISSIONS
           
 int PROGRESS_INTERVAL_MICROS
           
 int RECEIVE_CACHE_SIZE
           
 int RETRANSMIT_TIMEOUT_MICROS
           
 int TI_PROGRESS
           
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.PeerReviewConstants
CHAL_AUDIT, CHAL_SEND, DEFAULT_AUTH_PUSH_INTERVAL_MICROS, DEFAULT_CHECKPOINT_INTERVAL_MICROS, DEFAULT_TIME_TOLERANCE_MICROS, EVT_ACK, EVT_CHECKPOINT, EVT_INIT, EVT_MAX_SOCKET_EVT, EVT_MIN_SOCKET_EVT, EVT_RECV, EVT_SEND, EVT_SENDSIGN, EVT_SIGN, EVT_SOCKET_CAN_READ, EVT_SOCKET_CAN_RW, EVT_SOCKET_CAN_WRITE, EVT_SOCKET_CLOSE, EVT_SOCKET_CLOSED, EVT_SOCKET_EXCEPTION, EVT_SOCKET_OPEN_INCOMING, EVT_SOCKET_OPEN_OUTGOING, EVT_SOCKET_OPENED_OUTGOING, EVT_SOCKET_READ, EVT_SOCKET_SHUTDOWN_OUTPUT, EVT_SOCKET_WRITE, EX_TYPE_ClosedChannel, EX_TYPE_IO, EX_TYPE_Unknown, MAINTENANCE_INTERVAL_MICROS, MAX_STATUS_INFO, MSG_ACCUSATION, MSG_ACK, MSG_AUTHPUSH, MSG_AUTHREQ, MSG_AUTHRESP, MSG_CHALLENGE, MSG_RESPONSE, MSG_USERDATA, MSG_USERDGRAM, PROOF_INCONSISTENT, PROOF_NONCONFORMANT, STATUS_EXPOSED, STATUS_SUSPECTED, STATUS_TRUSTED, TI_AUTH_PUSH, TI_CHECKPOINT, TI_MAINTENANCE, TI_MAX_RESERVED, TI_STATUS_INFO
 
Constructor Summary
CommitmentProtocolImpl(PeerReview<Handle,Identifier> peerreview, IdentityTransport<Handle,Identifier> transport, PeerInfoStore<Handle,Identifier> infoStore, AuthenticatorStore<Identifier> authStore, SecureHistory history, Misbehavior<Handle> misbehavior, long timeToleranceMillis)
           
 
Method Summary
protected  void addToReceiveCache(Identifier id, long senderSeq, long indexInLocalHistory)
           
protected  long findAckEntry(Identifier id, long seq)
           
protected  long findRecvEntry(Identifier id, long seq)
           
protected  void handleIncomingAck(Handle source, AckMessage<Identifier> ackMessage, java.util.Map<java.lang.String,java.lang.Object> options)
           
protected  void handleIncomingMessage(Handle source, UserDataMessage<Handle> msg, java.util.Map<java.lang.String,java.lang.Object> options)
          Handle an incoming USERDATA message
 MessageRequestHandle<Handle,java.nio.ByteBuffer> handleOutgoingMessage(Handle target, java.nio.ByteBuffer message, MessageCallback<Handle,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
           
protected  void initReceiveCache()
          Load the last events from the history into the cache
 Tuple<AckMessage<Identifier>,java.lang.Boolean> logMessageIfNew(UserDataMessage<Handle> udm)
          Checks whether an incoming message is already in the log (which can happen with duplicates).
protected  PeerInfo<Handle> lookupPeer(Handle handle)
           
protected  void makeProgress(Identifier idx)
          Tries to make progress on the message queue of the specified peer, e.g.
protected  void makeProgressAllPeers()
           
protected  void notifyCertificateAvailable(Identifier id)
           
protected  void notifyStatusChange(Identifier id, int newStatus)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_PEERS

public int MAX_PEERS

INITIAL_TIMEOUT_MICROS

public int INITIAL_TIMEOUT_MICROS

RETRANSMIT_TIMEOUT_MICROS

public int RETRANSMIT_TIMEOUT_MICROS

RECEIVE_CACHE_SIZE

public int RECEIVE_CACHE_SIZE

MAX_RETRANSMISSIONS

public int MAX_RETRANSMISSIONS

TI_PROGRESS

public int TI_PROGRESS

PROGRESS_INTERVAL_MICROS

public int PROGRESS_INTERVAL_MICROS

MAX_ENTRIES_PER_MS

public int MAX_ENTRIES_PER_MS
Constructor Detail

CommitmentProtocolImpl

public CommitmentProtocolImpl(PeerReview<Handle,Identifier> peerreview,
                              IdentityTransport<Handle,Identifier> transport,
                              PeerInfoStore<Handle,Identifier> infoStore,
                              AuthenticatorStore<Identifier> authStore,
                              SecureHistory history,
                              Misbehavior<Handle> misbehavior,
                              long timeToleranceMillis)
                       throws java.io.IOException
Throws:
java.io.IOException
Method Detail

initReceiveCache

protected void initReceiveCache()
                         throws java.io.IOException
Load the last events from the history into the cache

Throws:
java.io.IOException

addToReceiveCache

protected void addToReceiveCache(Identifier id,
                                 long senderSeq,
                                 long indexInLocalHistory)

lookupPeer

protected PeerInfo<Handle> lookupPeer(Handle handle)

notifyCertificateAvailable

protected void notifyCertificateAvailable(Identifier id)

logMessageIfNew

public Tuple<AckMessage<Identifier>,java.lang.Boolean> logMessageIfNew(UserDataMessage<Handle> udm)
Checks whether an incoming message is already in the log (which can happen with duplicates). If not, it adds the message to the log.

Returns:
The ack message and whether it was already logged.
Throws:
java.security.SignatureException

notifyStatusChange

protected void notifyStatusChange(Identifier id,
                                  int newStatus)

makeProgressAllPeers

protected void makeProgressAllPeers()

makeProgress

protected void makeProgress(Identifier idx)
Tries to make progress on the message queue of the specified peer, e.g. after that peer has become TRUSTED, or after it has sent us an acknowledgment


findRecvEntry

protected long findRecvEntry(Identifier id,
                             long seq)

findAckEntry

protected long findAckEntry(Identifier id,
                            long seq)

handleIncomingMessage

protected void handleIncomingMessage(Handle source,
                                     UserDataMessage<Handle> msg,
                                     java.util.Map<java.lang.String,java.lang.Object> options)
                              throws java.io.IOException
Handle an incoming USERDATA message

Throws:
java.io.IOException

handleOutgoingMessage

public MessageRequestHandle<Handle,java.nio.ByteBuffer> handleOutgoingMessage(Handle target,
                                                                              java.nio.ByteBuffer message,
                                                                              MessageCallback<Handle,java.nio.ByteBuffer> deliverAckToMe,
                                                                              java.util.Map<java.lang.String,java.lang.Object> options)
Specified by:
handleOutgoingMessage in interface CommitmentProtocol<Handle extends RawSerializable,Identifier extends RawSerializable>

handleIncomingAck

protected void handleIncomingAck(Handle source,
                                 AckMessage<Identifier> ackMessage,
                                 java.util.Map<java.lang.String,java.lang.Object> options)
                          throws java.io.IOException
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.