org.mpisws.p2p.transport.peerreview.commitment
Class CommitmentProtocolImpl<Handle extends RawSerializable,Identifier extends RawSerializable>
java.lang.Object
org.mpisws.p2p.transport.peerreview.commitment.CommitmentProtocolImpl<Handle,Identifier>
- All Implemented Interfaces:
- CommitmentProtocol<Handle,Identifier>, StatusChangeListener<Identifier>, PeerReviewConstants, StatusConstants
public class CommitmentProtocolImpl<Handle extends RawSerializable,Identifier extends RawSerializable>
- extends java.lang.Object
- implements CommitmentProtocol<Handle,Identifier>, PeerReviewConstants
Fields inherited from interface org.mpisws.p2p.transport.peerreview.PeerReviewConstants |
AUTH_CACHE_INTERVAL, CERT_MISSING, CHAL_AUDIT, CHAL_SEND, DEFAULT_AUDIT_INTERVAL_MILLIS, DEFAULT_AUTH_PUSH_INTERVAL_MILLIS, DEFAULT_CHECKPOINT_INTERVAL_MILLIS, DEFAULT_LOG_DOWNLOAD_TIMEOUT, DEFAULT_TIME_TOLERANCE_MILLIS, EVT_ACK, EVT_CHECKPOINT, EVT_CHOOSE_Q, EVT_CHOOSE_RAND, EVT_INIT, EVT_MAX_RESERVED, 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, EVT_VRF, EX_TYPE_ClosedChannel, EX_TYPE_IO, EX_TYPE_Unknown, FLAG_FULL_MESSAGES_ALL, FLAG_FULL_MESSAGES_SENDER, FLAG_INCLUDE_CHECKPOINT, INVALID, INVESTIGATION_INTERVAL_MILLIS, MAINTENANCE_INTERVAL_MILLIS, MAX_ACTIVE_AUDITS, MAX_ACTIVE_INVESTIGATIONS, MAX_ENTRIES_BETWEEN_CHECKPOINTS, MAX_STATUS_INFO, MAX_WITNESSED_NODES, MSG_ACCUSATION, MSG_ACK, MSG_AUTHPUSH, MSG_AUTHREQ, MSG_AUTHRESP, MSG_CHALLENGE, MSG_RESPONSE, MSG_USERDATA, MSG_USERDGRAM, NO_CERTIFICATE, PROOF_INCONSISTENT, PROOF_NONCONFORMANT, RESP_AUDIT, RESP_SEND, SIGNATURE_BAD, SIGNATURE_OK, STATE_SEND_AUDIT, STATE_WAIT_FOR_LOG, TI_AUTH_PUSH, TI_CHECKPOINT, TI_MAINTENANCE, TI_MAKE_PROGRESS, TI_MAX_RESERVED, TI_START_AUDITS, TI_STATUS_INFO, VALID |
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)
|
void |
handleIncomingAck(Handle source,
AckMessage<Identifier> ackMessage,
java.util.Map<java.lang.String,java.lang.Object> options)
|
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()
|
void |
notifyCertificateAvailable(Identifier id)
|
void |
notifyStatusChange(Identifier id,
int newStatus)
|
void |
setTimeToleranceMillis(long timeToleranceMillis)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MAX_PEERS
public int MAX_PEERS
INITIAL_TIMEOUT_MILLIS
public int INITIAL_TIMEOUT_MILLIS
RETRANSMIT_TIMEOUT_MILLIS
public int RETRANSMIT_TIMEOUT_MILLIS
RECEIVE_CACHE_SIZE
public int RECEIVE_CACHE_SIZE
MAX_RETRANSMISSIONS
public int MAX_RETRANSMISSIONS
TI_PROGRESS
public int TI_PROGRESS
PROGRESS_INTERVAL_MILLIS
public int PROGRESS_INTERVAL_MILLIS
MAX_ENTRIES_PER_MS
public int MAX_ENTRIES_PER_MS
CommitmentProtocolImpl
public CommitmentProtocolImpl(PeerReview<Handle,Identifier> peerreview,
IdentityTransport<Handle,Identifier> transport,
PeerInfoStore<Handle,Identifier> infoStore,
AuthenticatorStore<Identifier> authStore,
SecureHistory history,
long timeToleranceMillis)
throws java.io.IOException
- Throws:
java.io.IOException
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
public void notifyCertificateAvailable(Identifier id)
- Specified by:
notifyCertificateAvailable
in interface CommitmentProtocol<Handle extends RawSerializable,Identifier extends RawSerializable>
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.
- Specified by:
logMessageIfNew
in interface CommitmentProtocol<Handle extends RawSerializable,Identifier extends RawSerializable>
- Returns:
- The ack message and whether it was already logged.
- Throws:
java.security.SignatureException
notifyStatusChange
public void notifyStatusChange(Identifier id,
int newStatus)
- Specified by:
notifyStatusChange
in interface StatusChangeListener<Identifier extends RawSerializable>
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
public 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
- Specified by:
handleIncomingMessage
in interface CommitmentProtocol<Handle extends RawSerializable,Identifier extends RawSerializable>
- 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
public void handleIncomingAck(Handle source,
AckMessage<Identifier> ackMessage,
java.util.Map<java.lang.String,java.lang.Object> options)
throws java.io.IOException
- Specified by:
handleIncomingAck
in interface CommitmentProtocol<Handle extends RawSerializable,Identifier extends RawSerializable>
- Throws:
java.io.IOException
setTimeToleranceMillis
public void setTimeToleranceMillis(long timeToleranceMillis)
- Specified by:
setTimeToleranceMillis
in interface CommitmentProtocol<Handle extends RawSerializable,Identifier extends RawSerializable>
Copyright © 2001-2005 - Rice Pastry.