]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/db_stress_tool/db_stress_env_wrapper.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / db_stress_tool / db_stress_env_wrapper.h
CommitLineData
f67539c2
TL
1// Copyright (c) 2011-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// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7// Use of this source code is governed by a BSD-style license that can be
8// found in the LICENSE file. See the AUTHORS file for names of contributors.
9
10#ifdef GFLAGS
11#pragma once
12#include "db_stress_tool/db_stress_common.h"
13
14namespace ROCKSDB_NAMESPACE {
15class DbStressEnvWrapper : public EnvWrapper {
16 public:
17 explicit DbStressEnvWrapper(Env* t) : EnvWrapper(t) {}
18
19 Status DeleteFile(const std::string& f) override {
20 // We determine whether it is a manifest file by searching a strong,
21 // so that there will be false positive if the directory path contains the
22 // keyword but it is unlikely.
20effc67 23 // Checkpoint, backup, and restore directories needs to be exempted.
f67539c2
TL
24 if (!if_preserve_all_manifests ||
25 f.find("MANIFEST-") == std::string::npos ||
20effc67
TL
26 f.find("checkpoint") != std::string::npos ||
27 f.find(".backup") != std::string::npos ||
28 f.find(".restore") != std::string::npos) {
f67539c2
TL
29 return target()->DeleteFile(f);
30 }
31 return Status::OK();
32 }
33
34 // If true, all manifest files will not be delted in DeleteFile().
35 bool if_preserve_all_manifests = true;
36};
37} // namespace ROCKSDB_NAMESPACE
38#endif // GFLAGS