]>
git.proxmox.com Git - ceph.git/blob - 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
4 #include "svc_sys_obj.h"
5 #include "svc_sys_obj_core.h"
9 #include "rgw/rgw_zone.h"
11 #define dout_subsys ceph_subsys_rgw
13 RGWSysObjectCtx
RGWSI_SysObj::init_obj_ctx()
15 return RGWSysObjectCtx(this);
18 RGWSI_SysObj::Obj
RGWSI_SysObj::get_obj(RGWSysObjectCtx
& obj_ctx
, const rgw_raw_obj
& obj
)
20 return Obj(core_svc
, obj_ctx
, obj
);
23 void RGWSI_SysObj::Obj::invalidate()
28 RGWSI_SysObj::Obj::ROp::ROp(Obj
& _source
) : source(_source
) {
29 state
.emplace
<RGWSI_SysObj_Core::GetObjState
>();
32 int RGWSI_SysObj::Obj::ROp::stat(optional_yield y
, const DoutPrefixProvider
*dpp
)
34 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
35 rgw_raw_obj
& obj
= source
.obj
;
37 return svc
->stat(source
.get_ctx(), *state
, obj
,
40 objv_tracker
, y
, dpp
);
43 int RGWSI_SysObj::Obj::ROp::read(const DoutPrefixProvider
*dpp
,
44 int64_t ofs
, int64_t end
, bufferlist
*bl
,
47 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
48 rgw_raw_obj
& obj
= source
.get_obj();
50 return svc
->read(dpp
, source
.get_ctx(), *state
,
59 int RGWSI_SysObj::Obj::ROp::get_attr(const DoutPrefixProvider
*dpp
,
60 const char *name
, bufferlist
*dest
,
63 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
64 rgw_raw_obj
& obj
= source
.get_obj();
66 return svc
->get_attr(dpp
, obj
, name
, dest
, y
);
69 int RGWSI_SysObj::Obj::WOp::remove(const DoutPrefixProvider
*dpp
, optional_yield y
)
71 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
72 rgw_raw_obj
& obj
= source
.get_obj();
74 return svc
->remove(dpp
, source
.get_ctx(),
79 int RGWSI_SysObj::Obj::WOp::write(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, optional_yield y
)
81 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
82 rgw_raw_obj
& obj
= source
.get_obj();
84 return svc
->write(dpp
, obj
, pmtime
, attrs
, exclusive
,
85 bl
, objv_tracker
, mtime
, y
);
88 int RGWSI_SysObj::Obj::WOp::write_data(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, optional_yield y
)
90 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
91 rgw_raw_obj
& obj
= source
.get_obj();
93 return svc
->write_data(dpp
, obj
, bl
, exclusive
, objv_tracker
, y
);
96 int RGWSI_SysObj::Obj::WOp::write_attrs(const DoutPrefixProvider
*dpp
, optional_yield y
)
98 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
99 rgw_raw_obj
& obj
= source
.get_obj();
101 return svc
->set_attrs(dpp
, obj
, attrs
, nullptr, objv_tracker
, y
);
104 int RGWSI_SysObj::Obj::WOp::write_attr(const DoutPrefixProvider
*dpp
, const char *name
, bufferlist
& bl
,
107 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
108 rgw_raw_obj
& obj
= source
.get_obj();
110 map
<string
, bufferlist
> m
;
113 return svc
->set_attrs(dpp
, obj
, m
, nullptr, objv_tracker
, y
);
116 int RGWSI_SysObj::Pool::list_prefixed_objs(const DoutPrefixProvider
*dpp
, const string
& prefix
, std::function
<void(const string
&)> cb
)
118 return core_svc
->pool_list_prefixed_objs(dpp
, pool
, prefix
, cb
);
121 int RGWSI_SysObj::Pool::Op::init(const DoutPrefixProvider
*dpp
, const string
& marker
, const string
& prefix
)
123 return source
.core_svc
->pool_list_objects_init(dpp
, source
.pool
, marker
, prefix
, &ctx
);
126 int RGWSI_SysObj::Pool::Op::get_next(int max
, vector
<string
> *oids
, bool *is_truncated
)
128 return source
.core_svc
->pool_list_objects_next(ctx
, max
, oids
, is_truncated
);
131 int RGWSI_SysObj::Pool::Op::get_marker(string
*marker
)
133 return source
.core_svc
->pool_list_objects_get_marker(ctx
, marker
);
136 int RGWSI_SysObj::Obj::OmapOp::get_all(const DoutPrefixProvider
*dpp
, std::map
<string
, bufferlist
> *m
,
139 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
140 rgw_raw_obj
& obj
= source
.obj
;
142 return svc
->omap_get_all(dpp
, obj
, m
, y
);
145 int RGWSI_SysObj::Obj::OmapOp::get_vals(const DoutPrefixProvider
*dpp
,
146 const string
& marker
, uint64_t count
,
147 std::map
<string
, bufferlist
> *m
,
148 bool *pmore
, optional_yield y
)
150 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
151 rgw_raw_obj
& obj
= source
.obj
;
153 return svc
->omap_get_vals(dpp
, obj
, marker
, count
, m
, pmore
, y
);
156 int RGWSI_SysObj::Obj::OmapOp::set(const DoutPrefixProvider
*dpp
, const std::string
& key
, bufferlist
& bl
,
159 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
160 rgw_raw_obj
& obj
= source
.obj
;
162 return svc
->omap_set(dpp
, obj
, key
, bl
, must_exist
, y
);
165 int RGWSI_SysObj::Obj::OmapOp::set(const DoutPrefixProvider
*dpp
, const map
<std::string
, bufferlist
>& m
,
168 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
169 rgw_raw_obj
& obj
= source
.obj
;
171 return svc
->omap_set(dpp
, obj
, m
, must_exist
, y
);
174 int RGWSI_SysObj::Obj::OmapOp::del(const DoutPrefixProvider
*dpp
, const std::string
& key
, optional_yield y
)
176 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
177 rgw_raw_obj
& obj
= source
.obj
;
179 return svc
->omap_del(dpp
, obj
, key
, y
);
182 int RGWSI_SysObj::Obj::WNOp::notify(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, uint64_t timeout_ms
,
183 bufferlist
*pbl
, optional_yield y
)
185 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
186 rgw_raw_obj
& obj
= source
.obj
;
188 return svc
->notify(dpp
, obj
, bl
, timeout_ms
, pbl
, y
);
191 RGWSI_Zone
*RGWSI_SysObj::get_zone_svc()
193 return core_svc
->get_zone_svc();