]> git.proxmox.com Git - ceph.git/blame - ceph/src/common/ContextCompletion.h
update sources to v12.1.0
[ceph.git] / ceph / src / common / ContextCompletion.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#ifndef CEPH_ASYNC_COMPLETION_H
4#define CEPH_ASYNC_COMPLETION_H
5
7c673cae
FG
6#include "include/Context.h"
7
8namespace ceph {
9
10class ContextCompletion {
11public:
12 ContextCompletion(Context *ctx, bool ignore_enoent);
13
14 void finish_adding_requests();
15
16 void start_op();
17 void finish_op(int r);
18
19private:
20 Mutex m_lock;
21 Context *m_ctx;
22 bool m_ignore_enoent;
23 int m_ret;
24 bool m_building;
25 uint64_t m_current_ops;
26};
27
28class C_ContextCompletion : public Context {
29public:
30 C_ContextCompletion(ContextCompletion &context_completion)
31 : m_context_completion(context_completion)
32 {
33 m_context_completion.start_op();
34 }
35
36 void finish(int r) override {
37 m_context_completion.finish_op(r);
38 }
39
40private:
41 ContextCompletion &m_context_completion;
42};
43
44} // namespace ceph
45
46#endif // CEPH_ASYNC_COMPLETION_H