Rice Pastry API

rice.pastry.peerreview
Class PeerReviewCallbackImpl

java.lang.Object
  extended by rice.pastry.peerreview.PeerReviewCallbackImpl
All Implemented Interfaces:
IdentityTransportCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>, StatusChangeListener<Id>, PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>, StatusConstants, TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>, TransportLayerCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>, Destructable

public class PeerReviewCallbackImpl
extends java.lang.Object
implements PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>, TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>


Field Summary
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.StatusConstants
STATUS_EXPOSED, STATUS_SUSPECTED, STATUS_TRUSTED
 
Constructor Summary
  PeerReviewCallbackImpl(PastryNode pn, TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> tl, CallbackFactory nodeFactory)
           
protected PeerReviewCallbackImpl(TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> tl)
           
 
Method Summary
 void acceptMessages(boolean b)
          Toggle accepting incoming messages.
 void acceptSockets(boolean b)
          Toggle accepting new sockets.
 void destroy()
           
 TransportLayerNodeHandle<MultiInetSocketAddress> getLocalIdentifier()
          The local node.
 java.util.Collection<TransportLayerNodeHandle<MultiInetSocketAddress>> getMyWitnessedNodes()
           
 PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id> getReplayInstance(Verifier<TransportLayerNodeHandle<MultiInetSocketAddress>> v)
          Construct a PastryNode down to my layer (figure out how to borrow the code from the PastryNodeFactory) Construct a PeerReviewCallbackImpl with the PastryNode/Verifier Construct the layers above self, attach them appropriately.
 void getWitnesses(Id subject, WitnessListener<TransportLayerNodeHandle<MultiInetSocketAddress>,Id> callback)
           
 void incomingSocket(P2PSocket<TransportLayerNodeHandle<MultiInetSocketAddress>> s)
          Notification of a new socket.
 void init()
           
 boolean loadCheckpoint(InputBuffer buffer)
          Load rt/leafset
 void messageReceived(TransportLayerNodeHandle<MultiInetSocketAddress> i, java.nio.ByteBuffer m, java.util.Map<java.lang.String,java.lang.Object> options)
          Called when a new message is received.
 void notifyCertificateAvailable(Id id)
           
 void notifyStatusChange(Id id, int newStatus)
           
 SocketRequestHandle<TransportLayerNodeHandle<MultiInetSocketAddress>> openSocket(TransportLayerNodeHandle<MultiInetSocketAddress> i, SocketCallback<TransportLayerNodeHandle<MultiInetSocketAddress>> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Open a socket to the Identifier
 MessageRequestHandle<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> sendMessage(TransportLayerNodeHandle<MultiInetSocketAddress> i, java.nio.ByteBuffer m, MessageCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Send the message to the identifier
 void setCallback(TransportLayerCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> callback)
          Set the callback for incoming sockets/messages
 void setErrorHandler(ErrorHandler<TransportLayerNodeHandle<MultiInetSocketAddress>> handler)
          To be notified of problems not related to an outgoing messaage/socket.
 void storeCheckpoint(OutputBuffer buffer)
          Store rt/leafset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerReviewCallbackImpl

public PeerReviewCallbackImpl(PastryNode pn,
                              TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> tl,
                              CallbackFactory nodeFactory)

PeerReviewCallbackImpl

protected PeerReviewCallbackImpl(TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> tl)
Method Detail

getReplayInstance

public PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id> getReplayInstance(Verifier<TransportLayerNodeHandle<MultiInetSocketAddress>> v)
Construct a PastryNode down to my layer (figure out how to borrow the code from the PastryNodeFactory) Construct a PeerReviewCallbackImpl with the PastryNode/Verifier Construct the layers above self, attach them appropriately.

Specified by:
getReplayInstance in interface PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>

storeCheckpoint

public void storeCheckpoint(OutputBuffer buffer)
                     throws java.io.IOException
Store rt/leafset

Specified by:
storeCheckpoint in interface PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>
Throws:
java.io.IOException

loadCheckpoint

public boolean loadCheckpoint(InputBuffer buffer)
                       throws java.io.IOException
Load rt/leafset

Specified by:
loadCheckpoint in interface PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>
Returns:
Throws:
java.io.IOException

getMyWitnessedNodes

public java.util.Collection<TransportLayerNodeHandle<MultiInetSocketAddress>> getMyWitnessedNodes()
Specified by:
getMyWitnessedNodes in interface PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>

init

public void init()
Specified by:
init in interface PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>

destroy

public void destroy()
Specified by:
destroy in interface Destructable

notifyCertificateAvailable

public void notifyCertificateAvailable(Id id)
Specified by:
notifyCertificateAvailable in interface IdentityTransportCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>

incomingSocket

public void incomingSocket(P2PSocket<TransportLayerNodeHandle<MultiInetSocketAddress>> s)
                    throws java.io.IOException
Description copied from interface: TransportLayerCallback
Notification of a new socket.

Specified by:
incomingSocket in interface TransportLayerCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>
Parameters:
s - the incoming socket
Throws:
java.io.IOException

messageReceived

public void messageReceived(TransportLayerNodeHandle<MultiInetSocketAddress> i,
                            java.nio.ByteBuffer m,
                            java.util.Map<java.lang.String,java.lang.Object> options)
                     throws java.io.IOException
Description copied from interface: TransportLayerCallback
Called when a new message is received.

Specified by:
messageReceived in interface TransportLayerCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>
Parameters:
i - The node it is coming from
m - the message
options - describe how the message arrived (udp/tcp, encrypted etc)
Throws:
java.io.IOException - if there is a problem decoding the message

notifyStatusChange

public void notifyStatusChange(Id id,
                               int newStatus)
Specified by:
notifyStatusChange in interface StatusChangeListener<Id>

acceptMessages

public void acceptMessages(boolean b)
Description copied from interface: TransportLayer
Toggle accepting incoming messages. Useful in flow control if overwhelmed by incoming sockets. Default: true

Specified by:
acceptMessages in interface TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>

acceptSockets

public void acceptSockets(boolean b)
Description copied from interface: TransportLayer
Toggle accepting new sockets. Useful in flow control if overwhelmed by incoming sockets. Default: true

Specified by:
acceptSockets in interface TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>

getWitnesses

public void getWitnesses(Id subject,
                         WitnessListener<TransportLayerNodeHandle<MultiInetSocketAddress>,Id> callback)
Specified by:
getWitnesses in interface PeerReviewCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,Id>

getLocalIdentifier

public TransportLayerNodeHandle<MultiInetSocketAddress> getLocalIdentifier()
Description copied from interface: TransportLayer
The local node.

Specified by:
getLocalIdentifier in interface TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>
Returns:
The local node.

openSocket

public SocketRequestHandle<TransportLayerNodeHandle<MultiInetSocketAddress>> openSocket(TransportLayerNodeHandle<MultiInetSocketAddress> i,
                                                                                        SocketCallback<TransportLayerNodeHandle<MultiInetSocketAddress>> deliverSocketToMe,
                                                                                        java.util.Map<java.lang.String,java.lang.Object> options)
Description copied from interface: TransportLayer
Open a socket to the Identifier

Specified by:
openSocket in interface TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>
Parameters:
i - who to open the socket to
deliverSocketToMe - the callback when the socket is opened
options - options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
Returns:
an object to cancel opening the socket if it takes to long, or is no longer relevant

setCallback

public void setCallback(TransportLayerCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> callback)
Description copied from interface: TransportLayer
Set the callback for incoming sockets/messages

Specified by:
setCallback in interface TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>
Parameters:
callback - the callback for incoming sockets/messages

setErrorHandler

public void setErrorHandler(ErrorHandler<TransportLayerNodeHandle<MultiInetSocketAddress>> handler)
Description copied from interface: TransportLayer
To be notified of problems not related to an outgoing messaage/socket. Or to be notified if a callback isn't provided.

Specified by:
setErrorHandler in interface TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>
Parameters:
handler - to be notified of problems not related to a specific messaage/socket.

sendMessage

public MessageRequestHandle<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> sendMessage(TransportLayerNodeHandle<MultiInetSocketAddress> i,
                                                                                                              java.nio.ByteBuffer m,
                                                                                                              MessageCallback<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer> deliverAckToMe,
                                                                                                              java.util.Map<java.lang.String,java.lang.Object> options)
Description copied from interface: TransportLayer
Send the message to the identifier

Specified by:
sendMessage in interface TransportLayer<TransportLayerNodeHandle<MultiInetSocketAddress>,java.nio.ByteBuffer>
Parameters:
i - the destination
m - the message
deliverAckToMe - layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgment, or end-to-end acknowledgement)
options - delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
Returns:
ability to cancel the message if no longer relevant

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection