Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / librbd / operation / MetadataSetRequest.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_LIBRBD_OPERATION_METADATA_SET_REQUEST_H
5 #define CEPH_LIBRBD_OPERATION_METADATA_SET_REQUEST_H
6
7 #include "librbd/operation/Request.h"
8 #include "include/buffer.h"
9 #include <string>
10 #include <map>
11
12 class Context;
13
14 namespace librbd {
15
16 class ImageCtx;
17
18 namespace operation {
19
20 template <typename ImageCtxT = ImageCtx>
21 class MetadataSetRequest : public Request<ImageCtxT> {
22 public:
23   MetadataSetRequest(ImageCtxT &image_ctx, Context *on_finish,
24                      const std::string &key, const std::string &value);
25
26 protected:
27   void send_op() override;
28   bool should_complete(int r) override;
29
30   journal::Event create_event(uint64_t op_tid) const override {
31     return journal::MetadataSetEvent(op_tid, m_key, m_value);
32   }
33
34 private:
35   std::string m_key;
36   std::string m_value;
37   std::map<std::string, bufferlist> m_data;
38
39   void send_metadata_set();
40 };
41
42 } // namespace operation
43 } // namespace librbd
44
45 extern template class librbd::operation::MetadataSetRequest<librbd::ImageCtx>;
46
47 #endif // CEPH_LIBRBD_OPERATION_METADATA_SET_REQUEST_H