public class LocalSnapshotWriter extends SnapshotWriter
JRAFT_SNAPSHOT_META_FILE, JRAFT_SNAPSHOT_PREFIX, REMOTE_SNAPSHOT_URI_SCHEME| 构造器和说明 |
|---|
LocalSnapshotWriter(String path,
LocalSnapshotStorage snapshotStorage,
RaftOptions raftOptions) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
addFile(String fileName,
com.google.protobuf.Message fileMeta)
Adds a snapshot file with metadata.
|
void |
close() |
void |
close(boolean keepDataOnError)
Close the writer.
|
com.google.protobuf.Message |
getFileMeta(String fileName)
Get file meta by fileName.
|
String |
getPath()
Get the path of the Snapshot
|
long |
getSnapshotIndex() |
boolean |
init(Void v)
Initialize the service.
|
Set<String> |
listFiles()
List all the existing files in the Snapshot currently
|
boolean |
removeFile(String fileName)
Remove a snapshot file.
|
boolean |
saveMeta(RaftOutter.SnapshotMeta meta)
Save a snapshot metadata.
|
void |
shutdown()
Dispose the resources for service.
|
boolean |
sync() |
addFilecopy, equals, getCode, getErrorMsg, getRaftError, hashCode, isOk, OK, reset, setCode, setError, setError, setErrorMsg, toStringpublic LocalSnapshotWriter(String path, LocalSnapshotStorage snapshotStorage, RaftOptions raftOptions)
public boolean init(Void v)
Lifecyclepublic long getSnapshotIndex()
public void shutdown()
Lifecyclepublic void close()
throws IOException
IOExceptionpublic void close(boolean keepDataOnError)
throws IOException
SnapshotWriterclose 在类中 SnapshotWriterkeepDataOnError - whether to keep data when error happens.IOException - if occurred an IO errorpublic boolean saveMeta(RaftOutter.SnapshotMeta meta)
SnapshotWritersaveMeta 在类中 SnapshotWritermeta - snapshot metadatapublic boolean sync()
throws IOException
IOExceptionpublic boolean addFile(String fileName, com.google.protobuf.Message fileMeta)
SnapshotWriteraddFile 在类中 SnapshotWriterfileName - file namefileMeta - file metadatapublic boolean removeFile(String fileName)
SnapshotWriterremoveFile 在类中 SnapshotWriterfileName - file namepublic Set<String> listFiles()
Snapshotpublic com.google.protobuf.Message getFileMeta(String fileName)
SnapshotgetFileMeta 在类中 SnapshotCopyright © 2021. All rights reserved.