0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-11 23:00:52 +00:00
termux-packages/packages/pika/third-blackwidow-src-db_checkpoint.cc.patch
2022-11-19 16:38:51 +00:00

86 lines
3.5 KiB
Diff

--- a/third/blackwidow/src/db_checkpoint.cc
+++ b/third/blackwidow/src/db_checkpoint.cc
@@ -18,16 +18,30 @@
#include <inttypes.h>
#include "rocksdb/db.h"
-#include "util/file_util.h"
+//#include "util/file_util.h"
#if (ROCKSDB_MAJOR < 5 || (ROCKSDB_MAJOR == 5 && ROCKSDB_MINOR < 3))
#include "db/filename.h"
#else
-#include "util/filename.h"
+//#include "util/filename.h"
#endif
namespace rocksdb {
+class IOTracer;
+
+extern Status CopyFile(FileSystem* env, const std::string& source,
+ const std::string& destination, uint64_t size,
+ bool use_fsync,
+ const std::shared_ptr<IOTracer>& io_tracer = nullptr,
+ const Temperature temperature = Temperature::kUnknown);
+
+extern Status CreateFile(FileSystem* env, const std::string& destination,
+ const std::string& contents, bool);
+
+extern bool ParseFileName(const std::string& filename, uint64_t* number,
+ FileType* type, WalFileType* log_type = nullptr);
+
class DBCheckpointImpl : public DBCheckpoint {
public:
// Creates a DBCheckPoint object to be used for creating openable snapshots
@@ -177,11 +190,11 @@
if ((type != kTableFile) || (!same_fs)) {
Log(db_->GetOptions().info_log, "Copying %s", src_fname.c_str());
#if (ROCKSDB_MAJOR < 5 || (ROCKSDB_MAJOR == 5 && ROCKSDB_MINOR < 3))
- s = CopyFile(db_->GetEnv(), db_->GetName() + src_fname,
+ s = CopyFile(db_->GetFileSystem(), db_->GetName() + src_fname,
full_private_path + src_fname,
(type == kDescriptorFile) ? manifest_file_size : 0);
#else
- s = CopyFile(db_->GetEnv(), db_->GetName() + src_fname,
+ s = CopyFile(db_->GetFileSystem(), db_->GetName() + src_fname,
full_private_path + src_fname,
(type == kDescriptorFile) ? manifest_file_size : 0, false);
#endif
@@ -193,7 +206,7 @@
s = CreateFile(db_->GetEnv(), full_private_path + current_fname,
manifest_fname.substr(1) + "\n");
#else
- s = CreateFile(db_->GetEnv(), full_private_path + current_fname,
+ s = CreateFile(db_->GetFileSystem(), full_private_path + current_fname,
manifest_fname.substr(1) + "\n", false);
#endif
}
@@ -214,7 +227,7 @@
full_private_path + live_wal_files[i]->PathName(),
live_wal_files[i]->SizeFileBytes());
#else
- s = CopyFile(db_->GetEnv(),
+ s = CopyFile(db_->GetFileSystem(),
db_->GetOptions().wal_dir + live_wal_files[i]->PathName(),
full_private_path + live_wal_files[i]->PathName(),
live_wal_files[i]->SizeFileBytes(), false);
@@ -241,7 +254,7 @@
db_->GetOptions().wal_dir + live_wal_files[i]->PathName(),
full_private_path + live_wal_files[i]->PathName(), 0);
#else
- s = CopyFile(db_->GetEnv(),
+ s = CopyFile(db_->GetFileSystem(),
db_->GetOptions().wal_dir + live_wal_files[i]->PathName(),
full_private_path + live_wal_files[i]->PathName(),
0, false);
@@ -258,7 +271,7 @@
s = db_->GetEnv()->RenameFile(full_private_path, checkpoint_dir);
}
if (s.ok()) {
- unique_ptr<Directory> checkpoint_directory;
+ std::unique_ptr<Directory> checkpoint_directory;
db_->GetEnv()->NewDirectory(checkpoint_dir, &checkpoint_directory);
if (checkpoint_directory != nullptr) {
s = checkpoint_directory->Fsync();