]>
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) 2013 Inktank, 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 | #ifndef CEPH_MON_CONFIG_KEY_SERVICE_H | |
15 | #define CEPH_MON_CONFIG_KEY_SERVICE_H | |
16 | ||
17 | #include "mon/QuorumService.h" | |
31f18b77 | 18 | #include "mon/MonitorDBStore.h" |
7c673cae FG |
19 | |
20 | class Paxos; | |
21 | class Monitor; | |
7c673cae FG |
22 | |
23 | class ConfigKeyService : public QuorumService | |
24 | { | |
25 | Paxos *paxos; | |
26 | ||
27 | int store_get(const string &key, bufferlist &bl); | |
28 | void store_put(const string &key, bufferlist &bl, Context *cb = NULL); | |
31f18b77 | 29 | void store_delete(MonitorDBStore::TransactionRef t, const string &key); |
7c673cae | 30 | void store_delete(const string &key, Context *cb = NULL); |
31f18b77 FG |
31 | void store_delete_prefix( |
32 | MonitorDBStore::TransactionRef t, | |
33 | const string &prefix); | |
7c673cae | 34 | void store_list(stringstream &ss); |
11fdf7f2 | 35 | void store_dump(stringstream &ss, const string& prefix); |
7c673cae | 36 | bool store_exists(const string &key); |
31f18b77 | 37 | bool store_has_prefix(const string &prefix); |
7c673cae FG |
38 | |
39 | static const string STORE_PREFIX; | |
40 | ||
41 | protected: | |
42 | void service_shutdown() override { } | |
43 | ||
44 | public: | |
45 | ConfigKeyService(Monitor *m, Paxos *p) : | |
46 | QuorumService(m), | |
47 | paxos(p) | |
48 | { } | |
49 | ~ConfigKeyService() override { } | |
50 | ||
51 | ||
52 | /** | |
53 | * @defgroup ConfigKeyService_Inherited_h Inherited abstract methods | |
54 | * @{ | |
55 | */ | |
56 | void init() override { } | |
7c673cae FG |
57 | bool service_dispatch(MonOpRequestRef op) override; |
58 | ||
59 | void start_epoch() override { } | |
60 | void finish_epoch() override { } | |
61 | void cleanup() override { } | |
62 | void service_tick() override { } | |
63 | ||
31f18b77 FG |
64 | int validate_osd_destroy(const int32_t id, const uuid_d& uuid); |
65 | void do_osd_destroy(int32_t id, uuid_d& uuid); | |
66 | int validate_osd_new( | |
67 | const uuid_d& uuid, | |
68 | const string& dmcrypt_key, | |
69 | stringstream& ss); | |
70 | void do_osd_new(const uuid_d& uuid, const string& dmcrypt_key); | |
71 | ||
7c673cae FG |
72 | int get_type() override { |
73 | return QuorumService::SERVICE_CONFIG_KEY; | |
74 | } | |
75 | ||
76 | string get_name() const override { | |
77 | return "config_key"; | |
78 | } | |
11fdf7f2 | 79 | void get_store_prefixes(set<string>& s) const; |
7c673cae FG |
80 | /** |
81 | * @} // ConfigKeyService_Inherited_h | |
82 | */ | |
83 | }; | |
84 | ||
85 | #endif // CEPH_MON_CONFIG_KEY_SERVICE_H |