Rice Pastry API

org.mpisws.p2p.transport.peerreview.history
Interface SecureHistory

All Superinterfaces:
PeerReviewConstants, StatusConstants
All Known Implementing Classes:
PRInconsistent1.ForkingSecureHistory, SecureHistoryImpl

public interface SecureHistory
extends PeerReviewConstants


Field Summary
 
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, PROGRESS_INTERVAL_MILLIS, 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
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.StatusConstants
STATUS_EXPOSED, STATUS_SUSPECTED, STATUS_TRUSTED
 
Method Summary
 void appendEntry(short type, boolean storeFullEntry, java.nio.ByteBuffer... entry)
          Appends a new entry to the log.
 void appendHash(short type, byte[] hash)
          Append a new hashed entry to the log.
 void appendSnippetToHistory(LogSnippet snippet)
           
 void close()
          The destructor.
 long findLastEntry(short[] types, long maxSeq)
          Find the most recent entry whose type is in the specified set.
 long findSeq(long seq)
           
 long findSeqOrHigher(long seq, boolean allowHigher)
          Look up a given sequence number, or the first sequence number that is not lower than a given number.
 long getBaseSeq()
           
 byte[] getEntry(IndexEntry ie, int maxSizeToRead)
           
 byte[] getEntry(long idx, int maxSizeToRead)
          Get the content of a log entry, specified by its record number
 long getLastSeq()
           
 long getNumEntries()
           
 HashSeq getTopLevelEntry()
          Returns the node hash and the sequence number of the most recent log entry
 LogSnippet serializeRange(long idxFrom, long idxTo, HashPolicy hashPolicy)
          Serialize a given range of entries, and write the result to the specified file.
 boolean setNextSeq(long nextSeq)
          Sets the next sequence number to be used.
 IndexEntry statEntry(long idx)
          Retrieve information about a given record
 boolean upgradeHashedEntry(int idx, java.nio.ByteBuffer entry)
          If the log already contains an entry in 'hashed' form and we learn the actual contents later, this function is called.
 

Method Detail

getNumEntries

long getNumEntries()

getBaseSeq

long getBaseSeq()

getLastSeq

long getLastSeq()

getTopLevelEntry

HashSeq getTopLevelEntry()
Returns the node hash and the sequence number of the most recent log entry


appendEntry

void appendEntry(short type,
                 boolean storeFullEntry,
                 java.nio.ByteBuffer... entry)
                 throws java.io.IOException
Appends a new entry to the log. If 'storeFullEntry' is false, only the hash of the entry is stored. If 'header' is not NULL, the log entry is formed by concatenating 'header' and 'entry'; otherwise, only 'entry' is used. Takes an ordered list of ByteBuffers to append

Throws:
java.io.IOException

appendHash

void appendHash(short type,
                byte[] hash)
                throws java.io.IOException
Append a new hashed entry to the log. Unlike appendEntry(), this only keeps the content type, sequence number, and hash values. No entry is made in the data file.

Throws:
java.io.IOException

setNextSeq

boolean setNextSeq(long nextSeq)
Sets the next sequence number to be used. The PeerReview library typically uses the format , where X is a timestamp in microseconds and Y a sequence number. The sequence numbers need not be contigious (and usually aren't)


close

void close()
           throws java.io.IOException
The destructor. Closes the file handles.

Throws:
java.io.IOException

findSeq

long findSeq(long seq)
             throws java.io.IOException
Throws:
java.io.IOException

findSeqOrHigher

long findSeqOrHigher(long seq,
                     boolean allowHigher)
                     throws java.io.IOException
Look up a given sequence number, or the first sequence number that is not lower than a given number. The return value is the number of the corresponding record in the index file, or -1 if no matching record was found.

Throws:
java.io.IOException

serializeRange

LogSnippet serializeRange(long idxFrom,
                          long idxTo,
                          HashPolicy hashPolicy)
                          throws java.io.IOException
Serialize a given range of entries, and write the result to the specified file. This is used when we need to send a portion of our log to some other node, e.g. during an audit. The format of the serialized log segment is as follows: 1. base hash value (size depends on hash function) 2. entry type (1 byte) 3. entry size in bytes (1 byte); 0x00=entry is hashed; 0xFF=16-bit size follows 4. entry content (size as specified; omitted if entry is hashed) 5. difference to next sequence number (1 byte) 0x00: increment by one 0xFF: 64-bit sequence number follows Otherwise: Round down to nearest multiple of 1000, then add specified value times 1000 6. repeat 2-5 as often as necessary; 5 is omitted on last entry.4 Note that the idxFrom and idxTo arguments are record numbers, NOT sequence numbers. Use findSeqOrHigher() to get these if only sequence numbers are known.

Throws:
java.io.IOException

statEntry

IndexEntry statEntry(long idx)
                     throws java.io.IOException
Retrieve information about a given record

Parameters:
idx - the index you are interested in
Throws:
java.io.IOException

getEntry

byte[] getEntry(long idx,
                int maxSizeToRead)
                throws java.io.IOException
Get the content of a log entry, specified by its record number

Throws:
java.io.IOException

getEntry

byte[] getEntry(IndexEntry ie,
                int maxSizeToRead)
                throws java.io.IOException
Throws:
java.io.IOException

upgradeHashedEntry

boolean upgradeHashedEntry(int idx,
                           java.nio.ByteBuffer entry)
                           throws java.io.IOException
If the log already contains an entry in 'hashed' form and we learn the actual contents later, this function is called.

Throws:
java.io.IOException

findLastEntry

long findLastEntry(short[] types,
                   long maxSeq)
                   throws java.io.IOException
Find the most recent entry whose type is in the specified set. Useful e.g. for locating the last CHECKPOINT or INIT entry.

Throws:
java.io.IOException

appendSnippetToHistory

void appendSnippetToHistory(LogSnippet snippet)
                            throws java.io.IOException
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection