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;
#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;
}
}
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;
}
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);