#include "rgw_torrent.h"
#include "rgw_sal.h"
+#include "rgw_sal_rados.h"
#include "include/str_list.h"
#include "include/rados/librados.hpp"
store = p_store;
}
-int seed::get_torrent_file(RGWRados::Object::Read &read_op,
+int seed::get_torrent_file(rgw::sal::RGWObject* object,
uint64_t &total_len,
ceph::bufferlist &bl_data,
rgw_obj &obj)
const set<string> obj_key{RGW_OBJ_TORRENT};
map<string, bufferlist> m;
- const int r = read_op.state.cur_ioctx->omap_get_vals_by_keys(oid, obj_key, &m);
+ const int r = object->omap_get_vals_by_keys(oid, obj_key, &m);
if (r < 0) {
ldout(s->cct, 0) << "ERROR: omap_get_vals_by_keys failed: " << r << dendl;
return r;
sha1(&h, bl, bl.length());
}
-int seed::complete()
+int seed::complete(optional_yield y)
{
uint64_t remain = info.len%info.piece_length;
uint8_t remain_len = ((remain > 0)? 1 : 0);
do_encode();
/* save torrent data into OMAP */
- ret = save_torrent_file();
+ ret = save_torrent_file(y);
if (0 != ret)
{
ldout(s->cct, 0) << "ERROR: failed to save_torrent_file() ret= "<< ret << dendl;
dencode.bencode_end(bl);
}
-int seed::save_torrent_file()
+int seed::save_torrent_file(optional_yield y)
{
int op_ret = 0;
string key = RGW_OBJ_TORRENT;
- rgw_obj obj(s->bucket, s->object.name);
+ rgw_obj obj(s->bucket->get_key(), s->object->get_name());
rgw_raw_obj raw_obj;
- store->getRados()->obj_to_raw(s->bucket_info.placement_rule, obj, &raw_obj);
+ store->getRados()->obj_to_raw(s->bucket->get_info().placement_rule, obj, &raw_obj);
auto obj_ctx = store->svc()->sysobj->init_obj_ctx();
auto sysobj = obj_ctx.get_obj(raw_obj);
- op_ret = sysobj.omap().set(key, bl, null_yield);
+ op_ret = sysobj.omap().set(key, bl, y);
if (op_ret < 0)
{
ldout(s->cct, 0) << "ERROR: failed to omap_set() op_ret = " << op_ret << dendl;