OPTION(rgw_multipart_min_part_size, OPT_INT, 5 * 1024 * 1024) // min size for each part (except for last one) in multipart upload
OPTION(rgw_multipart_part_upload_limit, OPT_INT, 10000) // parts limit in multipart upload
+OPTION(rgw_max_slo_entries, OPT_INT, 1000) // default number of max entries in slo
+
OPTION(rgw_olh_pending_timeout_sec, OPT_INT, 3600) // time until we retire a pending olh change
OPTION(rgw_user_max_buckets, OPT_U32, 1000) // global option to set max buckets count for all user
#include "rgw_bucket.h"
#include "rgw_keystone.h"
#include "rgw_basic_types.h"
+#include "rgw_op.h"
#include "common/ceph_json.h"
#include "common/Formatter.h"
JSONDecoder::decode_json("user", user, access_obj, true);
JSONDecoder::decode_json("serviceCatalog", service_catalog, access_obj);
}
+
+void rgw_slo_entry::decode_json(JSONObj *obj)
+{
+ JSONDecoder::decode_json("path", path, obj);
+ JSONDecoder::decode_json("etag", etag, obj);
+ JSONDecoder::decode_json("size_bytes", size_bytes, obj);
+};
virtual uint32_t op_mask() { return RGW_OP_TYPE_DELETE; }
};
+struct rgw_slo_entry {
+ string path;
+ string etag;
+ uint64_t size_bytes;
+
+ void decode_json(JSONObj *obj);
+};
+
+struct RGWSLOInfo {
+ vector<rgw_slo_entry> entries;
+};
+
class RGWPutObj : public RGWOp {
friend class RGWPutObjProcessor;
bool chunked_upload;
RGWAccessControlPolicy policy;
const char *dlo_manifest;
+ RGWSLOInfo *slo_info;
+
time_t mtime;
uint64_t olh_epoch;
time_t delete_at;
public:
- RGWPutObj() {
- ret = 0;
- ofs = 0;
- supplied_md5_b64 = NULL;
- supplied_etag = NULL;
- if_match = NULL;
- if_nomatch = NULL;
- chunked_upload = false;
- dlo_manifest = NULL;
- mtime = 0;
- olh_epoch = 0;
- delete_at = 0;
+ RGWPutObj() : ret(0), ofs(0),
+ supplied_md5_b64(NULL),
+ supplied_etag(NULL),
+ if_match(NULL),
+ if_nomatch(NULL),
+ chunked_upload(0),
+ dlo_manifest(NULL),
+ slo_info(NULL),
+ mtime(0),
+ olh_epoch(0),
+ delete_at(0) {}
+
+ ~RGWPutObj() {
+ delete slo_info;
}
virtual void init(RGWRados *store, struct req_state *s, RGWHandler *h) {
policy.create_default(s->user.user_id, s->user.display_name);
- dlo_manifest = s->info.env->get("HTTP_X_OBJECT_MANIFEST");
-
int r = get_delete_at_param(s, &delete_at);
if (r < 0) {
ldout(s->cct, 5) << "ERROR: failed to get Delete-At param" << dendl;
return r;
}
+ dlo_manifest = s->info.env->get("HTTP_X_OBJECT_MANIFEST");
+ bool exists;
+ string multipart_manifest = s->info.args.get("multipart-manifest", &exists);
+ if (exists) {
+ if (multipart_manifest != "put") {
+ ldout(s->cct, 5) << "invalid multipart-manifest http param: " << multipart_manifest << dendl;
+ return -EINVAL;
+ }
+
+#define MAX_SLO_ENTRY_SIZE (1024 + 128) // 1024 - max obj name, 128 - enough extra for other info
+ uint64_t max_len = s->cct->_conf->rgw_max_slo_entries * MAX_SLO_ENTRY_SIZE;
+
+ slo_info = new RGWSLOInfo;
+ int r = rgw_rest_get_json_input(s->cct, s, slo_info->entries, max_len, NULL);
+ if (r < 0) {
+ ldout(s->cct, 5) << "failed to read input for slo r=" << r << dendl;
+ return r;
+ }
+
+ if (slo_info->entries.size() > s->cct->_conf->rgw_max_slo_entries) {
+ ldout(s->cct, 5) << "too many entries in slo request: " << slo_info->entries.size() << dendl;
+ return -EINVAL;
+ }
+ }
+
return RGWPutObj_ObjStore::get_params();
}