]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/services/svc_sys_obj.cc
881a8f955d7291485a59abe987eb3854e54c0d1d
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
)
34 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
35 rgw_raw_obj
& obj
= source
.obj
;
37 return svc
->stat(source
.get_ctx(), *state
, obj
,
43 int RGWSI_SysObj::Obj::ROp::read(int64_t ofs
, int64_t end
, bufferlist
*bl
,
46 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
47 rgw_raw_obj
& obj
= source
.get_obj();
49 return svc
->read(source
.get_ctx(), *state
,
58 int RGWSI_SysObj::Obj::ROp::get_attr(const char *name
, bufferlist
*dest
,
61 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
62 rgw_raw_obj
& obj
= source
.get_obj();
64 return svc
->get_attr(obj
, name
, dest
, y
);
67 int RGWSI_SysObj::Obj::WOp::remove(optional_yield y
)
69 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
70 rgw_raw_obj
& obj
= source
.get_obj();
72 return svc
->remove(source
.get_ctx(),
77 int RGWSI_SysObj::Obj::WOp::write(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(obj
, pmtime
, attrs
, exclusive
,
83 bl
, objv_tracker
, mtime
, y
);
86 int RGWSI_SysObj::Obj::WOp::write_data(bufferlist
& bl
, optional_yield y
)
88 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
89 rgw_raw_obj
& obj
= source
.get_obj();
91 return svc
->write_data(obj
, bl
, exclusive
, objv_tracker
, y
);
94 int RGWSI_SysObj::Obj::WOp::write_attrs(optional_yield y
)
96 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
97 rgw_raw_obj
& obj
= source
.get_obj();
99 return svc
->set_attrs(obj
, attrs
, nullptr, objv_tracker
, y
);
102 int RGWSI_SysObj::Obj::WOp::write_attr(const char *name
, bufferlist
& bl
,
105 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
106 rgw_raw_obj
& obj
= source
.get_obj();
108 map
<string
, bufferlist
> m
;
111 return svc
->set_attrs(obj
, m
, nullptr, objv_tracker
, y
);
114 int RGWSI_SysObj::Pool::list_prefixed_objs(const string
& prefix
, std::function
<void(const string
&)> cb
)
116 return core_svc
->pool_list_prefixed_objs(pool
, prefix
, cb
);
119 int RGWSI_SysObj::Pool::Op::init(const string
& marker
, const string
& prefix
)
121 return source
.core_svc
->pool_list_objects_init(source
.pool
, marker
, prefix
, &ctx
);
124 int RGWSI_SysObj::Pool::Op::get_next(int max
, vector
<string
> *oids
, bool *is_truncated
)
126 return source
.core_svc
->pool_list_objects_next(ctx
, max
, oids
, is_truncated
);
129 int RGWSI_SysObj::Pool::Op::get_marker(string
*marker
)
131 return source
.core_svc
->pool_list_objects_get_marker(ctx
, marker
);
134 int RGWSI_SysObj::Obj::OmapOp::get_all(std::map
<string
, bufferlist
> *m
,
137 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
138 rgw_raw_obj
& obj
= source
.obj
;
140 return svc
->omap_get_all(obj
, m
, y
);
143 int RGWSI_SysObj::Obj::OmapOp::get_vals(const string
& marker
, uint64_t count
,
144 std::map
<string
, bufferlist
> *m
,
145 bool *pmore
, optional_yield y
)
147 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
148 rgw_raw_obj
& obj
= source
.obj
;
150 return svc
->omap_get_vals(obj
, marker
, count
, m
, pmore
, y
);
153 int RGWSI_SysObj::Obj::OmapOp::set(const std::string
& key
, bufferlist
& bl
,
156 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
157 rgw_raw_obj
& obj
= source
.obj
;
159 return svc
->omap_set(obj
, key
, bl
, must_exist
, y
);
162 int RGWSI_SysObj::Obj::OmapOp::set(const map
<std::string
, bufferlist
>& m
,
165 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
166 rgw_raw_obj
& obj
= source
.obj
;
168 return svc
->omap_set(obj
, m
, must_exist
, y
);
171 int RGWSI_SysObj::Obj::OmapOp::del(const std::string
& key
, optional_yield y
)
173 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
174 rgw_raw_obj
& obj
= source
.obj
;
176 return svc
->omap_del(obj
, key
, y
);
179 int RGWSI_SysObj::Obj::WNOp::notify(bufferlist
& bl
, uint64_t timeout_ms
,
180 bufferlist
*pbl
, optional_yield y
)
182 RGWSI_SysObj_Core
*svc
= source
.core_svc
;
183 rgw_raw_obj
& obj
= source
.obj
;
185 return svc
->notify(obj
, bl
, timeout_ms
, pbl
, y
);
188 RGWSI_Zone
*RGWSI_SysObj::get_zone_svc()
190 return core_svc
->get_zone_svc();