Skip to content

Commit

Permalink
Revert "LifeCycle feature"
Browse files Browse the repository at this point in the history
It's not there yet. Created a branch with a few fixes, will need to go
through some more revisions.

This reverts commit 7d48f62.
  • Loading branch information
yehudasa committed Dec 9, 2015
1 parent b63c3fa commit 9162bd2
Show file tree
Hide file tree
Showing 27 changed files with 12 additions and 1,817 deletions.
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,6 @@ if(${WITH_RADOSGW})
rgw/rgw_acl.cc
rgw/rgw_acl_s3.cc
rgw/rgw_acl_swift.cc
rgw/rgw_lc.cc
rgw/rgw_lc_s3.cc
rgw/rgw_client_io.cc
rgw/rgw_fcgi.cc
rgw/rgw_xml.cc
Expand Down
150 changes: 0 additions & 150 deletions src/cls/rgw/cls_rgw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ cls_method_handle_t h_rgw_user_usage_log_trim;
cls_method_handle_t h_rgw_gc_set_entry;
cls_method_handle_t h_rgw_gc_list;
cls_method_handle_t h_rgw_gc_remove;
cls_method_handle_t h_rgw_lc_set_entry;
cls_method_handle_t h_rgw_lc_rm_entry;
cls_method_handle_t h_rgw_lc_get_entry;
cls_method_handle_t h_rgw_lc_put_head;
cls_method_handle_t h_rgw_lc_get_head;
cls_method_handle_t h_rgw_lc_list_entry;


#define ROUND_BLOCK_SIZE 4096
Expand Down Expand Up @@ -3060,142 +3054,6 @@ static int rgw_cls_gc_remove(cls_method_context_t hctx, bufferlist *in, bufferli
return gc_remove(hctx, op.tags);
}

static int rgw_cls_lc_set_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist::iterator in_iter = in->begin();

cls_rgw_lc_set_entry_op op;
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_set_entry(): failed to decode entry\n");
return -EINVAL;
}

bufferlist bl;
::encode(op.entry, bl);

int ret = cls_cxx_map_set_val(hctx, op.entry.first, &bl);
return ret;
}

static int rgw_cls_lc_rm_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist::iterator in_iter = in->begin();

cls_rgw_lc_rm_entry_op op;
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_rm_entry(): failed to decode entry\n");
return -EINVAL;
}

bufferlist bl;
::encode(op.entry, bl);

int ret = cls_cxx_map_remove_key(hctx, op.entry.first);
return ret;
}

static int rgw_cls_lc_get_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist::iterator in_iter = in->begin();
cls_rgw_lc_get_entry_ret op_ret;
cls_rgw_lc_get_entry_op op;
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_rm_entry(): failed to decode entry\n");
return -EINVAL;
}

map<string, bufferlist> vals;
string filter_prefix;
int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix, 1, &vals);
if (ret < 0)
return ret;
map<string, bufferlist>::iterator it;
pair<string, int> entry;
if (!vals.empty()) {
it=vals.begin();
in_iter = it->second.begin();
try {
::decode(entry, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_get_entry(): failed to decode entry\n");
return -EINVAL;
}
}
op_ret.entry = entry;
::encode(op_ret, *out);
return 0;
}

static int rgw_cls_lc_list_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
cls_rgw_lc_list_entry_ret op_ret;
bufferlist::iterator iter;
map<string, bufferlist> vals;
int ret = cls_cxx_map_get_all_vals(hctx, &vals);
if (ret < 0)
return ret;
map<string, bufferlist>::iterator it;
pair<string, int> entry;
for (it = vals.begin(); it != vals.end(); it++) {
iter = it->second.begin();
try {
::decode(entry, iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_list_entry(): failed to decode entry\n");
return -EINVAL;
}
op_ret.entries.insert(entry);
}
::encode(op_ret, *out);
return 0;
}

static int rgw_cls_lc_put_head(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist::iterator in_iter = in->begin();

cls_rgw_lc_put_head_op op;
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_lc_set_entry(): failed to decode entry\n");
return -EINVAL;
}

bufferlist bl;
::encode(op.head, bl);
int ret = cls_cxx_map_write_header(hctx,&bl);
return ret;
}

static int rgw_cls_lc_get_head(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist bl;
int ret = cls_cxx_map_read_header(hctx, &bl);
if (ret < 0)
return ret;
cls_rgw_lc_obj_head head;
if (bl.length() != 0) {
bufferlist::iterator iter = bl.begin();
try {
::decode(head, iter);
} catch (buffer::error& err) {
CLS_LOG(0, "ERROR: rgw_cls_lc_get_head(): failed to decode entry %s\n",err.what());
return -EINVAL;
}
}
cls_rgw_lc_get_head_ret op_ret;
op_ret.head = head;
::encode(op_ret, *out);
return 0;
}

