]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab ft=cpp | |
3 | ||
11fdf7f2 TL |
4 | #include "svc_sys_obj.h" |
5 | #include "svc_sys_obj_core.h" | |
6 | #include "svc_rados.h" | |
7 | #include "svc_zone.h" | |
8 | ||
9 | #include "rgw/rgw_zone.h" | |
10 | ||
11 | #define dout_subsys ceph_subsys_rgw | |
12 | ||
20effc67 TL |
13 | using namespace std; |
14 | ||
11fdf7f2 TL |
15 | RGWSysObjectCtx RGWSI_SysObj::init_obj_ctx() |
16 | { | |
17 | return RGWSysObjectCtx(this); | |
18 | } | |
19 | ||
20 | RGWSI_SysObj::Obj RGWSI_SysObj::get_obj(RGWSysObjectCtx& obj_ctx, const rgw_raw_obj& obj) | |
21 | { | |
22 | return Obj(core_svc, obj_ctx, obj); | |
23 | } | |
24 | ||
25 | void RGWSI_SysObj::Obj::invalidate() | |
26 | { | |
27 | ctx.invalidate(obj); | |
28 | } | |
29 | ||
9f95a23c TL |
30 | RGWSI_SysObj::Obj::ROp::ROp(Obj& _source) : source(_source) { |
31 | state.emplace<RGWSI_SysObj_Core::GetObjState>(); | |
32 | } | |
33 | ||
b3b6e05e | 34 | int RGWSI_SysObj::Obj::ROp::stat(optional_yield y, const DoutPrefixProvider *dpp) |
11fdf7f2 TL |
35 | { |
36 | RGWSI_SysObj_Core *svc = source.core_svc; | |
37 | rgw_raw_obj& obj = source.obj; | |
38 | ||
9f95a23c | 39 | return svc->stat(source.get_ctx(), *state, obj, |
11fdf7f2 TL |
40 | attrs, raw_attrs, |
41 | lastmod, obj_size, | |
b3b6e05e | 42 | objv_tracker, y, dpp); |
11fdf7f2 TL |
43 | } |
44 | ||
b3b6e05e TL |
45 | int RGWSI_SysObj::Obj::ROp::read(const DoutPrefixProvider *dpp, |
46 | int64_t ofs, int64_t end, bufferlist *bl, | |
9f95a23c | 47 | optional_yield y) |
11fdf7f2 TL |
48 | { |
49 | RGWSI_SysObj_Core *svc = source.core_svc; | |
50 | rgw_raw_obj& obj = source.get_obj(); | |
51 | ||
b3b6e05e | 52 | return svc->read(dpp, source.get_ctx(), *state, |
11fdf7f2 TL |
53 | objv_tracker, |
54 | obj, bl, ofs, end, | |
55 | attrs, | |
56 | raw_attrs, | |
57 | cache_info, | |
9f95a23c | 58 | refresh_version, y); |
11fdf7f2 TL |
59 | } |
60 | ||
b3b6e05e TL |
61 | int RGWSI_SysObj::Obj::ROp::get_attr(const DoutPrefixProvider *dpp, |
62 | const char *name, bufferlist *dest, | |
9f95a23c | 63 | optional_yield y) |
11fdf7f2 TL |
64 | { |
65 | RGWSI_SysObj_Core *svc = source.core_svc; | |
66 | rgw_raw_obj& obj = source.get_obj(); | |
67 | ||
b3b6e05e | 68 | return svc->get_attr(dpp, obj, name, dest, y); |
11fdf7f2 TL |
69 | } |
70 | ||
b3b6e05e | 71 | int RGWSI_SysObj::Obj::WOp::remove(const DoutPrefixProvider *dpp, optional_yield y) |
11fdf7f2 TL |
72 | { |
73 | RGWSI_SysObj_Core *svc = source.core_svc; | |
74 | rgw_raw_obj& obj = source.get_obj(); | |
75 | ||
b3b6e05e | 76 | return svc->remove(dpp, source.get_ctx(), |
11fdf7f2 | 77 | objv_tracker, |
9f95a23c | 78 | obj, y); |
11fdf7f2 TL |
79 | } |
80 | ||
b3b6e05e | 81 | int RGWSI_SysObj::Obj::WOp::write(const DoutPrefixProvider *dpp, bufferlist& bl, optional_yield y) |
11fdf7f2 TL |
82 | { |
83 | RGWSI_SysObj_Core *svc = source.core_svc; | |
84 | rgw_raw_obj& obj = source.get_obj(); | |
85 | ||
b3b6e05e | 86 | return svc->write(dpp, obj, pmtime, attrs, exclusive, |
9f95a23c | 87 | bl, objv_tracker, mtime, y); |
11fdf7f2 TL |
88 | } |
89 | ||
b3b6e05e | 90 | int RGWSI_SysObj::Obj::WOp::write_data(const DoutPrefixProvider *dpp, bufferlist& bl, optional_yield y) |
11fdf7f2 TL |
91 | { |
92 | RGWSI_SysObj_Core *svc = source.core_svc; | |
93 | rgw_raw_obj& obj = source.get_obj(); | |
94 | ||
b3b6e05e | 95 | return svc->write_data(dpp, obj, bl, exclusive, objv_tracker, y); |
11fdf7f2 TL |
96 | } |
97 | ||
b3b6e05e | 98 | int RGWSI_SysObj::Obj::WOp::write_attrs(const DoutPrefixProvider *dpp, optional_yield y) |
11fdf7f2 TL |
99 | { |
100 | RGWSI_SysObj_Core *svc = source.core_svc; | |
101 | rgw_raw_obj& obj = source.get_obj(); | |
102 | ||
b3b6e05e | 103 | return svc->set_attrs(dpp, obj, attrs, nullptr, objv_tracker, y); |
11fdf7f2 TL |
104 | } |
105 | ||
b3b6e05e | 106 | int RGWSI_SysObj::Obj::WOp::write_attr(const DoutPrefixProvider *dpp, const char *name, bufferlist& bl, |
9f95a23c | 107 | optional_yield y) |
11fdf7f2 TL |
108 | { |
109 | RGWSI_SysObj_Core *svc = source.core_svc; | |
110 | rgw_raw_obj& obj = source.get_obj(); | |
111 | ||
112 | map<string, bufferlist> m; | |
113 | m[name] = bl; | |
114 | ||
b3b6e05e | 115 | return svc->set_attrs(dpp, obj, m, nullptr, objv_tracker, y); |
11fdf7f2 TL |
116 | } |
117 | ||
b3b6e05e | 118 | int RGWSI_SysObj::Pool::list_prefixed_objs(const DoutPrefixProvider *dpp, const string& prefix, std::function<void(const string&)> cb) |
11fdf7f2 | 119 | { |
b3b6e05e | 120 | return core_svc->pool_list_prefixed_objs(dpp, pool, prefix, cb); |
9f95a23c | 121 | } |
11fdf7f2 | 122 | |
b3b6e05e | 123 | int RGWSI_SysObj::Pool::Op::init(const DoutPrefixProvider *dpp, const string& marker, const string& prefix) |
9f95a23c | 124 | { |
b3b6e05e | 125 | return source.core_svc->pool_list_objects_init(dpp, source.pool, marker, prefix, &ctx); |
9f95a23c | 126 | } |
11fdf7f2 | 127 | |
20effc67 | 128 | int RGWSI_SysObj::Pool::Op::get_next(const DoutPrefixProvider *dpp, int max, vector<string> *oids, bool *is_truncated) |
9f95a23c | 129 | { |
20effc67 | 130 | return source.core_svc->pool_list_objects_next(dpp, ctx, max, oids, is_truncated); |
9f95a23c | 131 | } |
11fdf7f2 | 132 | |
9f95a23c TL |
133 | int RGWSI_SysObj::Pool::Op::get_marker(string *marker) |
134 | { | |
135 | return source.core_svc->pool_list_objects_get_marker(ctx, marker); | |
11fdf7f2 TL |
136 | } |
137 | ||
b3b6e05e | 138 | int RGWSI_SysObj::Obj::OmapOp::get_all(const DoutPrefixProvider *dpp, std::map<string, bufferlist> *m, |
9f95a23c | 139 | optional_yield y) |
11fdf7f2 TL |
140 | { |
141 | RGWSI_SysObj_Core *svc = source.core_svc; | |
142 | rgw_raw_obj& obj = source.obj; | |
143 | ||
b3b6e05e | 144 | return svc->omap_get_all(dpp, obj, m, y); |
11fdf7f2 TL |
145 | } |
146 | ||
b3b6e05e TL |
147 | int RGWSI_SysObj::Obj::OmapOp::get_vals(const DoutPrefixProvider *dpp, |
148 | const string& marker, uint64_t count, | |
11fdf7f2 | 149 | std::map<string, bufferlist> *m, |
9f95a23c | 150 | bool *pmore, optional_yield y) |
11fdf7f2 TL |
151 | { |
152 | RGWSI_SysObj_Core *svc = source.core_svc; | |
153 | rgw_raw_obj& obj = source.obj; | |
154 | ||
b3b6e05e | 155 | return svc->omap_get_vals(dpp, obj, marker, count, m, pmore, y); |
11fdf7f2 TL |
156 | } |
157 | ||
b3b6e05e | 158 | int RGWSI_SysObj::Obj::OmapOp::set(const DoutPrefixProvider *dpp, const std::string& key, bufferlist& bl, |
9f95a23c | 159 | optional_yield y) |
11fdf7f2 TL |
160 | { |
161 | RGWSI_SysObj_Core *svc = source.core_svc; | |
162 | rgw_raw_obj& obj = source.obj; | |
163 | ||
b3b6e05e | 164 | return svc->omap_set(dpp, obj, key, bl, must_exist, y); |
11fdf7f2 TL |
165 | } |
166 | ||
b3b6e05e | 167 | int RGWSI_SysObj::Obj::OmapOp::set(const DoutPrefixProvider *dpp, const map<std::string, bufferlist>& m, |
9f95a23c | 168 | optional_yield y) |
11fdf7f2 TL |
169 | { |
170 | RGWSI_SysObj_Core *svc = source.core_svc; | |
171 | rgw_raw_obj& obj = source.obj; | |
172 | ||
b3b6e05e | 173 | return svc->omap_set(dpp, obj, m, must_exist, y); |
11fdf7f2 TL |
174 | } |
175 | ||
b3b6e05e | 176 | int RGWSI_SysObj::Obj::OmapOp::del(const DoutPrefixProvider *dpp, const std::string& key, optional_yield y) |
11fdf7f2 TL |
177 | { |
178 | RGWSI_SysObj_Core *svc = source.core_svc; | |
179 | rgw_raw_obj& obj = source.obj; | |
180 | ||
b3b6e05e | 181 | return svc->omap_del(dpp, obj, key, y); |
11fdf7f2 TL |
182 | } |
183 | ||
b3b6e05e | 184 | int RGWSI_SysObj::Obj::WNOp::notify(const DoutPrefixProvider *dpp, bufferlist& bl, uint64_t timeout_ms, |
9f95a23c | 185 | bufferlist *pbl, optional_yield y) |
11fdf7f2 TL |
186 | { |
187 | RGWSI_SysObj_Core *svc = source.core_svc; | |
188 | rgw_raw_obj& obj = source.obj; | |
189 | ||
b3b6e05e | 190 | return svc->notify(dpp, obj, bl, timeout_ms, pbl, y); |
11fdf7f2 TL |
191 | } |
192 | ||
193 | RGWSI_Zone *RGWSI_SysObj::get_zone_svc() | |
194 | { | |
195 | return core_svc->get_zone_svc(); | |
196 | } |