]> git.proxmox.com Git - ceph.git/blame - ceph/src/tools/rbd/Schedule.h
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / tools / rbd / Schedule.h
CommitLineData
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
15namespace ceph { class Formatter; }
16
17namespace rbd {
18
19void add_level_spec_options(
20 boost::program_options::options_description *options, bool allow_image=true);
21int get_level_spec_args(const boost::program_options::variables_map &vm,
22 std::map<std::string, std::string> *args);
f67539c2
TL
23void normalize_level_spec_args(std::map<std::string, std::string> *args);
24
9f95a23c 25void add_schedule_options(
20effc67 26 boost::program_options::options_description *positional, bool mandatory);
9f95a23c
TL
27int get_schedule_args(const boost::program_options::variables_map &vm,
28 bool mandatory, std::map<std::string, std::string> *args);
29
30class Schedule {
31public:
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
40private:
41 std::string name;
42 std::list<std::pair<std::string, std::string>> items;
43};
44
45std::ostream& operator<<(std::ostream& os, Schedule &s);
46
47class ScheduleList {
48public:
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
58private:
59 bool allow_images;
60 std::map<std::string, Schedule> schedules;
61};
62
63std::ostream& operator<<(std::ostream& os, ScheduleList &l);
64
65} // namespace rbd
66
67#endif // CEPH_RBD_SCHEDULE_H