void __cls_init()
{
CLS_LOG(1, "Loaded rgw class!");
Expand Down Expand Up @@ -3238,14 +3096,6 @@ void __cls_init()
cls_register_cxx_method(h_class, "gc_list", CLS_METHOD_RD, rgw_cls_gc_list, &h_rgw_gc_list);
cls_register_cxx_method(h_class, "gc_remove", CLS_METHOD_RD | CLS_METHOD_WR, rgw_cls_gc_remove, &h_rgw_gc_remove);

/* lifecycle bucket list */
cls_register_cxx_method(h_class, "lc_set_entry", CLS_METHOD_RD | CLS_METHOD_WR, rgw_cls_lc_set_entry, &h_rgw_lc_set_entry);
cls_register_cxx_method(h_class, "lc_rm_entry", CLS_METHOD_RD | CLS_METHOD_WR, rgw_cls_lc_rm_entry, &h_rgw_lc_rm_entry);
cls_register_cxx_method(h_class, "lc_get_entry", CLS_METHOD_RD, rgw_cls_lc_get_entry, &h_rgw_lc_get_entry);
cls_register_cxx_method(h_class, "lc_put_head", CLS_METHOD_RD| CLS_METHOD_WR, rgw_cls_lc_put_head, &h_rgw_lc_put_head);
cls_register_cxx_method(h_class, "lc_get_head", CLS_METHOD_RD, rgw_cls_lc_get_head, &h_rgw_lc_get_head);
cls_register_cxx_method(h_class, "lc_list_entry", CLS_METHOD_RD, rgw_cls_lc_list_entry, &h_rgw_lc_list_entry);

return;
}

90 changes: 0 additions & 90 deletions src/cls/rgw/cls_rgw_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -627,93 +627,3 @@ void cls_rgw_gc_remove(librados::ObjectWriteOperation& op, const list<string>& t
::encode(call, in);
op.exec("rgw", "gc_remove", in);
}

int cls_rgw_lc_get_head(IoCtx& io_ctx, string& oid, cls_rgw_lc_obj_head& head)
{
bufferlist in, out;
int r = io_ctx.exec(oid, "rgw", "lc_get_head", in, out);
if (r < 0)
return r;

cls_rgw_lc_get_head_ret ret;
try {
bufferlist::iterator iter = out.begin();
::decode(ret, iter);
} catch (buffer::error& err) {
return -EIO;
}
head = ret.head;

return r;
}

int cls_rgw_lc_put_head(IoCtx& io_ctx, string& oid, cls_rgw_lc_obj_head& head)
{
bufferlist in, out;
cls_rgw_lc_put_head_op call;
call.head = head;
::encode(call, in);
int r = io_ctx.exec(oid, "rgw", "lc_put_head", in, out);
return r;
}

int cls_rgw_lc_get_entry(IoCtx& io_ctx, string& oid, string& marker, pair<string, int>& entry)
{
bufferlist in, out;
cls_rgw_lc_get_entry_op call;
call.marker = marker;
::encode(call, in);
int r = io_ctx.exec(oid, "rgw", "lc_get_entry", in, out);
if (r < 0)
return r;

cls_rgw_lc_get_entry_ret ret;
try {
bufferlist::iterator iter = out.begin();
::decode(ret, iter);
} catch (buffer::error& err) {
return -EIO;
}
entry = ret.entry;

return r;
}

int cls_rgw_lc_rm_entry(IoCtx& io_ctx, string& oid, pair<string, int>& entry)
{
bufferlist in, out;
cls_rgw_lc_rm_entry_op call;
call.entry = entry;
::encode(call, in);
int r = io_ctx.exec(oid, "rgw", "lc_rm_entry", in, out);
return r;
}

int cls_rgw_lc_set_entry(IoCtx& io_ctx, string& oid, pair<string, int>& entry)
{
bufferlist in, out;
cls_rgw_lc_rm_entry_op call;
call.entry = entry;
::encode(call, in);
int r = io_ctx.exec(oid, "rgw", "lc_set_entry", in, out);
return r;
}

int cls_rgw_lc_list(IoCtx& io_ctx, string& oid, map<string, int>& entries)
{
bufferlist in, out;
int r = io_ctx.exec(oid, "rgw", "lc_list_entry", in, out);
if (r < 0)
return r;

cls_rgw_lc_list_entry_ret ret;
try {
bufferlist::iterator iter = out.begin();
::decode(ret, iter);
} catch (buffer::error& err) {
return -EIO;
}
entries.insert(ret.entries.begin(),ret.entries.end());

return r;
}
13 changes: 0 additions & 13 deletions src/cls/rgw/cls_rgw_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,17 +471,4 @@ int cls_rgw_gc_list(librados::IoCtx& io_ctx, string& oid, string& marker, uint32

void cls_rgw_gc_remove(librados::ObjectWriteOperation& op, const list<string>& tags);

/* lifecycle */
int cls_rgw_lc_get_head(librados::IoCtx& io_ctx, string& oid, cls_rgw_lc_obj_head& head);
int cls_rgw_lc_put_head(librados::IoCtx& io_ctx, string& oid, cls_rgw_lc_obj_head& head);
int cls_rgw_lc_get_entry(librados::IoCtx& io_ctx, string& oid, string& marker, pair<string, int>& entry);
int cls_rgw_lc_rm_entry(librados::IoCtx& io_ctx, string& oid, pair<string, int>& entry);
int cls_rgw_lc_set_entry(librados::IoCtx& io_ctx, string& oid, pair<string, int>& entry);
int cls_rgw_lc_list(librados::IoCtx& io_ctx, string& oid, map<string, int>& entries);






#endif

0 comments on commit 9162bd2

Please sign in to comment.