]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2017-present, Facebook, Inc. All rights reserved. |
11fdf7f2 TL |
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). | |
7c673cae FG |
5 | |
6 | #pragma once | |
7 | #ifndef ROCKSDB_LITE | |
8 | ||
7c673cae | 9 | #include <string> |
1e59de90 | 10 | |
f67539c2 | 11 | #include "file/filename.h" |
7c673cae | 12 | #include "rocksdb/db.h" |
1e59de90 | 13 | #include "rocksdb/utilities/checkpoint.h" |
7c673cae | 14 | |
f67539c2 | 15 | namespace ROCKSDB_NAMESPACE { |
7c673cae FG |
16 | |
17 | class CheckpointImpl : public Checkpoint { | |
18 | public: | |
7c673cae FG |
19 | explicit CheckpointImpl(DB* db) : db_(db) {} |
20 | ||
1e59de90 TL |
21 | Status CreateCheckpoint(const std::string& checkpoint_dir, |
22 | uint64_t log_size_for_flush, | |
23 | uint64_t* sequence_number_ptr) override; | |
7c673cae | 24 | |
1e59de90 TL |
25 | Status ExportColumnFamily(ColumnFamilyHandle* handle, |
26 | const std::string& export_dir, | |
27 | ExportImportFilesMetaData** metadata) override; | |
f67539c2 | 28 | |
7c673cae FG |
29 | // Checkpoint logic can be customized by providing callbacks for link, copy, |
30 | // or create. | |
31 | Status CreateCustomCheckpoint( | |
7c673cae FG |
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, | |
20effc67 | 37 | FileType type, const std::string& checksum_func_name, |
1e59de90 TL |
38 | const std::string& checksum_val, |
39 | const Temperature src_temperature)> | |
7c673cae FG |
40 | copy_file_cb, |
41 | std::function<Status(const std::string& fname, | |
42 | const std::string& contents, FileType type)> | |
43 | create_file_cb, | |
20effc67 TL |
44 | uint64_t* sequence_number, uint64_t log_size_for_flush, |
45 | bool get_live_table_checksum = false); | |
7c673cae FG |
46 | |
47 | private: | |
11fdf7f2 | 48 | void CleanStagingDirectory(const std::string& path, Logger* info_log); |
f67539c2 TL |
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: | |
7c673cae FG |
61 | DB* db_; |
62 | }; | |
63 | ||
f67539c2 | 64 | } // namespace ROCKSDB_NAMESPACE |
7c673cae FG |
65 | |
66 | #endif // ROCKSDB_LITE |