]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/utilities/checkpoint/checkpoint_impl.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / utilities / checkpoint / checkpoint_impl.h
1 // Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5
6 #pragma once
7 #ifndef ROCKSDB_LITE
8
9 #include <string>
10
11 #include "file/filename.h"
12 #include "rocksdb/db.h"
13 #include "rocksdb/utilities/checkpoint.h"
14
15 namespace ROCKSDB_NAMESPACE {
16
17 class CheckpointImpl : public Checkpoint {
18 public:
19 explicit CheckpointImpl(DB* db) : db_(db) {}
20
21 Status CreateCheckpoint(const std::string& checkpoint_dir,
22 uint64_t log_size_for_flush,
23 uint64_t* sequence_number_ptr) override;
24
25 Status ExportColumnFamily(ColumnFamilyHandle* handle,
26 const std::string& export_dir,
27 ExportImportFilesMetaData** metadata) override;
28
29 // Checkpoint logic can be customized by providing callbacks for link, copy,
30 // or create.
31 Status CreateCustomCheckpoint(
32 std::function<Status(const std::string& src_dirname,
33 const std::string& fname, FileType type)>
34 link_file_cb,
35 std::function<Status(const std::string& src_dirname,
36 const std::string& fname, uint64_t size_limit_bytes,
37 FileType type, const std::string& checksum_func_name,
38 const std::string& checksum_val,
39 const Temperature src_temperature)>
40 copy_file_cb,
41 std::function<Status(const std::string& fname,
42 const std::string& contents, FileType type)>
43 create_file_cb,
44 uint64_t* sequence_number, uint64_t log_size_for_flush,
45 bool get_live_table_checksum = false);
46
47 private:
48 void CleanStagingDirectory(const std::string& path, Logger* info_log);
49
50 // Export logic customization by providing callbacks for link or copy.
51 Status ExportFilesInMetaData(
52 const DBOptions& db_options, const ColumnFamilyMetaData& metadata,
53 std::function<Status(const std::string& src_dirname,
54 const std::string& fname)>
55 link_file_cb,
56 std::function<Status(const std::string& src_dirname,
57 const std::string& fname)>
58 copy_file_cb);
59
60 private:
61 DB* db_;
62 };
63
64 } // namespace ROCKSDB_NAMESPACE
65
66 #endif // ROCKSDB_LITE