]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | /* | |
4 | * Ceph - scalable distributed file system | |
5 | * | |
6 | * Copyright (C) 2016 Red Hat Inc | |
7 | * | |
8 | * This is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License version 2.1, as published by the Free Software | |
11 | * Foundation. See file COPYING. | |
12 | * | |
13 | */ | |
14 | ||
15 | ||
16 | #ifndef SCRUB_HEADER_H_ | |
17 | #define SCRUB_HEADER_H_ | |
18 | ||
19 | class CInode; | |
20 | ||
21 | /** | |
22 | * Externally input parameters for a scrub, associated with the root | |
23 | * of where we are doing a recursive scrub | |
24 | */ | |
25 | class ScrubHeader { | |
26 | public: | |
27 | ScrubHeader(const std::string &tag_, bool force_, bool recursive_, | |
28 | bool repair_, Formatter *f_) | |
29 | : tag(tag_), force(force_), recursive(recursive_), repair(repair_), | |
30 | formatter(f_), origin(nullptr) | |
31 | { | |
32 | assert(formatter != nullptr); | |
33 | } | |
34 | ||
35 | // Set after construction because it won't be known until we've | |
36 | // started resolving path and locking | |
37 | void set_origin(CInode *origin_) { origin = origin_; } | |
38 | ||
39 | bool get_recursive() const { return recursive; } | |
40 | bool get_repair() const { return repair; } | |
41 | bool get_force() const { return force; } | |
42 | const CInode *get_origin() const { return origin; } | |
43 | const std::string &get_tag() const { return tag; } | |
44 | Formatter &get_formatter() const { return *formatter; } | |
45 | ||
b32b8144 FG |
46 | bool get_repaired() const { return repaired; } |
47 | void set_repaired() { repaired = true; } | |
48 | ||
7c673cae FG |
49 | protected: |
50 | const std::string tag; | |
51 | const bool force; | |
52 | const bool recursive; | |
53 | const bool repair; | |
54 | Formatter * const formatter; | |
55 | CInode *origin; | |
b32b8144 FG |
56 | |
57 | bool repaired = false; // May be set during scrub if repairs happened | |
7c673cae FG |
58 | }; |
59 | ||
60 | typedef ceph::shared_ptr<ScrubHeader> ScrubHeaderRef; | |
61 | typedef ceph::shared_ptr<const ScrubHeader> ScrubHeaderRefConst; | |
62 | ||
63 | #endif // SCRUB_HEADER_H_ | |
64 |