|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mpisws.p2p.transport.peerreview.replay.record.RecordLayer<Identifier>
public class RecordLayer<Identifier>
Field Summary | |
---|---|
static java.nio.ByteBuffer |
ONE
|
static java.lang.String |
PR_RELEVANT_LEN
The relevant length of the message. |
static java.lang.String |
PR_RELEVANT_MSG
If the message is relevant. |
static java.nio.ByteBuffer |
ZERO
|
Fields inherited from interface org.mpisws.p2p.transport.peerreview.PeerReviewEvents |
---|
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 |
Constructor Summary | |
---|---|
RecordLayer(TransportLayer<Identifier,java.nio.ByteBuffer> tl,
java.lang.String name,
IdentifierSerializer<Identifier> serializer,
Environment env)
|
Method Summary | |
---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
destroy()
|
static Environment |
generateEnvironment()
|
static Environment |
generateEnvironment(int randomSeed)
|
static Environment |
generateEnvironment(RandomSource rs)
|
Identifier |
getLocalIdentifier()
The local node. |
void |
incomingSocket(P2PSocket<Identifier> s)
Notification of a new socket. |
void |
logEvent(short type,
java.nio.ByteBuffer... entry)
|
void |
logSocketException(java.nio.ByteBuffer socketId,
java.io.IOException ioe)
|
void |
messageReceived(Identifier i,
java.nio.ByteBuffer m,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when a new message is received. |
SocketRequestHandle<Identifier> |
openSocket(Identifier i,
SocketCallback<Identifier> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Open a socket to the Identifier |
MessageRequestHandle<Identifier,java.nio.ByteBuffer> |
sendMessage(Identifier i,
java.nio.ByteBuffer m,
MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Send the message to the identifier |
void |
setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
Set the callback for incoming sockets/messages |
void |
setErrorHandler(ErrorHandler<Identifier> handler)
To be notified of problems not related to an outgoing messaage/socket. |
void |
updateLogTime()
PeerReview only updates its internal clock when it returns to the main loop, but not in between (e.g. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PR_RELEVANT_LEN
public static final java.lang.String PR_RELEVANT_MSG
public static java.nio.ByteBuffer ONE
public static java.nio.ByteBuffer ZERO
Constructor Detail |
---|
public RecordLayer(TransportLayer<Identifier,java.nio.ByteBuffer> tl, java.lang.String name, IdentifierSerializer<Identifier> serializer, Environment env) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void updateLogTime()
public void logEvent(short type, java.nio.ByteBuffer... entry) throws java.io.IOException
java.io.IOException
public SocketRequestHandle<Identifier> openSocket(Identifier i, SocketCallback<Identifier> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
openSocket
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
i
- who to open the socket todeliverSocketToMe
- the callback when the socket is openedoptions
- options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public void incomingSocket(P2PSocket<Identifier> s) throws java.io.IOException
TransportLayerCallback
incomingSocket
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
s
- the incoming socket
java.io.IOException
public MessageRequestHandle<Identifier,java.nio.ByteBuffer> sendMessage(Identifier i, java.nio.ByteBuffer m, MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
sendMessage
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
i
- the destinationm
- the messagedeliverAckToMe
- layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgement, or end-to-end acknowledgement)options
- delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public void messageReceived(Identifier i, java.nio.ByteBuffer m, java.util.Map<java.lang.String,java.lang.Object> options) throws java.io.IOException
TransportLayerCallback
messageReceived
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
i
- The node it is coming fromm
- the messageoptions
- describe how the message arrived (udp/tcp, encrypted etc)
java.io.IOException
- if there is a problem decoding the messagepublic void acceptMessages(boolean b)
TransportLayer
acceptMessages
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public void acceptSockets(boolean b)
TransportLayer
acceptSockets
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public Identifier getLocalIdentifier()
TransportLayer
getLocalIdentifier
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public void setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
TransportLayer
setCallback
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
callback
- the callback for incoming sockets/messagespublic void setErrorHandler(ErrorHandler<Identifier> handler)
TransportLayer
setErrorHandler
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
handler
- to be notified of problems not related to a specific messaage/socket.public void destroy()
destroy
in interface Destructable
public static Environment generateEnvironment()
public static Environment generateEnvironment(int randomSeed)
public static Environment generateEnvironment(RandomSource rs)
public void logSocketException(java.nio.ByteBuffer socketId, java.io.IOException ioe) throws java.io.IOException
java.io.IOException
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |