encode_json("key", key, f);
}
+int rgw_parse_list_of_flags(struct rgw_name_to_flag *mapping,
+ const string& str, uint32_t *perm)
+{
+ list<string> strs;
+ get_str_list(str, strs);
+ list<string>::iterator iter;
+ uint32_t v = 0;
+ for (iter = strs.begin(); iter != strs.end(); ++iter) {
+ string& s = *iter;
+ for (int i = 0; mapping[i].type_name; i++) {
+ if (s.compare(mapping[i].type_name) == 0)
+ v |= mapping[i].flag;
+ }
+ }
+ *perm = v;
+ return 0;
+}
extern boost::optional<std::pair<std::string_view,std::string_view>>
parse_key_value(const std::string_view& in_str);
+struct rgw_name_to_flag {
+ const char *type_name;
+ uint32_t flag;
+};
+
+extern int rgw_parse_list_of_flags(struct rgw_name_to_flag *mapping,
+ const std::string& str, uint32_t *perm);
/** time parsing */
extern int parse_time(const char *time_str, real_time *time);
JSONDecoder::decode_json("status", status, obj);
}
+void rgw_shard_name(const string& prefix, unsigned max_shards, const string& key, string& name, int *shard_id)
+{
+ uint32_t val = ceph_str_hash_linux(key.c_str(), key.size());
+ char buf[16];
+ if (shard_id) {
+ *shard_id = val % max_shards;
+ }
+ snprintf(buf, sizeof(buf), "%u", (unsigned)(val % max_shards));
+ name = prefix + buf;
+}
+
+void rgw_shard_name(const string& prefix, unsigned max_shards, const string& section, const string& key, string& name)
+{
+ uint32_t val = ceph_str_hash_linux(key.c_str(), key.size());
+ val ^= ceph_str_hash_linux(section.c_str(), section.size());
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", (unsigned)(val % max_shards));
+ name = prefix + buf;
+}
+
+void rgw_shard_name(const string& prefix, unsigned shard_id, string& name)
+{
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", shard_id);
+ name = prefix + buf;
+}
int RGWMetadataLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl) {
if (!svc.zone->need_to_log_metadata())
virtual void encode_obj(bufferlist *bl) {}
};
+void rgw_shard_name(const std::string& prefix, unsigned max_shards, const std::string& key, std::string& name, int *shard_id);
+void rgw_shard_name(const std::string& prefix, unsigned max_shards, const std::string& section, const std::string& key, std::string& name);
+void rgw_shard_name(const std::string& prefix, unsigned shard_id, std::string& name);
#endif
return true;
}
+int rgw_policy_from_attrset(const DoutPrefixProvider *dpp, CephContext *cct, map<string, bufferlist>& attrset, RGWAccessControlPolicy *policy)
+{
+ map<string, bufferlist>::iterator aiter = attrset.find(RGW_ATTR_ACL);
+ if (aiter == attrset.end())
+ return -EIO;
+
+ bufferlist& bl = aiter->second;
+ auto iter = bl.cbegin();
+ try {
+ policy->decode(iter);
+ } catch (buffer::error& err) {
+ ldpp_dout(dpp, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl;
+ return -EIO;
+ }
+ if (cct->_conf->subsys.should_gather<ceph_subsys_rgw, 15>()) {
+ RGWAccessControlPolicy_S3 *s3policy = static_cast<RGWAccessControlPolicy_S3 *>(policy);
+ ldpp_dout(dpp, 15) << __func__ << " Read AccessControlPolicy";
+ s3policy->to_xml(*_dout);
+ *_dout << dendl;
+ }
+ return 0;
+}
+
int RGWGetObj::read_user_manifest_part(rgw::sal::Bucket* bucket,
const rgw_bucket_dir_entry& ent,
RGWAccessControlPolicy * const bucket_acl,
return 0;
}
+int rgw_policy_from_attrset(const DoutPrefixProvider *dpp,
+ CephContext *cct,
+ std::map<std::string, bufferlist>& attrset,
+ RGWAccessControlPolicy *policy);
+
#endif /* CEPH_RGW_OP_H */
return 0;
}
-int rgw_policy_from_attrset(const DoutPrefixProvider *dpp, CephContext *cct, map<string, bufferlist>& attrset, RGWAccessControlPolicy *policy)
-{
- map<string, bufferlist>::iterator aiter = attrset.find(RGW_ATTR_ACL);
- if (aiter == attrset.end())
- return -EIO;
-
- bufferlist& bl = aiter->second;
- auto iter = bl.cbegin();
- try {
- policy->decode(iter);
- } catch (buffer::error& err) {
- ldpp_dout(dpp, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl;
- return -EIO;
- }
- if (cct->_conf->subsys.should_gather<ceph_subsys_rgw, 15>()) {
- RGWAccessControlPolicy_S3 *s3policy = static_cast<RGWAccessControlPolicy_S3 *>(policy);
- ldpp_dout(dpp, 15) << __func__ << " Read AccessControlPolicy";
- s3policy->to_xml(*_dout);
- *_dout << dendl;
- }
- return 0;
-}
-
-
int RGWRados::Bucket::update_bucket_id(const string& new_bucket_id, const DoutPrefixProvider *dpp)
{
rgw_bucket bucket = bucket_info.bucket;
}
}
-int rgw_policy_from_attrset(const DoutPrefixProvider *dpp,
- CephContext *cct,
- std::map<std::string, bufferlist>& attrset,
- RGWAccessControlPolicy *policy);
-
struct RGWOLHInfo {
rgw_obj target;
bool removed;
return 0;
}
-void rgw_shard_name(const string& prefix, unsigned max_shards, const string& key, string& name, int *shard_id)
-{
- uint32_t val = ceph_str_hash_linux(key.c_str(), key.size());
- char buf[16];
- if (shard_id) {
- *shard_id = val % max_shards;
- }
- snprintf(buf, sizeof(buf), "%u", (unsigned)(val % max_shards));
- name = prefix + buf;
-}
-
-void rgw_shard_name(const string& prefix, unsigned max_shards, const string& section, const string& key, string& name)
-{
- uint32_t val = ceph_str_hash_linux(key.c_str(), key.size());
- val ^= ceph_str_hash_linux(section.c_str(), section.size());
- char buf[16];
- snprintf(buf, sizeof(buf), "%u", (unsigned)(val % max_shards));
- name = prefix + buf;
-}
-
-void rgw_shard_name(const string& prefix, unsigned shard_id, string& name)
-{
- char buf[16];
- snprintf(buf, sizeof(buf), "%u", shard_id);
- name = prefix + buf;
-}
-
-int rgw_parse_list_of_flags(struct rgw_name_to_flag *mapping,
- const string& str, uint32_t *perm)
-{
- list<string> strs;
- get_str_list(str, strs);
- list<string>::iterator iter;
- uint32_t v = 0;
- for (iter = strs.begin(); iter != strs.end(); ++iter) {
- string& s = *iter;
- for (int i = 0; mapping[i].type_name; i++) {
- if (s.compare(mapping[i].type_name) == 0)
- v |= mapping[i].flag;
- }
- }
-
- *perm = v;
- return 0;
-}
-
int rgw_put_system_obj(const DoutPrefixProvider *dpp,
RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive,
RGWObjVersionTracker *objv_tracker, real_time set_mtime, optional_yield y, map<string, bufferlist> *pattrs)
max_shards);
}
-void rgw_shard_name(const std::string& prefix, unsigned max_shards, const std::string& key, std::string& name, int *shard_id);
-void rgw_shard_name(const std::string& prefix, unsigned max_shards, const std::string& section, const std::string& key, std::string& name);
-void rgw_shard_name(const std::string& prefix, unsigned shard_id, std::string& name);
-
-struct rgw_name_to_flag {
- const char *type_name;
- uint32_t flag;
-};
-
-int rgw_parse_list_of_flags(struct rgw_name_to_flag *mapping,
- const std::string& str, uint32_t *perm);
-
int rgw_put_system_obj(const DoutPrefixProvider *dpp, RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const std::string& oid, bufferlist& data, bool exclusive,
RGWObjVersionTracker *objv_tracker, real_time set_mtime, optional_yield y, std::map<std::string, bufferlist> *pattrs = NULL);
int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const std::string& key, bufferlist& bl,