Rice Pastry API

org.mpisws.p2p.transport.peerreview
Class Verifier<Identifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.peerreview.Verifier<Identifier>
All Implemented Interfaces:
PeerReviewEvents
Direct Known Subclasses:
ReplayLayer

public abstract class Verifier<Identifier>
extends java.lang.Object
implements PeerReviewEvents


Field Summary
protected  HashProvider hashProv
           
protected  SecureHistory history
           
protected  Identifier localHandle
           
protected  Logger logger
           
protected  IdentifierSerializer<Identifier> serializer
           
 
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
Verifier(IdentifierSerializer<Identifier> serializer, HashProvider hashProv, SecureHistory history, Identifier localHandle, short signatureSizeBytes, short hashSizeBytes, int firstEntryToReplay, Logger logger)
           
 
Method Summary
 void close(int socketId)
           
protected  java.io.IOException deserializeException(InputBuffer nextEvent)
           
protected  void fetchNextEvent()
          Fetch the next log entry, or set the EOF flag
 void generatedSocketException(int socketId, java.io.IOException ioe)
           
 IndexEntry getNextEvent()
           
 long getNextEventTime()
           
protected abstract  void incomingSocket(Identifier from, int socketId)
          Callback when a socket comes in from a remote node.
 boolean isSuccess()
           
 boolean makeProgress()
          This is called by the Audit protocol to make another replay step; it returns true if further calls are necessary, and false if the replay has finished.
 int openSocket(Identifier target)
          Return the new socketId
 int readSocket(int socketId, java.nio.ByteBuffer dst)
          Return the bytes read.
protected abstract  void receive(Identifier from, java.nio.ByteBuffer msg)
          Callback when a message has arrived.
 void registerEvent(EventCallback callback, short... eventType)
          This binds specific event types to one of the handlers
 void registerEvent(EventCallback callback, short eventType)
           
protected  void send(Identifier target, java.nio.ByteBuffer message, int relevantLen)
          Called by the state machine when it wants to send a message
 void shutdownOutput(int socketId)
           
protected abstract  void socketException(int socketId, java.io.IOException ioe)
           
protected abstract  void socketIO(int socketId, boolean canRead, boolean canWrite)
          Callback when a socket is ready to read/write.
protected abstract  void socketOpened(int socketId)
           
 boolean verifiedOK()
           
 int writeSocket(int socketId, java.nio.ByteBuffer src)
          Return the bytes written.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localHandle

protected Identifier localHandle

history

protected SecureHistory history

logger

protected Logger logger

serializer

protected IdentifierSerializer<Identifier> serializer

hashProv

protected HashProvider hashProv
Constructor Detail

Verifier

public Verifier(IdentifierSerializer<Identifier> serializer,
                HashProvider hashProv,
                SecureHistory history,
                Identifier localHandle,
                short signatureSizeBytes,
                short hashSizeBytes,
                int firstEntryToReplay,
                Logger logger)
         throws java.io.IOException
Throws:
java.io.IOException
Method Detail

verifiedOK

public boolean verifiedOK()

getNextEvent

public IndexEntry getNextEvent()

receive

protected abstract void receive(Identifier from,
                                java.nio.ByteBuffer msg)
                         throws java.io.IOException
Callback when a message has arrived.

Parameters:
from -
msg -
Throws:
java.io.IOException

incomingSocket

protected abstract void incomingSocket(Identifier from,
                                       int socketId)
                                throws java.io.IOException
Callback when a socket comes in from a remote node.

Parameters:
from -
socketId -
Throws:
java.io.IOException

socketIO

protected abstract void socketIO(int socketId,
                                 boolean canRead,
                                 boolean canWrite)
                          throws java.io.IOException
Callback when a socket is ready to read/write. Note that the simulated node should have already registered for this event, even though it is not logged. If the node is not registred for the event, it is an error.

Parameters:
socketId -
canRead -
canWrite -
Throws:
java.io.IOException

socketOpened

protected abstract void socketOpened(int socketId)
                              throws java.io.IOException
Throws:
java.io.IOException

socketException

protected abstract void socketException(int socketId,
                                        java.io.IOException ioe)
                                 throws java.io.IOException
Throws:
java.io.IOException

fetchNextEvent

protected void fetchNextEvent()
Fetch the next log entry, or set the EOF flag


send

protected void send(Identifier target,
                    java.nio.ByteBuffer message,
                    int relevantLen)
             throws java.io.IOException
Called by the state machine when it wants to send a message

Throws:
java.io.IOException

openSocket

public int openSocket(Identifier target)
               throws java.io.IOException
Return the new socketId

Parameters:
i -
Returns:
the new socketId, Integer.MIN_VALUE for an error
Throws:
java.io.IOException

readSocket

public int readSocket(int socketId,
                      java.nio.ByteBuffer dst)
               throws java.io.IOException
Return the bytes read.

Parameters:
socketId -
Returns:
number of bytes read
Throws:
java.io.IOException

generatedSocketException

public void generatedSocketException(int socketId,
                                     java.io.IOException ioe)

writeSocket

public int writeSocket(int socketId,
                       java.nio.ByteBuffer src)
                throws java.io.IOException
Return the bytes written.

Parameters:
socketId -
Returns:
number of bytes written
Throws:
java.io.IOException

close

public void close(int socketId)

shutdownOutput

public void shutdownOutput(int socketId)

registerEvent

public void registerEvent(EventCallback callback,
                          short... eventType)
This binds specific event types to one of the handlers


registerEvent

public void registerEvent(EventCallback callback,
                          short eventType)

makeProgress

public boolean makeProgress()
This is called by the Audit protocol to make another replay step; it returns true if further calls are necessary, and false if the replay has finished. The idea is that we can stop calling this if there is more important work to do, e.g. handle foreground requests


getNextEventTime

public long getNextEventTime()

isSuccess

public boolean isSuccess()

deserializeException

protected java.io.IOException deserializeException(InputBuffer nextEvent)
                                            throws java.io.IOException
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection