public class FsSnapshotWriter extends Object implements SnapshotWriter
| Modifier and Type | Field and Description |
|---|---|
protected File |
checksumFile |
protected FsSnapshotStorageConfiguration |
config |
protected File |
dataFile |
protected DigestOutputStream |
dataOutputStream |
protected FsReadableSnapshot |
lastSnapshot |
static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
FsSnapshotWriter(FsSnapshotStorageConfiguration config,
File snapshotFile,
File checksumFile,
FsReadableSnapshot lastSnapshot) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Refuse the snapshot by closing the output stream and deleting the snapshot data.
|
void |
commit()
Completes the snapshot by closing the output stream and writing the checksum.
|
protected void |
commit(byte[] checksum) |
protected void |
deleteLastSnapshot() |
File |
getChecksumFile() |
File |
getDataFile() |
protected String |
getDataFileName() |
OutputStream |
getOutputStream()
Returns the output stream of the snapshot which should be used to write the snapshot data.
|
protected void |
initOutputStreams(FsSnapshotStorageConfiguration config,
File snapshotFile) |
void |
validateAndCommit(byte[] checksum)
Completes the snapshot by closing the output stream and writing its checksum, iff the checksum
is equal to the given checksum.
|
protected void |
writeChecksumFile(byte[] checksum) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwriteSnapshotpublic static final org.slf4j.Logger LOG
protected final FsSnapshotStorageConfiguration config
protected final File dataFile
protected final File checksumFile
protected final FsReadableSnapshot lastSnapshot
protected DigestOutputStream dataOutputStream
public FsSnapshotWriter(FsSnapshotStorageConfiguration config, File snapshotFile, File checksumFile, FsReadableSnapshot lastSnapshot)
protected void initOutputStreams(FsSnapshotStorageConfiguration config, File snapshotFile)
public OutputStream getOutputStream()
SnapshotWriterSnapshotWriter.commit() or SnapshotWriter.abort().getOutputStream in interface SnapshotWriterpublic void commit()
throws Exception
SnapshotWritercommit in interface SnapshotWriterException - if fails to write the checksumpublic void validateAndCommit(byte[] checksum)
throws Exception
SnapshotWriterIt will call abort on exception, or if the checksums do not match.
validateAndCommit in interface SnapshotWriterchecksum - checksum to check againstExceptionpublic void abort()
SnapshotWriterabort in interface SnapshotWriterpublic File getChecksumFile()
public File getDataFile()
protected String getDataFileName()
protected void writeChecksumFile(byte[] checksum)
throws Exception
Exceptionprotected void deleteLastSnapshot()
Copyright © 2017–2018 camunda services GmbH. All rights reserved.