#define RGW_ATTR_EXPIRES RGW_ATTR_PREFIX "expires"
#define RGW_ATTR_DELETE_AT RGW_ATTR_PREFIX "delete_at"
#define RGW_ATTR_ID_TAG RGW_ATTR_PREFIX "idtag"
+#define RGW_ATTR_TAIL_TAG RGW_ATTR_PREFIX "tail_tag"
#define RGW_ATTR_SHADOW_OBJ RGW_ATTR_PREFIX "shadow_name"
#define RGW_ATTR_MANIFEST RGW_ATTR_PREFIX "manifest"
#define RGW_ATTR_USER_MANIFEST RGW_ATTR_PREFIX "user_manifest"
#define ERR_ZERO_IN_URL 2211
#define ERR_MALFORMED_ACL_ERROR 2212
#define ERR_ZONEGROUP_DEFAULT_PLACEMENT_MISCONFIGURATION 2213
+#define ERR_INVALID_ENCRYPTION_ALGORITHM 2214
#define ERR_BUSY_RESHARDING 2300
void append(const string& name, const string& val);
/** Get the value for a specific argument parameter */
const string& get(const string& name, bool *exists = NULL) const;
+ boost::optional<const std::string&>
+ get_optional(const std::string& name) const;
int get_bool(const string& name, bool *val, bool *exists);
int get_bool(const char *name, bool *val, bool *exists);
void get_bool(const char *name, bool *val, bool def_val);
void init(CephContext *cct);
void init(CephContext *cct, char **envp);
- void set(const boost::string_ref& name, const boost::string_ref& val);
+ void set(std::string name, std::string val);
const char *get(const char *name, const char *def_val = nullptr) const;
int get_int(const char *name, int def_val = 0) const;
bool get_bool(const char *name, bool def_val = 0);
RGW_OP_STAT_ACCOUNT,
RGW_OP_LIST_BUCKET,
RGW_OP_GET_BUCKET_LOGGING,
+ RGW_OP_GET_BUCKET_LOCATION,
RGW_OP_GET_BUCKET_VERSIONING,
RGW_OP_SET_BUCKET_VERSIONING,
RGW_OP_GET_BUCKET_WEBSITE,
RGW_OP_PUT_OBJ_TAGGING,
RGW_OP_GET_OBJ_TAGGING,
RGW_OP_DELETE_OBJ_TAGGING,
+ RGW_OP_PUT_LC,
+ RGW_OP_GET_LC,
+ RGW_OP_DELETE_LC,
/* rgw specific */
RGW_OP_ADMIN_SET_METADATA,
RGW_OP_GET_OBJ_LAYOUT,
WRITE_CLASS_ENCODER(RGWUserInfo)
struct rgw_pool {
- string name;
- string ns;
+ std::string name;
+ std::string ns;
- rgw_pool() {}
+ rgw_pool() = default;
rgw_pool(const rgw_pool& _p) : name(_p.name), ns(_p.ns) {}
+ rgw_pool(rgw_pool&&) = default;
rgw_pool(const string& _s) {
from_str(_s);
}
DECODE_FINISH(bl);
}
+ rgw_pool& operator=(const rgw_pool&) = default;
+
bool operator==(const rgw_pool& p) const {
return (compare(p) == 0);
}
rgw_pool data_extra_pool;
rgw_pool index_pool;
- rgw_data_placement_target() {}
+ rgw_data_placement_target() = default;
+ rgw_data_placement_target(const rgw_data_placement_target&) = default;
+ rgw_data_placement_target(rgw_data_placement_target&&) = default;
- rgw_data_placement_target(const rgw_pool& _data_pool, const rgw_pool& _data_extra_pool, const rgw_pool& _index_pool)
- : data_pool(_data_pool), data_extra_pool(_data_extra_pool), index_pool(_index_pool) {}
+ rgw_data_placement_target(const rgw_pool& data_pool,
+ const rgw_pool& data_extra_pool,
+ const rgw_pool& index_pool)
+ : data_pool(data_pool),
+ data_extra_pool(data_extra_pool),
+ index_pool(index_pool) {
+ }
+
+ rgw_data_placement_target&
+ operator=(const rgw_data_placement_target&) = default;
const rgw_pool& get_data_extra_pool() const {
if (data_extra_pool.empty()) {
explicit_placement(b.explicit_placement.data_pool,
b.explicit_placement.data_extra_pool,
b.explicit_placement.index_pool) {}
+ rgw_bucket(const rgw_bucket&) = default;
+ rgw_bucket(rgw_bucket&&) = default;
void convert(cls_user_bucket *b) const {
b->name = name;
void decode_json(JSONObj *obj);
static void generate_test_instances(list<rgw_bucket*>& o);
+ rgw_bucket& operator=(const rgw_bucket&) = default;
+
bool operator<(const rgw_bucket& b) const {
return name.compare(b.name) < 0;
}
* part of the given namespace, it returns false.
*/
static bool oid_to_key_in_ns(const string& oid, rgw_obj_key *key, const string& ns) {
- string obj_ns;
bool ret = parse_raw_oid(oid, key);
if (!ret) {
return ret;
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
+ void decode_json(JSONObj *obj);
};
WRITE_CLASS_ENCODER(rgw_obj_key)
rgw_bucket bucket;
size_t size;
size_t size_rounded;
- real_time creation_time;
+ ceph::real_time creation_time;
uint64_t count;
- RGWBucketEnt() : size(0), size_rounded(0), count(0) {}
+ /* The placement_rule is necessary to calculate per-storage-policy statics
+ * of the Swift API. Although the info available in RGWBucketInfo, we need
+ * to duplicate it here to not affect the performance of buckets listing. */
+ std::string placement_rule;
- explicit RGWBucketEnt(const rgw_user& u, const cls_user_bucket_entry& e)
- : bucket(u, e.bucket),
+ RGWBucketEnt()
+ : size(0),
+ size_rounded(0),
+ count(0) {
+ }
+ RGWBucketEnt(const RGWBucketEnt&) = default;
+ RGWBucketEnt(RGWBucketEnt&&) = default;
+ explicit RGWBucketEnt(const rgw_user& u, cls_user_bucket_entry&& e)
+ : bucket(u, std::move(e.bucket)),
size(e.size),
size_rounded(e.size_rounded),
creation_time(e.creation_time),
count(e.count) {
}
+ RGWBucketEnt& operator=(const RGWBucketEnt&) = default;
+
void convert(cls_user_bucket_entry *b) const {
bucket.convert(&b->bucket);
b->size = size;
}
void encode(bufferlist& bl) const {
- ENCODE_START(6, 5, bl);
+ ENCODE_START(7, 5, bl);
uint64_t s = size;
__u32 mt = ceph::real_clock::to_time_t(creation_time);
string empty_str; // originally had the bucket name here, but we encode bucket later
s = size_rounded;
::encode(s, bl);
::encode(creation_time, bl);
+ ::encode(placement_rule, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
size_rounded = s;
if (struct_v >= 6)
::decode(creation_time, bl);
+ if (struct_v >= 7)
+ ::decode(placement_rule, bl);
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
const int perm);
bool verify_bucket_permission_no_policy(struct req_state * const s,
const int perm);
+int verify_bucket_owner_or_policy(struct req_state* const s,
+ const uint64_t op);
extern bool verify_object_permission(
struct req_state * const s,
const rgw_obj& obj,
extern int rgw_parse_op_type_list(const string& str, uint32_t *perm);
-namespace {
- constexpr uint32_t MATCH_POLICY_ACTION = 0x01;
- constexpr uint32_t MATCH_POLICY_RESOURCE = 0x02;
- constexpr uint32_t MATCH_POLICY_ARN = 0x04;
- constexpr uint32_t MATCH_POLICY_STRING = 0x08;
-}
+static constexpr uint32_t MATCH_POLICY_ACTION = 0x01;
+static constexpr uint32_t MATCH_POLICY_RESOURCE = 0x02;
+static constexpr uint32_t MATCH_POLICY_ARN = 0x04;
+static constexpr uint32_t MATCH_POLICY_STRING = 0x08;
+
+extern bool match_policy(boost::string_view pattern, boost::string_view input,
+ uint32_t flag);
-int match(const std::string& pattern, const std::string& input, uint32_t flag);
#endif