Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / osd / ScrubStore.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_SCRUB_RESULT_H
5 #define CEPH_SCRUB_RESULT_H
6
7 #include "SnapMapper.h"         // for OSDriver
8 #include "common/map_cacher.hpp"
9
10 namespace librados {
11   struct object_id_t;
12 }
13
14 struct inconsistent_obj_wrapper;
15 struct inconsistent_snapset_wrapper;
16
17 namespace Scrub {
18
19 class Store {
20 public:
21   ~Store();
22   static Store* create(ObjectStore* store,
23                        ObjectStore::Transaction* t,
24                        const spg_t& pgid,
25                        const coll_t& coll);
26   void add_object_error(int64_t pool, const inconsistent_obj_wrapper& e);
27   void add_snap_error(int64_t pool, const inconsistent_snapset_wrapper& e);
28   bool empty() const;
29   void flush(ObjectStore::Transaction *);
30   void cleanup(ObjectStore::Transaction *);
31   std::vector<bufferlist> get_snap_errors(ObjectStore* store,
32                                           int64_t pool,
33                                           const librados::object_id_t& start,
34                                           uint64_t max_return);
35   std::vector<bufferlist> get_object_errors(ObjectStore* store,
36                                             int64_t pool,
37                                             const librados::object_id_t& start,
38                                             uint64_t max_return);
39 private:
40   Store(const coll_t& coll, const ghobject_t& oid, ObjectStore* store);
41   std::vector<bufferlist> get_errors(ObjectStore* store,
42                                      const string& start, const string& end,
43                                      uint64_t max_return);
44 private:
45   const coll_t coll;
46   const ghobject_t hoid;
47   // a temp object holding mappings from seq-id to inconsistencies found in
48   // scrubbing
49   OSDriver driver;
50   MapCacher::MapCacher<std::string, bufferlist> backend;
51   map<string, bufferlist> results;
52 };
53 }
54
55 #endif // CEPH_SCRUB_RESULT_H