]>
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"
11 #define dout_subsys ceph_subsys_rgw
15 RGWSI_SysObj::Obj
RGWSI_SysObj::get_obj(const rgw_raw_obj
& obj
)
17 return Obj(core_svc
, obj
);
20 RGWSI_SysObj::Obj::ROp::ROp(Obj
& _source
) : source(_source
) {
21 state
.emplace
<RGWSI_SysObj_Core::GetObjState
>();
24 int RGWSI_SysObj::Obj::ROp::stat(optional_yield y
, const DoutPrefixProvider
*dpp
)
26 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
27 rgw_raw_obj
& obj
= source
.obj
;
29 return svc
->stat(*state
, obj
, attrs
, raw_attrs
,
30 lastmod
, obj_size
, objv_tracker
, y
, dpp
);
33 int RGWSI_SysObj::Obj::ROp::read(const DoutPrefixProvider
*dpp
,
34 int64_t ofs
, int64_t end
, bufferlist
*bl
,
37 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
38 rgw_raw_obj
& obj
= source
.get_obj();
40 return svc
->read(dpp
, *state
,
50 int RGWSI_SysObj::Obj::ROp::get_attr(const DoutPrefixProvider
*dpp
,
51 const char *name
, bufferlist
*dest
,
54 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
55 rgw_raw_obj
& obj
= source
.get_obj();
57 return svc
->get_attr(dpp
, obj
, name
, dest
, y
);
60 int RGWSI_SysObj::Obj::WOp::remove(const DoutPrefixProvider
*dpp
, optional_yield y
)
62 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
63 rgw_raw_obj
& obj
= source
.get_obj();
65 return svc
->remove(dpp
, objv_tracker
, obj
, y
);
68 int RGWSI_SysObj::Obj::WOp::write(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, optional_yield y
)
70 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
71 rgw_raw_obj
& obj
= source
.get_obj();
73 return svc
->write(dpp
, obj
, pmtime
, attrs
, exclusive
,
74 bl
, objv_tracker
, mtime
, y
);
77 int RGWSI_SysObj::Obj::WOp::write_data(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, optional_yield y
)
79 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
80 rgw_raw_obj
& obj
= source
.get_obj();
82 return svc
->write_data(dpp
, obj
, bl
, exclusive
, objv_tracker
, y
);
85 int RGWSI_SysObj::Obj::WOp::write_attrs(const DoutPrefixProvider
*dpp
, optional_yield y
)
87 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
88 rgw_raw_obj
& obj
= source
.get_obj();
90 return svc
->set_attrs(dpp
, obj
, attrs
, nullptr, objv_tracker
, exclusive
, y
);
93 int RGWSI_SysObj::Obj::WOp::write_attr(const DoutPrefixProvider
*dpp
, const char *name
, bufferlist
& bl
,
96 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
97 rgw_raw_obj
& obj
= source
.get_obj();
99 map
<string
, bufferlist
> m
;
102 return svc
->set_attrs(dpp
, obj
, m
, nullptr, objv_tracker
, exclusive
, y
);
105 int RGWSI_SysObj::Pool::list_prefixed_objs(const DoutPrefixProvider
*dpp
, const string
& prefix
, std::function
<void(const string
&)> cb
)
107 return core_svc
->pool_list_prefixed_objs(dpp
, pool
, prefix
, cb
);
110 int RGWSI_SysObj::Pool::Op::init(const DoutPrefixProvider
*dpp
, const string
& marker
, const string
& prefix
)
112 return source
.core_svc
->pool_list_objects_init(dpp
, source
.pool
, marker
, prefix
, &ctx
);
115 int RGWSI_SysObj::Pool::Op::get_next(const DoutPrefixProvider
*dpp
, int max
, vector
<string
> *oids
, bool *is_truncated
)
117 return source
.core_svc
->pool_list_objects_next(dpp
, ctx
, max
, oids
, is_truncated
);
120 int RGWSI_SysObj::Pool::Op::get_marker(string
*marker
)
122 return source
.core_svc
->pool_list_objects_get_marker(ctx
, marker
);
125 int RGWSI_SysObj::Obj::OmapOp::get_all(const DoutPrefixProvider
*dpp
, std::map
<string
, bufferlist
> *m
,
128 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
129 rgw_raw_obj
& obj
= source
.obj
;
131 return svc
->omap_get_all(dpp
, obj
, m
, y
);
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
)
139 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
140 rgw_raw_obj
& obj
= source
.obj
;
142 return svc
->omap_get_vals(dpp
, obj
, marker
, count
, m
, pmore
, y
);
145 int RGWSI_SysObj::Obj::OmapOp::set(const DoutPrefixProvider
*dpp
, const std::string
& key
, bufferlist
& bl
,
148 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
149 rgw_raw_obj
& obj
= source
.obj
;
151 return svc
->omap_set(dpp
, obj
, key
, bl
, must_exist
, y
);
154 int RGWSI_SysObj::Obj::OmapOp::set(const DoutPrefixProvider
*dpp
, const map
<std::string
, bufferlist
>& m
,
157 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
158 rgw_raw_obj
& obj
= source
.obj
;
160 return svc
->omap_set(dpp
, obj
, m
, must_exist
, y
);
163 int RGWSI_SysObj::Obj::OmapOp::del(const DoutPrefixProvider
*dpp
, const std::string
& key
, optional_yield y
)
165 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
166 rgw_raw_obj
& obj
= source
.obj
;
168 return svc
->omap_del(dpp
, obj
, key
, y
);
171 int RGWSI_SysObj::Obj::WNOp::notify(const DoutPrefixProvider
*dpp
, bufferlist
& bl
, uint64_t timeout_ms
,
172 bufferlist
*pbl
, optional_yield y
)
174 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
175 rgw_raw_obj
& obj
= source
.obj
;
177 return svc
->notify(dpp
, obj
, bl
, timeout_ms
, pbl
, y
);
180 RGWSI_Zone
*RGWSI_SysObj::get_zone_svc()
182 return core_svc
->get_zone_svc();