|
Rice Pastry API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mpisws.p2p.transport.peerreview.history.SecureHistoryImpl
public class SecureHistoryImpl
The following class implements PeerReview's log. A log entry consists of a sequence number, a type, and a string of bytes. On disk, the log is stored as two files: An index file and a data file.
| Constructor Summary | |
|---|---|
SecureHistoryImpl(RandomAccessFileIOBuffer indexFile,
RandomAccessFileIOBuffer dataFile,
boolean readOnly,
HashProvider hashProv,
IndexEntryFactory indexFactory,
Logger logger)
|
|
| Method Summary | |
|---|---|
void |
appendEntry(short type,
boolean storeFullEntry,
java.nio.ByteBuffer... entry)
Appends a new entry to the log. |
void |
appendHash(short type,
Hash hash)
Append a new hashed entry to the log. |
void |
close()
The destructor. |
long |
findLastEntry(short[] types,
long maxSeq)
Find the most recent entry whose type is in the specified set. |
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 |
boolean |
serializeRange(int idxFrom,
int idxTo,
HashPolicy hashPolicy,
RandomAccessFileIOBuffer outfile)
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SecureHistoryImpl(RandomAccessFileIOBuffer indexFile,
RandomAccessFileIOBuffer dataFile,
boolean readOnly,
HashProvider hashProv,
IndexEntryFactory indexFactory,
Logger logger)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public long getBaseSeq()
getBaseSeq in interface SecureHistorypublic long getLastSeq()
getLastSeq in interface SecureHistorypublic long getNumEntries()
getNumEntries in interface SecureHistorypublic HashSeq getTopLevelEntry()
getTopLevelEntry in interface SecureHistory
public void appendEntry(short type,
boolean storeFullEntry,
java.nio.ByteBuffer... entry)
throws java.io.IOException
appendEntry in interface SecureHistoryjava.io.IOException
public void appendHash(short type,
Hash hash)
throws java.io.IOException
appendHash in interface SecureHistoryjava.io.IOExceptionpublic boolean setNextSeq(long nextSeq)
setNextSeq in interface SecureHistory
public void close()
throws java.io.IOException
close in interface SecureHistoryjava.io.IOException
public long findSeqOrHigher(long seq,
boolean allowHigher)
throws java.io.IOException
findSeqOrHigher in interface SecureHistoryjava.io.IOException
public boolean serializeRange(int idxFrom,
int idxTo,
HashPolicy hashPolicy,
RandomAccessFileIOBuffer outfile)
throws java.io.IOException
serializeRange in interface SecureHistoryjava.io.IOException
public IndexEntry statEntry(long idx)
throws java.io.IOException
statEntry in interface SecureHistoryidx - the index you are interested in
java.io.IOException
public byte[] getEntry(long idx,
int maxSizeToRead)
throws java.io.IOException
getEntry in interface SecureHistoryjava.io.IOException
public byte[] getEntry(IndexEntry ie,
int maxSizeToRead)
throws java.io.IOException
getEntry in interface SecureHistoryjava.io.IOException
public boolean upgradeHashedEntry(int idx,
java.nio.ByteBuffer entry)
throws java.io.IOException
upgradeHashedEntry in interface SecureHistoryjava.io.IOException
public long findLastEntry(short[] types,
long maxSeq)
throws java.io.IOException
findLastEntry in interface SecureHistoryjava.io.IOException
|
Rice Pastry API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||