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