Modifier and Type | Field and Description |
---|---|
static int |
SNAP_MAGIC |
static String |
SNAPSHOT_FILE_PREFIX |
Modifier and Type | Method and Description |
---|---|
void |
close()
synchronized close just so that if serialize is in place
the close operation will block and will wait till serialize
is done and will set the close flag
|
long |
deserialize(DataTree dt,
Map<Long,Integer> sessions)
deserialize a data tree from the most recent snapshot
|
void |
deserialize(DataTree dt,
Map<Long,Integer> sessions,
InputArchive ia)
deserialize the datatree from an inputarchive
|
File |
findMostRecentSnapshot()
find the most recent snapshot in the database.
|
List<File> |
findNRecentSnapshots(int n)
find the last n snapshots.
|
protected List<File> |
findNValidSnapshots(int n)
find the last (maybe) valid n snapshots.
|
SnapshotInfo |
getLastSnapshotInfo()
get information of the last saved/restored snapshot
|
void |
serialize(DataTree dt,
Map<Long,Integer> sessions,
File snapShot,
boolean fsync)
serialize the datatree and session into the file snapshot
|
protected void |
serialize(DataTree dt,
Map<Long,Integer> sessions,
OutputArchive oa,
FileHeader header)
serialize the datatree and sessions
|
public static final int SNAP_MAGIC
public static final String SNAPSHOT_FILE_PREFIX
public FileSnap(File snapDir)
public SnapshotInfo getLastSnapshotInfo()
getLastSnapshotInfo
in interface SnapShot
public long deserialize(DataTree dt, Map<Long,Integer> sessions) throws IOException
deserialize
in interface SnapShot
dt
- the datatree to be deserialized intosessions
- the sessions to be deserialized intoIOException
public void deserialize(DataTree dt, Map<Long,Integer> sessions, InputArchive ia) throws IOException
dt
- the datatree to be serialized intosessions
- the sessions to be filled upia
- the input archive to restore fromIOException
public File findMostRecentSnapshot() throws IOException
findMostRecentSnapshot
in interface SnapShot
IOException
protected List<File> findNValidSnapshots(int n) throws IOException
n
- the number of most recent snapshotsIOException
public List<File> findNRecentSnapshots(int n) throws IOException
n
- the number of most recent snapshotsIOException
protected void serialize(DataTree dt, Map<Long,Integer> sessions, OutputArchive oa, FileHeader header) throws IOException
dt
- the datatree to be serializedsessions
- the sessions to be serializedoa
- the output archive to serialize intoheader
- the header of this snapshotIOException
public void serialize(DataTree dt, Map<Long,Integer> sessions, File snapShot, boolean fsync) throws IOException
serialize
in interface SnapShot
dt
- the datatree to be serializedsessions
- the sessions to be serializedsnapShot
- the file to store snapshot intofsync
- sync the file immediately after writeIOException
public void close() throws IOException
close
in interface SnapShot
IOException
Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.