-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjecterWriteback.h
55 lines (47 loc) · 1.77 KB
/
ObjecterWriteback.h
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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_OSDC_OBJECTERWRITEBACKHANDLER_H
#define CEPH_OSDC_OBJECTERWRITEBACKHANDLER_H
#include "osdc/Objecter.h"
#include "osdc/WritebackHandler.h"
class ObjecterWriteback : public WritebackHandler {
public:
ObjecterWriteback(Objecter *o, Finisher *fin, Mutex *lock)
: m_objecter(o),
m_finisher(fin),
m_lock(lock) { }
virtual ~ObjecterWriteback() {}
virtual void read(const object_t& oid, const object_locator_t& oloc,
uint64_t off, uint64_t len, snapid_t snapid,
bufferlist *pbl, uint64_t trunc_size, __u32 trunc_seq,
Context *onfinish) {
m_objecter->read_trunc(oid, oloc, off, len, snapid, pbl, 0,
trunc_size, trunc_seq,
new C_OnFinisher(new C_Lock(m_lock, onfinish),
m_finisher));
}
virtual bool may_copy_on_write(const object_t& oid, uint64_t read_off,
uint64_t read_len, snapid_t snapid) {
return false;
}
virtual ceph_tid_t write(const object_t& oid, const object_locator_t& oloc,
uint64_t off, uint64_t len, const SnapContext& snapc,
const bufferlist &bl, utime_t mtime, uint64_t trunc_size,
__u32 trunc_seq, Context *oncommit) {
return m_objecter->write_trunc(oid, oloc, off, len, snapc, bl, mtime, 0,
trunc_size, trunc_seq, NULL,
new C_OnFinisher(new C_Lock(m_lock, oncommit),
m_finisher));
}
virtual ceph_tid_t lock(const object_t& oid, const object_locator_t& oloc, int op,
int flags, Context *onack, Context *oncommit) {
return m_objecter->lock(oid, oloc, op, flags, onack,
new C_OnFinisher(new C_Lock(m_lock, oncommit),
m_finisher));
}
private:
Objecter *m_objecter;
Finisher *m_finisher;
Mutex *m_lock;
};
#endif