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