mirror of
https://github.com/ceph/ceph
synced 2025-03-18 16:36:12 +00:00
rgw: make max number of bucket/object tags configurble
Signed-off-by: Chang Liu <liuchang0812@gmail.com>
This commit is contained in:
parent
8eedfddc01
commit
5248a81bc5
@ -534,7 +534,7 @@ int RGWPutBucketTags_ObjStore_S3::get_params()
|
||||
return -ERR_MALFORMED_XML;
|
||||
}
|
||||
|
||||
RGWObjTags obj_tags;
|
||||
RGWObjTags obj_tags(50); // A tag set can contain as many as 50 tags, or it can be empty.
|
||||
r = tagging.rebuild(obj_tags);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -9,10 +9,6 @@
|
||||
|
||||
#include "rgw_tag.h"
|
||||
|
||||
static constexpr uint32_t MAX_OBJ_TAGS=10;
|
||||
static constexpr uint32_t MAX_TAG_KEY_SIZE=128;
|
||||
static constexpr uint32_t MAX_TAG_VAL_SIZE=256;
|
||||
|
||||
bool RGWObjTags::add_tag(const string&key, const string& val){
|
||||
return tag_map.emplace(std::make_pair(key,val)).second;
|
||||
}
|
||||
@ -22,9 +18,9 @@ bool RGWObjTags::emplace_tag(std::string&& key, std::string&& val){
|
||||
}
|
||||
|
||||
int RGWObjTags::check_and_add_tag(const string&key, const string& val){
|
||||
if (tag_map.size() == MAX_OBJ_TAGS ||
|
||||
key.size() > MAX_TAG_KEY_SIZE ||
|
||||
val.size() > MAX_TAG_VAL_SIZE ||
|
||||
if (tag_map.size() == max_obj_tags ||
|
||||
key.size() > max_tag_key_size ||
|
||||
val.size() > max_tag_val_size ||
|
||||
key.size() == 0){
|
||||
return -ERR_INVALID_TAG;
|
||||
}
|
||||
|
@ -15,9 +15,16 @@ class RGWObjTags
|
||||
protected:
|
||||
using tag_map_t = boost::container::flat_map <std::string, std::string>;
|
||||
tag_map_t tag_map;
|
||||
|
||||
uint32_t max_obj_tags{10};
|
||||
uint32_t max_tag_key_size{128};
|
||||
uint32_t max_tag_val_size{256};
|
||||
|
||||
public:
|
||||
RGWObjTags() {}
|
||||
~RGWObjTags() {}
|
||||
RGWObjTags() = default;
|
||||
RGWObjTags(uint32_t max_obj_tags):max_obj_tags(max_obj_tags) {}
|
||||
|
||||
virtual ~RGWObjTags() = default;
|
||||
|
||||
void encode(bufferlist& bl) const {
|
||||
ENCODE_START(1,1,bl);
|
||||
|
Loading…
Reference in New Issue
Block a user