delete write_req;
}
+int RGWWriteRequest::exec_start() {
+ struct req_state* s = get_state();
+
+ perfcounter->inc(l_rgw_put);
+ op_ret = -EINVAL;
+
+ // XXX check this
+ if (s->object.empty()) {
+ goto done;
+ }
+
+ op_ret = get_params();
+ if (op_ret < 0)
+ goto done;
+
+ op_ret = get_system_versioning_params(s, &olh_epoch, &version_id);
+ if (op_ret < 0) {
+ goto done;
+ }
+
+ /* user-supplied MD5 check skipped (not supplied) */
+ /* early quota check skipped--we don't have size yet */
+ /* skipping user-supplied etag--we might have one in future, but
+ * like data it and other attrs would arrive after open */
+ processor = select_processor(*static_cast<RGWObjectCtx *>(s->obj_ctx),
+ &multipart);
+ op_ret = processor->prepare(get_store(), NULL);
+
+done:
+ return op_ret;
+} /* exec_start */
+
+
/* librgw */
extern "C" {
public:
const std::string& bucket_name;
const std::string& obj_name;
+ RGWPutObjProcessor *processor;
buffer::list bl;
off_t last_off;
off_t next_off;
size_t bytes_written;
+ bool multipart;
RGWWriteRequest(CephContext* _cct, RGWUserInfo *_user,
const std::string& _bname, const std::string& _oname)
: RGWLibContinuedReq(_cct, _user), bucket_name(_bname), obj_name(_oname),
- last_off(0), next_off(0), bytes_written(0) {
+ processor(nullptr), last_off(0), next_off(0), bytes_written(0),
+ multipart(false) {
magic = 81;
op = this;
}
bl.claim(_bl);
}
- virtual int exec_start() {
- return 0;
- }
+ virtual int exec_start();
virtual int exec_continue() {
if (next_off != last_off)
#include "include/str_list.h"
+#include "include/assert.h"
+
+
#define dout_subsys ceph_subsys_rgw
int RGWFrontendConfig::parse_config(const string& config,
io_ctx.get_env().set("HTTP_HOST", "");
}
+ inline RGWRados* get_store() { return store; }
+
virtual int execute() final { abort(); }
virtual int exec_start() = 0;
virtual int exec_continue() = 0;
rgw_bucket_object_pre_exec(s);
}
-static int put_data_and_throttle(RGWPutObjProcessor *processor, bufferlist& data, off_t ofs,
- MD5 *hash, bool need_to_wait)
-{
- bool again;
-
- do {
- void *handle;
-
- int ret = processor->handle_data(data, ofs, hash, &handle, &again);
- if (ret < 0)
- return ret;
-
- ret = processor->throttle_data(handle, need_to_wait);
- if (ret < 0)
- return ret;
-
- need_to_wait = false; /* the need to wait only applies to the first iteration */
- } while (again);
-
- return 0;
-}
-
-static int get_system_versioning_params(req_state *s, uint64_t *olh_epoch, string *version_id)
-{
- if (!s->system_request) {
- return 0;
- }
-
- if (olh_epoch) {
- string epoch_str = s->info.args.get(RGW_SYS_PARAM_PREFIX "versioned-epoch");
- if (!epoch_str.empty()) {
- string err;
- *olh_epoch = strict_strtol(epoch_str.c_str(), 10, &err);
- if (!err.empty()) {
- ldout(s->cct, 0) << "failed to parse versioned-epoch param" << dendl;
- return -EINVAL;
- }
- }
- }
-
- if (version_id) {
- *version_id = s->info.args.get(RGW_SYS_PARAM_PREFIX "version-id");
- }
-
- return 0;
-}
-
static void encode_delete_at_attr(time_t delete_at, map<string, bufferlist>& attrs)
{
if (delete_at == 0) {
extern int rgw_build_bucket_policies(RGWRados* store, struct req_state* s);
+static inline int put_data_and_throttle(RGWPutObjProcessor *processor,
+ bufferlist& data, off_t ofs,
+ MD5 *hash, bool need_to_wait)
+{
+ bool again;
+
+ do {
+ void *handle;
+
+ int ret = processor->handle_data(data, ofs, hash, &handle, &again);
+ if (ret < 0)
+ return ret;
+
+ ret = processor->throttle_data(handle, need_to_wait);
+ if (ret < 0)
+ return ret;
+
+ need_to_wait = false; /* the need to wait only applies to the first
+ * iteration */
+ } while (again);
+
+ return 0;
+} /* put_data_and_throttle */
+
+static inline int get_system_versioning_params(req_state *s,
+ uint64_t *olh_epoch,
+ string *version_id)
+{
+ if (!s->system_request) {
+ return 0;
+ }
+
+ if (olh_epoch) {
+ string epoch_str = s->info.args.get(RGW_SYS_PARAM_PREFIX "versioned-epoch");
+ if (!epoch_str.empty()) {
+ string err;
+ *olh_epoch = strict_strtol(epoch_str.c_str(), 10, &err);
+ if (!err.empty()) {
+ lsubdout(s->cct, rgw, 0) << "failed to parse versioned-epoch param"
+ << dendl;
+ return -EINVAL;
+ }
+ }
+ }
+
+ if (version_id) {
+ *version_id = s->info.args.get(RGW_SYS_PARAM_PREFIX "version-id");
+ }
+
+ return 0;
+} /* get_system_versioning_params */
+
#endif /* CEPH_RGW_OP_H */