]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
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_RBD_SCHEDULE_H | |
5 | #define CEPH_RBD_SCHEDULE_H | |
6 | ||
7 | #include "json_spirit/json_spirit.h" | |
8 | ||
9 | #include <iostream> | |
10 | #include <list> | |
11 | #include <map> | |
12 | #include <string> | |
13 | #include <boost/program_options.hpp> | |
14 | ||
15 | namespace ceph { class Formatter; } | |
16 | ||
17 | namespace rbd { | |
18 | ||
19 | void add_level_spec_options( | |
20 | boost::program_options::options_description *options, bool allow_image=true); | |
21 | int get_level_spec_args(const boost::program_options::variables_map &vm, | |
22 | std::map<std::string, std::string> *args); | |
f67539c2 TL |
23 | void normalize_level_spec_args(std::map<std::string, std::string> *args); |
24 | ||
9f95a23c | 25 | void add_schedule_options( |
20effc67 | 26 | boost::program_options::options_description *positional, bool mandatory); |
9f95a23c TL |
27 | int get_schedule_args(const boost::program_options::variables_map &vm, |
28 | bool mandatory, std::map<std::string, std::string> *args); | |
29 | ||
30 | class Schedule { | |
31 | public: | |
32 | Schedule() { | |
33 | } | |
34 | ||
35 | int parse(json_spirit::mValue &schedule_val); | |
36 | void dump(ceph::Formatter *f); | |
37 | ||
38 | friend std::ostream& operator<<(std::ostream& os, Schedule &s); | |
39 | ||
40 | private: | |
41 | std::string name; | |
42 | std::list<std::pair<std::string, std::string>> items; | |
43 | }; | |
44 | ||
45 | std::ostream& operator<<(std::ostream& os, Schedule &s); | |
46 | ||
47 | class ScheduleList { | |
48 | public: | |
49 | ScheduleList(bool allow_images=true) : allow_images(allow_images) { | |
50 | } | |
51 | ||
52 | int parse(const std::string &list); | |
53 | Schedule *find(const std::string &name); | |
54 | void dump(ceph::Formatter *f); | |
55 | ||
56 | friend std::ostream& operator<<(std::ostream& os, ScheduleList &l); | |
57 | ||
58 | private: | |
59 | bool allow_images; | |
60 | std::map<std::string, Schedule> schedules; | |
61 | }; | |
62 | ||
63 | std::ostream& operator<<(std::ostream& os, ScheduleList &l); | |
64 | ||
65 | } // namespace rbd | |
66 | ||
67 | #endif // CEPH_RBD_SCHEDULE_H |