blob: fef0015651c88310e4f99fb8ce2de914e41a21a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_JOURNAL_FUTURE_H
#define CEPH_JOURNAL_FUTURE_H
#include "include/int_types.h"
#include <string>
#include <iosfwd>
#include <boost/intrusive_ptr.hpp>
#include "include/ceph_assert.h"
class Context;
namespace journal {
class FutureImpl;
class Future {
public:
typedef boost::intrusive_ptr<FutureImpl> FutureImplPtr;
Future() {}
Future(const FutureImplPtr &future_impl) : m_future_impl(future_impl) {}
inline bool is_valid() const {
return m_future_impl.get() != nullptr;
}
void flush(Context *on_safe);
void wait(Context *on_safe);
bool is_complete() const;
int get_return_value() const;
private:
friend class Journaler;
friend std::ostream& operator<<(std::ostream&, const Future&);
inline FutureImplPtr get_future_impl() const {
return m_future_impl;
}
FutureImplPtr m_future_impl;
};
void intrusive_ptr_add_ref(FutureImpl *p);
void intrusive_ptr_release(FutureImpl *p);
std::ostream &operator<<(std::ostream &os, const Future &future);
} // namespace journal
using journal::intrusive_ptr_add_ref;
using journal::intrusive_ptr_release;
using journal::operator<<;
#endif // CEPH_JOURNAL_FUTURE_H
|