]>
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 | ||
11fdf7f2 | 19 | #include <string_view> |
94b18763 | 20 | |
7c673cae FG |
21 | class CInode; |
22 | ||
23 | /** | |
24 | * Externally input parameters for a scrub, associated with the root | |
25 | * of where we are doing a recursive scrub | |
26 | */ | |
27 | class ScrubHeader { | |
28 | public: | |
11fdf7f2 TL |
29 | ScrubHeader(std::string_view tag_, bool is_tag_internal_, bool force_, |
30 | bool recursive_, bool repair_, Formatter *f_) | |
31 | : tag(tag_), is_tag_internal(is_tag_internal_), force(force_), | |
9f95a23c | 32 | recursive(recursive_), repair(repair_), formatter(f_) |
7c673cae | 33 | { |
11fdf7f2 | 34 | ceph_assert(formatter != nullptr); |
7c673cae FG |
35 | } |
36 | ||
37 | // Set after construction because it won't be known until we've | |
38 | // started resolving path and locking | |
39 | void set_origin(CInode *origin_) { origin = origin_; } | |
40 | ||
41 | bool get_recursive() const { return recursive; } | |
42 | bool get_repair() const { return repair; } | |
43 | bool get_force() const { return force; } | |
11fdf7f2 TL |
44 | bool is_internal_tag() const { return is_tag_internal; } |
45 | CInode *get_origin() const { return origin; } | |
46 | std::string_view get_tag() const { return tag; } | |
7c673cae FG |
47 | Formatter &get_formatter() const { return *formatter; } |
48 | ||
b32b8144 FG |
49 | bool get_repaired() const { return repaired; } |
50 | void set_repaired() { repaired = true; } | |
51 | ||
7c673cae FG |
52 | protected: |
53 | const std::string tag; | |
11fdf7f2 | 54 | bool is_tag_internal; |
7c673cae FG |
55 | const bool force; |
56 | const bool recursive; | |
57 | const bool repair; | |
58 | Formatter * const formatter; | |
9f95a23c | 59 | CInode *origin = nullptr; |
b32b8144 FG |
60 | |
61 | bool repaired = false; // May be set during scrub if repairs happened | |
7c673cae FG |
62 | }; |
63 | ||
11fdf7f2 TL |
64 | typedef std::shared_ptr<ScrubHeader> ScrubHeaderRef; |
65 | typedef std::shared_ptr<const ScrubHeader> ScrubHeaderRefConst; | |
7c673cae FG |
66 | |
67 | #endif // SCRUB_HEADER_H_ | |
68 |