]>
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
15 RGWSysObjectCtx
RGWSI_SysObj::init_obj_ctx()
17 return RGWSysObjectCtx(this);
20 RGWSI_SysObj::Obj
RGWSI_SysObj::get_obj(RGWSysObjectCtx
& obj_ctx
, const rgw_raw_obj
& obj
)
22 return Obj(core_svc
, obj_ctx
, obj
);
25 void RGWSI_SysObj::Obj::invalidate()
30 RGWSI_SysObj::Obj::ROp::ROp(Obj
& _source
) : source(_source
) {
31 state
.emplace
<RGWSI_SysObj_Core::GetObjState
>();
34 int RGWSI_SysObj::Obj::ROp::stat(optional_yield y
, const DoutPrefixProvider
*dpp
)
36 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
37 rgw_raw_obj
& obj
= source
.obj
;
39 return svc
->stat(source
.get_ctx(), *state
, obj
,
42 objv_tracker
, y
, dpp
);
45 int RGWSI_SysObj::Obj::ROp::read(const DoutPrefixProvider
*dpp
,
46 int64_t ofs
, int64_t end
, bufferlist
*bl
,
49 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
50 rgw_raw_obj
& obj
= source
.get_obj();
52 return svc
->read(dpp
, source
.get_ctx(), *state
,
61 int RGWSI_SysObj::Obj::ROp::get_attr(const DoutPrefixProvider
*dpp
,
62 const char *name
, bufferlist
*dest
,
65 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
66 rgw_raw_obj
& obj
= source
.get_obj();
68 return svc
->get_attr(dpp
, obj
, name
, dest
, y
);
71 int RGWSI_SysObj::Obj::WOp::remove(const DoutPrefixProvider
*dpp
, optional_yield y
)
73 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
74 rgw_raw_obj
& obj
= source
.get_obj();
76 return svc
->remove(dpp
, source
.get_ctx(),
81 int RGWSI_SysObj::Obj::WOp::write(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, optional_yield y
)
83 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
84 rgw_raw_obj
& obj
= source
.get_obj();
86 return svc
->write(dpp
, obj
, pmtime
, attrs
, exclusive
,
87 bl
, objv_tracker
, mtime
, y
);
90 int RGWSI_SysObj::Obj::WOp::write_data(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, optional_yield y
)
92 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
93 rgw_raw_obj
& obj
= source
.get_obj();
95 return svc
->write_data(dpp
, obj
, bl
, exclusive
, objv_tracker
, y
);
98 int RGWSI_SysObj::Obj::WOp::write_attrs(const DoutPrefixProvider
*dpp
, optional_yield y
)
100 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
101 rgw_raw_obj
& obj
= source
.get_obj();
103 return svc
->set_attrs(dpp
, obj
, attrs
, nullptr, objv_tracker
, y
);
106 int RGWSI_SysObj::Obj::WOp::write_attr(const DoutPrefixProvider
*dpp
, const char *name
, bufferlist
& bl
,
109 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
110 rgw_raw_obj
& obj
= source
.get_obj();
112 map
<string
, bufferlist
> m
;
115 return svc
->set_attrs(dpp
, obj
, m
, nullptr, objv_tracker
, y
);
118 int RGWSI_SysObj::Pool::list_prefixed_objs(const DoutPrefixProvider
*dpp
, const string
& prefix
, std::function
<void(const string
&)> cb
)
120 return core_svc
->pool_list_prefixed_objs(dpp
, pool
, prefix
, cb
);
123 int RGWSI_SysObj::Pool::Op::init(const DoutPrefixProvider
*dpp
, const string
& marker
, const string
& prefix
)
125 return source
.core_svc
->pool_list_objects_init(dpp
, source
.pool
, marker
, prefix
, &ctx
);
128 int RGWSI_SysObj::Pool::Op::get_next(const DoutPrefixProvider
*dpp
, int max
, vector
<string
> *oids
, bool *is_truncated
)
130 return source
.core_svc
->pool_list_objects_next(dpp
, ctx
, max
, oids
, is_truncated
);
133 int RGWSI_SysObj::Pool::Op::get_marker(string
*marker
)
135 return source
.core_svc
->pool_list_objects_get_marker(ctx
, marker
);
138 int RGWSI_SysObj::Obj::OmapOp::get_all(const DoutPrefixProvider
*dpp
, std::map
<string
, bufferlist
> *m
,
141 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
142 rgw_raw_obj
& obj
= source
.obj
;
144 return svc
->omap_get_all(dpp
, obj
, m
, y
);
147 int RGWSI_SysObj::Obj::OmapOp::get_vals(const DoutPrefixProvider
*dpp
,
148 const string
& marker
, uint64_t count
,
149 std::map
<string
, bufferlist
> *m
,
150 bool *pmore
, optional_yield y
)
152 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
153 rgw_raw_obj
& obj
= source
.obj
;
155 return svc
->omap_get_vals(dpp
, obj
, marker
, count
, m
, pmore
, y
);
158 int RGWSI_SysObj::Obj::OmapOp::set(const DoutPrefixProvider
*dpp
, const std::string
& key
, bufferlist
& bl
,
161 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
162 rgw_raw_obj
& obj
= source
.obj
;
164 return svc
->omap_set(dpp
, obj
, key
, bl
, must_exist
, y
);
167 int RGWSI_SysObj::Obj::OmapOp::set(const DoutPrefixProvider
*dpp
, const map
<std::string
, bufferlist
>& m
,
170 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
171 rgw_raw_obj
& obj
= source
.obj
;
173 return svc
->omap_set(dpp
, obj
, m
, must_exist
, y
);
176 int RGWSI_SysObj::Obj::OmapOp::del(const DoutPrefixProvider
*dpp
, const std::string
& key
, optional_yield y
)
178 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
179 rgw_raw_obj
& obj
= source
.obj
;
181 return svc
->omap_del(dpp
, obj
, key
, y
);
184 int RGWSI_SysObj::Obj::WNOp::notify(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, uint64_t timeout_ms
,
185 bufferlist
*pbl
, optional_yield y
)
187 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
188 rgw_raw_obj
& obj
= source
.obj
;
190 return svc
->notify(dpp
, obj
, bl
, timeout_ms
, pbl
, y
);
193 RGWSI_Zone
*RGWSI_SysObj::get_zone_svc()
195 return core_svc
->get_zone_svc();