use of io.dingodb.raft.entity.LocalStorageOutter.LocalSnapshotPbMeta.File in project dingo by dingodb.
the class LocalSnapshotMetaTable method saveToFile.
/**
* Save metadata infos into file by path.
*/
public boolean saveToFile(String path) throws IOException {
LocalSnapshotPbMeta.Builder pbMeta = LocalSnapshotPbMeta.newBuilder();
if (hasMeta()) {
pbMeta.setMeta(this.meta);
}
for (Map.Entry<String, LocalFileMeta> entry : this.fileMap.entrySet()) {
File f = File.newBuilder().setName(entry.getKey()).setMeta(entry.getValue()).build();
pbMeta.addFiles(f);
}
ProtoBufFile pbFile = new ProtoBufFile(path);
return pbFile.save(pbMeta.build(), this.raftOptions.isSyncMeta());
}
Aggregations