]> git.proxmox.com Git - ceph.git/blob - ceph/src/tools/rbd/Schedule.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / tools / rbd / Schedule.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_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);
23 void add_schedule_options(
24 boost::program_options::options_description *positional);
25 int get_schedule_args(const boost::program_options::variables_map &vm,
26 bool mandatory, std::map<std::string, std::string> *args);
27
28 class Schedule {
29 public:
30 Schedule() {
31 }
32
33 int parse(json_spirit::mValue &schedule_val);
34 void dump(ceph::Formatter *f);
35
36 friend std::ostream& operator<<(std::ostream& os, Schedule &s);
37
38 private:
39 std::string name;
40 std::list<std::pair<std::string, std::string>> items;
41 };
42
43 std::ostream& operator<<(std::ostream& os, Schedule &s);
44
45 class ScheduleList {
46 public:
47 ScheduleList(bool allow_images=true) : allow_images(allow_images) {
48 }
49
50 int parse(const std::string &list);
51 Schedule *find(const std::string &name);
52 void dump(ceph::Formatter *f);
53
54 friend std::ostream& operator<<(std::ostream& os, ScheduleList &l);
55
56 private:
57 bool allow_images;
58 std::map<std::string, Schedule> schedules;
59 };
60
61 std::ostream& operator<<(std::ostream& os, ScheduleList &l);
62
63 } // namespace rbd
64
65 #endif // CEPH_RBD_SCHEDULE_H