]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/services/svc_sys_obj_core.h
24659ae209d68a8abfdc3fc12ff65d2ae95039b8
[ceph.git] / ceph / src / rgw / services / svc_sys_obj_core.h
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 #pragma once
5
6 #include "rgw/rgw_service.h"
7
8 #include "svc_rados.h"
9 #include "svc_sys_obj.h"
10 #include "svc_sys_obj_core_types.h"
11
12
13 class RGWSI_Zone;
14
15 struct rgw_cache_entry_info;
16
17 class RGWSI_SysObj_Core : public RGWServiceInstance
18 {
19 friend class RGWServices_Def;
20 friend class RGWSI_SysObj;
21
22 protected:
23 RGWSI_RADOS *rados_svc{nullptr};
24 RGWSI_Zone *zone_svc{nullptr};
25
26 using GetObjState = RGWSI_SysObj_Core_GetObjState;
27 using PoolListImplInfo = RGWSI_SysObj_Core_PoolListImplInfo;
28
29 void core_init(RGWSI_RADOS *_rados_svc,
30 RGWSI_Zone *_zone_svc) {
31 rados_svc = _rados_svc;
32 zone_svc = _zone_svc;
33 }
34 int get_rados_obj(RGWSI_Zone *zone_svc, const rgw_raw_obj& obj, RGWSI_RADOS::Obj *pobj);
35
36 virtual int raw_stat(const rgw_raw_obj& obj, uint64_t *psize, real_time *pmtime, uint64_t *epoch,
37 map<string, bufferlist> *attrs, bufferlist *first_chunk,
38 RGWObjVersionTracker *objv_tracker,
39 optional_yield y);
40
41 virtual int read(RGWSysObjectCtxBase& obj_ctx,
42 RGWSI_SysObj_Obj_GetObjState& read_state,
43 RGWObjVersionTracker *objv_tracker,
44 const rgw_raw_obj& obj,
45 bufferlist *bl, off_t ofs, off_t end,
46 map<string, bufferlist> *attrs,
47 bool raw_attrs,
48 rgw_cache_entry_info *cache_info,
49 boost::optional<obj_version>,
50 optional_yield y);
51
52 virtual int remove(RGWSysObjectCtxBase& obj_ctx,
53 RGWObjVersionTracker *objv_tracker,
54 const rgw_raw_obj& obj,
55 optional_yield y);
56
57 virtual int write(const rgw_raw_obj& obj,
58 real_time *pmtime,
59 map<std::string, bufferlist>& attrs,
60 bool exclusive,
61 const bufferlist& data,
62 RGWObjVersionTracker *objv_tracker,
63 real_time set_mtime,
64 optional_yield y);
65
66 virtual int write_data(const rgw_raw_obj& obj,
67 const bufferlist& bl,
68 bool exclusive,
69 RGWObjVersionTracker *objv_tracker,
70 optional_yield y);
71
72 virtual int get_attr(const rgw_raw_obj& obj, const char *name, bufferlist *dest,
73 optional_yield y);
74
75 virtual int set_attrs(const rgw_raw_obj& obj,
76 map<string, bufferlist>& attrs,
77 map<string, bufferlist> *rmattrs,
78 RGWObjVersionTracker *objv_tracker,
79 optional_yield y);
80
81 virtual int omap_get_all(const rgw_raw_obj& obj, std::map<string, bufferlist> *m,
82 optional_yield y);
83 virtual int omap_get_vals(const rgw_raw_obj& obj,
84 const string& marker,
85 uint64_t count,
86 std::map<string, bufferlist> *m,
87 bool *pmore,
88 optional_yield y);
89 virtual int omap_set(const rgw_raw_obj& obj, const std::string& key,
90 bufferlist& bl, bool must_exist,
91 optional_yield y);
92 virtual int omap_set(const rgw_raw_obj& obj,
93 const map<std::string, bufferlist>& m, bool must_exist,
94 optional_yield y);
95 virtual int omap_del(const rgw_raw_obj& obj, const std::string& key,
96 optional_yield y);
97
98 virtual int notify(const rgw_raw_obj& obj, bufferlist& bl,
99 uint64_t timeout_ms, bufferlist *pbl,
100 optional_yield y);
101
102 virtual int pool_list_prefixed_objs(const rgw_pool& pool,
103 const string& prefix,
104 std::function<void(const string&)> cb);
105
106 virtual int pool_list_objects_init(const rgw_pool& pool,
107 const std::string& marker,
108 const std::string& prefix,
109 RGWSI_SysObj::Pool::ListCtx *ctx);
110 virtual int pool_list_objects_next(RGWSI_SysObj::Pool::ListCtx& ctx,
111 int max,
112 vector<string> *oids,
113 bool *is_truncated);
114
115 virtual int pool_list_objects_get_marker(RGWSI_SysObj::Pool::ListCtx& _ctx,
116 string *marker);
117
118 /* wrappers */
119 int get_system_obj_state_impl(RGWSysObjectCtxBase *rctx,
120 const rgw_raw_obj& obj, RGWSysObjState **state,
121 RGWObjVersionTracker *objv_tracker,
122 optional_yield y);
123 int get_system_obj_state(RGWSysObjectCtxBase *rctx, const rgw_raw_obj& obj,
124 RGWSysObjState **state,
125 RGWObjVersionTracker *objv_tracker,
126 optional_yield y);
127
128 int stat(RGWSysObjectCtxBase& obj_ctx,
129 RGWSI_SysObj_Obj_GetObjState& state,
130 const rgw_raw_obj& obj,
131 map<string, bufferlist> *attrs,
132 bool raw_attrs,
133 real_time *lastmod,
134 uint64_t *obj_size,
135 RGWObjVersionTracker *objv_tracker,
136 optional_yield y);
137
138 public:
139 RGWSI_SysObj_Core(CephContext *cct): RGWServiceInstance(cct) {}
140
141 RGWSI_Zone *get_zone_svc() {
142 return zone_svc;
143 }
144 };