|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.zookeeper.server.persistence.FileTxnSnapLog
public class FileTxnSnapLog
This is a helper class above the implementations of txnlog and snapshot classes
Nested Class Summary | |
---|---|
static interface |
FileTxnSnapLog.PlayBackListener
This listener helps the external apis calling restore to gather information while the data is being restored. |
Field Summary | |
---|---|
static String |
version
|
static int |
VERSION
|
Constructor Summary | |
---|---|
FileTxnSnapLog(File dataDir,
File snapDir)
the constructor which takes the datadir and snapdir. |
Method Summary | |
---|---|
void |
append(Request si)
append the request to the transaction logs |
void |
commit()
commit the transaction of logs |
File |
findMostRecentSnapshot()
the most recent snapshot in the snapshot directory |
List<File> |
findNRecentSnapshots(int n)
the n most recent snapshots |
File |
getDataDir()
get the datadir used by this filetxn snap log |
long |
getLastLoggedZxid()
the last logged zxid on the transaction logs |
File |
getSnapDir()
get the snap dir used by this filetxn snap log |
File[] |
getSnapshotLogs(long zxid)
get the snapshot logs that are greater than the given zxid |
long |
restore(DataTree dt,
Map<Long,Integer> sessions,
FileTxnSnapLog.PlayBackListener listener)
this function restors the server database after reading from the snapshots and transaction logs |
void |
rollLog()
roll the transaction logs |
void |
save(DataTree dataTree,
ConcurrentHashMap<Long,Integer> sessionsWithTimeouts)
save the datatree and the sessions into a snapshot |
boolean |
truncateLog(long zxid)
truncate the transaction logs the zxid specified |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VERSION
public static final String version
Constructor Detail |
---|
public FileTxnSnapLog(File dataDir, File snapDir) throws IOException
dataDir
- the trasaction directorysnapDir
- the snapshot directory
IOException
Method Detail |
---|
public File getDataDir()
public File getSnapDir()
public long restore(DataTree dt, Map<Long,Integer> sessions, FileTxnSnapLog.PlayBackListener listener) throws IOException
dt
- the datatree to be restoredsessions
- the sessions to be restoredlistener
- the playback listener to run on the
database restoration
IOException
public long getLastLoggedZxid()
public void save(DataTree dataTree, ConcurrentHashMap<Long,Integer> sessionsWithTimeouts) throws IOException
dataTree
- the datatree to be serialized onto disksessionsWithTimeouts
- the sesssion timeouts to be
serialized onto disk
IOException
public boolean truncateLog(long zxid) throws IOException
zxid
- the zxid to truncate the logs to
IOException
public File findMostRecentSnapshot() throws IOException
IOException
public List<File> findNRecentSnapshots(int n) throws IOException
n
- the number of recent snapshots
IOException
public File[] getSnapshotLogs(long zxid)
zxid
- the zxid that contains logs greater than
zxid
public void append(Request si) throws IOException
si
- the request to be appended
IOException
public void commit() throws IOException
IOException
public void rollLog() throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |