]> git.proxmox.com Git - ceph.git/blame - ceph/src/tools/rbd_mirror/BaseRequest.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / tools / rbd_mirror / BaseRequest.h
CommitLineData
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#ifndef CEPH_RBD_MIRROR_BASE_REQUEST_H
5#define CEPH_RBD_MIRROR_BASE_REQUEST_H
6
7#include "common/RefCountedObj.h"
11fdf7f2 8#include "include/Context.h"
7c673cae
FG
9
10namespace rbd {
11namespace mirror {
12
13class BaseRequest : public RefCountedObject {
14public:
15 BaseRequest(const std::string& name, CephContext *cct, Context *on_finish)
16 : RefCountedObject(cct, 1), m_name(name), m_cct(cct),
17 m_on_finish(on_finish) {
18 }
19
20 virtual void send() = 0;
21 virtual void cancel() {}
22
23protected:
31f18b77 24 virtual void finish(int r) {
7c673cae
FG
25 if (m_cct) {
26 lsubdout(m_cct, rbd_mirror, 20) << m_name << "::finish: r=" << r << dendl;
27 }
28 if (m_on_finish) {
29 m_on_finish->complete(r);
30 }
31 put();
32 }
33
34private:
35 const std::string m_name;
36 CephContext *m_cct;
37 Context *m_on_finish;
38};
39
40} // namespace mirror
41} // namespace rbd
42
43#endif // CEPH_RBD_MIRROR_BASE_REQUEST_H