Skip to content

Instantly share code, notes, and snippets.

@zaitcev
Created June 27, 2015 00:22
Show Gist options
  • Save zaitcev/96a6ecf58cea51108640 to your computer and use it in GitHub Desktop.
Save zaitcev/96a6ecf58cea51108640 to your computer and use it in GitHub Desktop.
rgw.trace.txt 2
v2
## Down the rabbit hole
- check out Yehuda's branch
- "swift and s3 have separate url-to-object translations" - ?
class rgw_obj # rgw_common.h
std::string loc;
class RGWGetObj : public RGWOp # rgw_op.h
rgw_obj obj;
map<string, bufferlist> attrs;
class RGWOp # rgw_op.h
struct req_state *s; # RGWOp(): s(NULL)
struct req_state # rgw_common.h
RGWBucketInfo bucket_info;
struct RGWBucketInfo # rgw_common.h
rgw_bucket bucket;
struct rgw_bucket # rgw_common.h
std::string name;
std::string data_pool;
std::string index_pool;
class RGWRados # rgw_rados.h
class Object
RGWBucketInfo bucket_info; # another one?
struct Read # rgw_rados.h:1511
RGWRados::Object *source;
process_request(store)
struct req_state rstate(...), *s = &rstate;
RGWHandler *handler = rest->get_handler(store, s, client_io, &mgr, &init_error);
op = handler->get_op(store);
op->pre_exec();
op->RGWGetObj::execute() # rgw_op.cc
RGWGetObj_CB cb(this);
# rgw_obj obj - this->obj
# struct req_state *s; - this->s
RGWRados::Object op_target(store, s->bucket_info,
*static_cast<RGWObjectCtx *>(s->obj_ctx), obj); # bunch of assignments
RGWRados::Object::Read read_op(source=&op_target); # bunch of assignments
RGWRados::Object::Read::prepare() # rgw_rados.cc
RGWRados *store = source->get_store();
RGWObjState *astate = source->get_state();
store->get_obj_ioctx(state.obj = astate->obj, &state.io_ctx);
RGWRados::get_obj_ioctx(const rgw_obj& obj, librados::IoCtx *ioctx) # rgw_rados.cc
# XXX wrong hole despite the comment? only opens pool for bucket!
rgw_bucket bucket;
string oid, key;
# obj.bucket.name="testcont" obj.bucket.marker="default.7593.4" obj="imas_cg_rin_3.png"
void get_obj_bucket_and_oid_loc(const rgw_obj& obj,
rgw_bucket& bucket, string& oid, string& locator{=key}) # rgw_rados.h
bucket = obj.bucket;
prepend_bucket_marker(bucket, obj.get_object(), oid); # to oid
prepend_bucket_marker(bucket, obj.get_loc(), locator);
# at this point oid="default.7593.4_imas_cg_rin_3.png" key=""
# the underscore is hardcoded in prepend_bucket_marker()
open_bucket_data_ctx(bucket, *ioctx);
string& pool = bucket.data_pool;
open_bucket_pool_ctx(bucket.name, bucket.data_pool, data_ctx);
RGWRados::open_bucket_pool_ctx(const string& bucket_name,
const string& pool, librados::IoCtx& io_ctx) # rgw_rados.cc
librados::Rados *rad = get_rados_handle();
rad->ioctx_create(pool.c_str(), io_ctx);
ioctx->locator_set_key(key);
..............
read_op.iterate(ofs, end, &cb);
op->complete();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment