]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/utilities/checkpoint/checkpoint_impl.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / utilities / checkpoint / checkpoint_impl.h
CommitLineData
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
9#include "rocksdb/utilities/checkpoint.h"
10
11#include <string>
12#include "rocksdb/db.h"
13#include "util/filename.h"
14
15namespace rocksdb {
16
17class CheckpointImpl : public Checkpoint {
18 public:
19 // Creates a Checkpoint object to be used for creating openable snapshots
20 explicit CheckpointImpl(DB* db) : db_(db) {}
21
22 // Builds an openable snapshot of RocksDB on the same disk, which
23 // accepts an output directory on the same disk, and under the directory
24 // (1) hard-linked SST files pointing to existing live SST files
25 // SST files will be copied if output directory is on a different filesystem
26 // (2) a copied manifest files and other files
27 // The directory should not already exist and will be created by this API.
28 // The directory will be an absolute path
29 using Checkpoint::CreateCheckpoint;
30 virtual Status CreateCheckpoint(const std::string& checkpoint_dir,
31 uint64_t log_size_for_flush) override;
32
33 // Checkpoint logic can be customized by providing callbacks for link, copy,
34 // or create.
35 Status CreateCustomCheckpoint(
36 const DBOptions& db_options,
37 std::function<Status(const std::string& src_dirname,
38 const std::string& fname, FileType type)>
39 link_file_cb,
40 std::function<Status(const std::string& src_dirname,
41 const std::string& fname, uint64_t size_limit_bytes,
42 FileType type)>
43 copy_file_cb,
44 std::function<Status(const std::string& fname,
45 const std::string& contents, FileType type)>
46 create_file_cb,
47 uint64_t* sequence_number, uint64_t log_size_for_flush);
48
49 private:
11fdf7f2 50 void CleanStagingDirectory(const std::string& path, Logger* info_log);
7c673cae
FG
51 DB* db_;
52};
53
54} // namespace rocksdb
55
56#endif // ROCKSDB_LITE