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