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