|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.zookeeper.server.persistence.FileTxnLog
public class FileTxnLog
This class implements the TxnLog interface. It provides api's to access the txnlogs and add entries to it.
Nested Class Summary | |
---|---|
static class |
FileTxnLog.FileTxnIterator
this class implements the txnlog iterator interface which is used for reading the transaction logs |
Nested classes/interfaces inherited from interface org.apache.zookeeper.server.persistence.TxnLog |
---|
TxnLog.TxnIterator |
Field Summary | |
---|---|
static int |
TXNLOG_MAGIC
|
static int |
VERSION
|
Constructor Summary | |
---|---|
FileTxnLog(File logDir)
constructor for FileTxnLog. |
Method Summary | |
---|---|
void |
append(org.apache.zookeeper.txn.TxnHeader hdr,
Record txn)
append an entry to the transaction log |
void |
commit()
commit the logs. |
long |
getDbId()
the dbid of this transaction database |
long |
getLastLoggedZxid()
get the last zxid that was logged in the transaction logs |
static File[] |
getLogFiles(File[] logDirList,
long snapshotZxid)
Find the log file that starts at, or just before, the snapshot. |
protected Checksum |
makeChecksumAlgorithm()
creates a checksum alogrithm to be used |
TxnLog.TxnIterator |
read(long zxid)
start reading all the transactions from the given zxid |
void |
rollLog()
rollover the current log file to a new one. |
static void |
setPreallocSize(long size)
method to allow setting preallocate size of log file to pad the file. |
boolean |
truncate(long zxid)
truncate the current transaction logs |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TXNLOG_MAGIC
public static final int VERSION
Constructor Detail |
---|
public FileTxnLog(File logDir)
logDir
- the directory where the txnlogs are storedMethod Detail |
---|
public static void setPreallocSize(long size)
size
- the size to set to in bytesprotected Checksum makeChecksumAlgorithm()
public void rollLog() throws IOException
rollLog
in interface TxnLog
IOException
public void append(org.apache.zookeeper.txn.TxnHeader hdr, Record txn) throws IOException
append
in interface TxnLog
hdr
- the header of the transactiontxn
- the transaction part of the entry
IOException
public static File[] getLogFiles(File[] logDirList, long snapshotZxid)
logDirList
- array of filessnapshotZxid
- return files at, or before this zxid
public long getLastLoggedZxid()
getLastLoggedZxid
in interface TxnLog
public void commit() throws IOException
commit
in interface TxnLog
IOException
public TxnLog.TxnIterator read(long zxid) throws IOException
read
in interface TxnLog
zxid
- the zxid to start reading transactions from
IOException
public boolean truncate(long zxid) throws IOException
truncate
in interface TxnLog
zxid
- the zxid to truncate the logs to
IOException
public long getDbId() throws IOException
getDbId
in interface TxnLog
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |