]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mon/KVMonitor.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
8 #include "mon/PaxosService.h"
12 extern const std::string KV_PREFIX
;
14 class KVMonitor
: public PaxosService
16 version_t version
= 0;
17 std::map
<std::string
,std::optional
<ceph::buffer::list
>> pending
;
19 bool _have_prefix(const std::string
&prefix
);
22 KVMonitor(Monitor
&m
, Paxos
&p
, const std::string
& service_name
);
26 void get_store_prefixes(std::set
<std::string
>& s
) const override
;
28 bool preprocess_command(MonOpRequestRef op
);
29 bool prepare_command(MonOpRequestRef op
);
31 bool preprocess_query(MonOpRequestRef op
) override
;
32 bool prepare_update(MonOpRequestRef op
) override
;
34 void create_initial() override
;
35 void update_from_paxos(bool *need_bootstrap
) override
;
36 void create_pending() override
;
37 void encode_pending(MonitorDBStore::TransactionRef t
) override
;
38 version_t
get_trim_to() const override
;
40 void encode_full(MonitorDBStore::TransactionRef t
) override
{ }
42 void on_active() override
;
45 int validate_osd_destroy(const int32_t id
, const uuid_d
& uuid
);
46 void do_osd_destroy(int32_t id
, uuid_d
& uuid
);
49 const std::string
& dmcrypt_key
,
50 std::stringstream
& ss
);
51 void do_osd_new(const uuid_d
& uuid
, const std::string
& dmcrypt_key
);
53 void check_sub(MonSession
*s
);
54 void check_sub(Subscription
*sub
);
55 void check_all_subs();
57 bool maybe_send_update(Subscription
*sub
);
60 // used by other services to adjust kv content; note that callers MUST ensure that
61 // propose_pending() is called and a commit is forced to provide atomicity and
62 // proper subscriber notifications.
63 void enqueue_set(const std::string
& key
, bufferlist
&v
) {
66 void enqueue_rm(const std::string
& key
) {