X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Frgw%2Frgw_tag.cc;fp=src%2Fceph%2Fsrc%2Frgw%2Frgw_tag.cc;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=76b361f4deadee19b602176845d871d7b561bd34;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/rgw/rgw_tag.cc b/src/ceph/src/rgw/rgw_tag.cc deleted file mode 100644 index 76b361f..0000000 --- a/src/ceph/src/rgw/rgw_tag.cc +++ /dev/null @@ -1,52 +0,0 @@ - -#include -#include - -#include -#include - -#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 || - key.size() == 0){ - return -ERR_INVALID_TAG; - } - - // if we get a conflicting key, either the XML is malformed or the user - // supplied an invalid string - if (!add_tag(key,val)) - return -EINVAL; - - return 0; -} - -int RGWObjTags::set_from_string(const string& input){ - int ret=0; - vector kvs; - boost::split(kvs, input, boost::is_any_of("&")); - for (const auto& kv: kvs){ - auto p = kv.find("="); - string key,val; - if (p != string::npos) { - ret = check_and_add_tag(url_decode(kv.substr(0,p)), - url_decode(kv.substr(p+1))); - } else { - ret = check_and_add_tag(url_decode(kv)); - } - - if (ret < 0) - return ret; - } - return ret; -}