int RGWLibProcess::start_request(RGWLibContinuedReq* req)
{
- int ret = 0;
- int op_ret = 0;
dout(1) << "====== " << __func__
<< " starting new continued request req=" << hex << req << dec
struct req_state* s = req->get_state();
- /* XXXX the below stanza can be completely internalized--req has
- * all these objects */
-
-#if 0
- /* XXX and -then- stash req_state pointers everywhere they are needed */
- ret = req->init(rgw_env, &rados_ctx, io, s);
- if (ret < 0) {
- dout(10) << "failed to initialize request" << dendl;
- abort_req(s, op, ret);
- goto done;
- }
-#endif
-
/* req is-a RGWOp, currently initialized separately */
- ret = req->op_init();
+ int ret = req->op_init();
if (ret < 0) {
dout(10) << "failed to initialize RGWOp" << dendl;
abort_req(s, op, ret);
op->pre_exec();
req->exec_start();
- op_ret = op->get_ret();
-
done:
return (ret < 0 ? ret : s->err.ret);
}
int RGWLibProcess::finish_request(RGWLibContinuedReq* req)
{
- return 0;
+ RGWOp *op = (req->op) ? req->op : dynamic_cast<RGWOp*>(req);
+ if (! op) {
+ dout(1) << "failed to derive cognate RGWOp (invalid op?)" << dendl;
+ return -EINVAL;
+ }
+
+ int ret = req->exec_finish();
+ int op_ret = op->get_ret();
+
+ dout(1) << "====== " << __func__
+ << " finishing continued request req=" << hex << req << dec
+ << " op status=" << op_ret
+ << " ======" << dendl;
+
+ return ret;
}
int RGWLibFrontend::init()
int rc = 0;
file* f = get<file>(&variant_type);
if (f && (f->write_req)) {
- rc = librgw.get_fe()->finish_req(f->write_req);
+ rc = f->write_req->exec_finish();
+ // rc = librgw.get_fe()->finish_req(f->write_req); // XXX
if (! rc) {
rc = f->write_req->get_ret();
if (! rc) {
public:
RGWFileHandle(RGWLibFS* fs, uint32_t fs_inst, RGWFileHandle* _parent,
const fh_key& _fhk, std::string& _name, uint32_t _flags)
- : bucket(nullptr), parent(_parent), name(std::move(_name)), fhk(_fhk),
- flags(_flags) {
+ : refcnt(0), fs(fs), bucket(nullptr), parent(_parent),
+ name(std::move(_name)), fhk(_fhk), flags(_flags) {
if (parent->is_root()) {
fh.fh_type = RGW_FS_TYPE_DIRECTORY;
: RGWLibContinuedReq(_cct, _user), bucket_name(_bname), obj_name(_oname),
rgw_fh(_fh), processor(nullptr), last_off(0), next_off(0),
bytes_written(0), multipart(false) {
+
+ int ret = header_init();
+ if (ret == 0) {
+ ret = init_from_header(get_state());
+ }
+
magic = 81;
op = this;
}
}
void put_data(off_t off, buffer::list& _bl) {
- next_off = off;
+ ofs = off;
data.claim(_bl);
}
{
RGWUserInfo user_info;
public:
- RGWLibIO() {}
+ RGWLibIO() {
+ get_env().set("HTTP_HOST", "");
+ }
RGWLibIO(const RGWUserInfo &_user_info)
: user_info(_user_info) {}
public:
RGWLibContinuedReq(CephContext* _cct, RGWUserInfo* _user)
- : RGWLibRequest(_cct, _user), rstate(_cct, &io_ctx.get_env(), _user),
- rados_ctx(librgw.get_store(), &rstate)
+ : RGWLibRequest(_cct, _user), io_ctx(),
+ rstate(_cct, &io_ctx.get_env(), _user), rados_ctx(librgw.get_store(),
+ &rstate)
{
io_ctx.init(_cct);
- /* XXX for now, use ""; could be a legit hostname, or, in future,
- * perhaps a tenant (Yehuda) */
- io_ctx.get_env().set("HTTP_HOST", "");
+ RGWRequest::init_state(&rstate);
+ RGWHandler::init(rados_ctx.store, &rstate, &io_ctx);
+
+ /* fixup _s->req */
+ get_state()->req = this;
+
+ log_init();
+
+ get_state()->obj_ctx = &rados_ctx;
+ get_state()->req_id = store->unique_id(id);
+ get_state()->trans_id = store->unique_trans_id(id);
+
+ log_format(get_state(), "initializing for trans_id = %s",
+ get_state()->trans_id.c_str());
}
inline RGWRados* get_store() { return store; }
struct iovec *iovs = zp_set1.get_iovs();
for (int ix : {2 , 3}) {
struct iovec *iov = &iovs[ix];
- int ret = rgw_read(fs, object_fh, offset, iov[ix-2].iov_len, &nread,
+ int ret = rgw_read(fs, object_fh, offset, iovs[ix-2].iov_len, &nread,
iov->iov_base);
offset += iov->iov_len;
ASSERT_EQ(ret, 0);