]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/services/svc_tier_rados.h
925a2d25e069975dc50545b31076e6331d391643
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
5 * Ceph - scalable distributed file system
7 * Copyright (C) 2019 Red Hat, Inc.
9 * This is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 2.1, as published by the Free Software
12 * Foundation. See file COPYING.
19 #include "rgw/rgw_service.h"
21 #include "svc_rados.h"
23 extern const std::string MP_META_SUFFIX
;
32 RGWMPObj(const string
& _oid
, const string
& _upload_id
) {
33 init(_oid
, _upload_id
, _upload_id
);
35 void init(const string
& _oid
, const string
& _upload_id
) {
36 init(_oid
, _upload_id
, _upload_id
);
38 void init(const string
& _oid
, const string
& _upload_id
, const string
& part_unique_str
) {
44 upload_id
= _upload_id
;
46 meta
= prefix
+ upload_id
+ MP_META_SUFFIX
;
47 prefix
.append(part_unique_str
);
49 const string
& get_meta() const { return meta
; }
50 string
get_part(int num
) const {
52 snprintf(buf
, 16, ".%d", num
);
57 string
get_part(string
& part
) const {
63 const string
& get_upload_id() const {
66 const string
& get_key() const {
69 bool from_meta(string
& meta
) {
70 int end_pos
= meta
.rfind('.'); // search for ".meta"
73 int mid_pos
= meta
.rfind('.', end_pos
- 1); // <key>.<upload_id>
76 oid
= meta
.substr(0, mid_pos
);
77 upload_id
= meta
.substr(mid_pos
+ 1, end_pos
- mid_pos
- 1);
78 init(oid
, upload_id
, upload_id
);
90 * A filter to a) test whether an object name is a multipart meta
91 * object, and b) filter out just the key used to determine the bucket
94 * Objects for multipart meta have names adorned with an upload id and
95 * other elements -- specifically a ".", MULTIPART_UPLOAD_ID_PREFIX,
96 * unique id, and MP_META_SUFFIX. This filter will return true when
97 * the name provided is such. It will also extract the key used for
98 * bucket index shard calculation from the adorned name.
100 class MultipartMetaFilter
: public RGWAccessListFilter
{
102 MultipartMetaFilter() {}
105 * @param name [in] The object name as it appears in the bucket index.
106 * @param key [out] An output parameter that will contain the bucket
107 * index key if this entry is in the form of a multipart meta object.
108 * @return true if the name provided is in the form of a multipart meta
109 * object, false otherwise
111 bool filter(const string
& name
, string
& key
) override
;
114 class RGWSI_Tier_RADOS
: public RGWServiceInstance
116 RGWSI_Zone
*zone_svc
{nullptr};
119 RGWSI_Tier_RADOS(CephContext
*cct
): RGWServiceInstance(cct
) {}
121 void init(RGWSI_Zone
*_zone_svc
) {
122 zone_svc
= _zone_svc
;
125 static inline bool raw_obj_to_obj(const rgw_bucket
& bucket
, const rgw_raw_obj
& raw_obj
, rgw_obj
*obj
) {
126 ssize_t pos
= raw_obj
.oid
.find('_');
131 if (!rgw_obj_key::parse_raw_oid(raw_obj
.oid
.substr(pos
+ 1), &obj
->key
)) {
134 obj
->bucket
= bucket
;