auto& pool = store->get_zone_params().log_pool;
const auto& oid = RGWMetadataLogHistory::oid;
- return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
+ return rgw_put_system_obj(store, pool, oid, bl,
exclusive, objv_tracker, real_time{});
}
otracker.write_version = objv_tracker->write_version;
string oid = heap_oid(handler, key, objv_tracker->write_version);
int ret = rgw_put_system_obj(store, heap_pool, oid,
- bl.c_str(), bl.length(), false,
- &otracker, mtime, pattrs);
+ bl, false, &otracker, mtime, pattrs);
if (ret < 0) {
ldout(store->ctx(), 0) << "ERROR: rgw_put_system_obj() oid=" << oid << " returned ret=" << ret << dendl;
return ret;
goto done;
}
- ret = rgw_put_system_obj(store, pool, oid,
- bl.c_str(), bl.length(), exclusive,
+ ret = rgw_put_system_obj(store, pool, oid, bl, exclusive,
objv_tracker, mtime, pattrs);
if (ret < 0) {
encode(default_info, bl);
- int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
+ int ret = rgw_put_system_obj(store, pool, oid, bl,
exclusive, NULL, real_time(), NULL);
if (ret < 0)
return ret;
bufferlist bl;
using ceph::encode;
encode(nameToId, bl);
- return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), exclusive, NULL, real_time(), NULL);
+ return rgw_put_system_obj(store, pool, oid, bl, exclusive, NULL, real_time(), NULL);
}
int RGWSystemMetaObj::rename(const string& new_name)
bufferlist bl;
using ceph::encode;
encode(*this, bl);
- return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), exclusive, NULL, real_time(), NULL);
+ return rgw_put_system_obj(store, pool, oid, bl, exclusive, NULL, real_time(), NULL);
}
int RGWSystemMetaObj::write(bool exclusive)
{
auto pool = rgw_pool{get_pool(cct)};
auto oid = get_control_oid();
- return rgw_put_system_obj(store, pool, oid, nullptr, 0, exclusive,
+ bufferlist bl;
+ return rgw_put_system_obj(store, pool, oid, bl, exclusive,
nullptr, real_time(), nullptr);
}
bufferlist bl;
using ceph::encode;
encode(*this, bl);
- return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
+ return rgw_put_system_obj(store, pool, oid, bl,
false, nullptr, real_time(), nullptr);
}
using ceph::encode;
encode(info, bl);
- return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
+ return rgw_put_system_obj(store, pool, oid, bl,
exclusive, objv, real_time(), nullptr);
}
using ceph::encode;
encode(*this, bl);
- return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(),
+ return rgw_put_system_obj(store, pool, oid, bl,
exclusive, NULL, real_time(), NULL);
}
}
/* mark as converted */
- ret = rgw_put_system_obj(this, pool, oid, bl.c_str(), bl.length(),
+ ret = rgw_put_system_obj(this, pool, oid, bl,
true, NULL, real_time(), NULL);
if (ret < 0 ) {
ldout(cct, 0) << __func__ << " failed to mark cluster as converted: ret "<< ret << " " << cpp_strerror(-ret)
int aio_put_obj_data(void *ctx, rgw_raw_obj& obj, bufferlist& bl,
off_t ofs, bool exclusive, void **handle);
- int put_system_obj(void *ctx, rgw_raw_obj& obj, const char *data, size_t len, bool exclusive,
+ int put_system_obj(void *ctx, rgw_raw_obj& obj, bufferlist& data, bool exclusive,
ceph::real_time *mtime, map<std::string, bufferlist>& attrs, RGWObjVersionTracker *objv_tracker,
ceph::real_time set_mtime) {
- bufferlist bl;
- bl.append(data, len);
int flags = PUT_OBJ_CREATE;
if (exclusive)
flags |= PUT_OBJ_EXCL;
- return put_system_obj_impl(obj, len, mtime, attrs, flags, bl, objv_tracker, set_mtime);
+ return put_system_obj_impl(obj, data.length(), mtime, attrs, flags, data, objv_tracker, set_mtime);
}
int aio_wait(void *handle);
bool aio_completed(void *handle);
bufferlist bl;
encode(*this, bl);
return rgw_put_system_obj(store, store->get_zone_params().roles_pool, oid,
- bl.c_str(), bl.length(), exclusive, NULL, real_time(), NULL);
+ bl, exclusive, NULL, real_time(), NULL);
}
int RGWRole::store_name(bool exclusive)
using ceph::encode;
encode(nameToId, bl);
return rgw_put_system_obj(store, store->get_zone_params().roles_pool, oid,
- bl.c_str(), bl.length(), exclusive, NULL, real_time(), NULL);
+ bl, exclusive, NULL, real_time(), NULL);
}
int RGWRole::store_path(bool exclusive)
{
string oid = tenant + get_path_oid_prefix() + path + get_info_oid_prefix() + id;
+ bufferlist bl;
return rgw_put_system_obj(store, store->get_zone_params().roles_pool, oid,
- NULL, 0, exclusive, NULL, real_time(), NULL);
+ bl, exclusive, NULL, real_time(), NULL);
}
int RGWRole::create(bool exclusive)
static std::map<std::string, std::string>* ext_mime_map;
-int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, const char *data, size_t size, bool exclusive,
+int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive,
RGWObjVersionTracker *objv_tracker, real_time set_mtime, map<string, bufferlist> *pattrs)
{
map<string,bufferlist> no_attrs;
rgw_raw_obj obj(pool, oid);
- int ret = rgwstore->put_system_obj(NULL, obj, data, size, exclusive, NULL, *pattrs, objv_tracker, set_mtime);
+ int ret = rgwstore->put_system_obj(NULL, obj, data, exclusive, NULL, *pattrs, objv_tracker, set_mtime);
if (ret == -ENOENT) {
ret = rgwstore->create_pool(pool);
if (ret >= 0)
- ret = rgwstore->put_system_obj(NULL, obj, data, size, exclusive, NULL, *pattrs, objv_tracker, set_mtime);
+ ret = rgwstore->put_system_obj(NULL, obj, data, exclusive, NULL, *pattrs, objv_tracker, set_mtime);
}
return ret;
struct obj_version;
-int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, const char *data, size_t size, bool exclusive,
+int rgw_put_system_obj(RGWRados *rgwstore, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive,
RGWObjVersionTracker *objv_tracker, real_time set_mtime, map<string, bufferlist> *pattrs = NULL);
int rgw_get_system_obj(RGWRados *rgwstore, RGWObjectCtx& obj_ctx, const rgw_pool& pool, const string& key, bufferlist& bl,
RGWObjVersionTracker *objv_tracker, real_time *pmtime, map<string, bufferlist> *pattrs = NULL,
if (!old_info ||
old_info->user_email.compare(info.user_email) != 0) { /* only if new index changed */
ret = rgw_put_system_obj(store, store->get_zone_params().user_email_pool, info.user_email,
- link_bl.c_str(), link_bl.length(), exclusive, NULL, real_time());
+ link_bl, exclusive, NULL, real_time());
if (ret < 0)
return ret;
}
continue;
ret = rgw_put_system_obj(store, store->get_zone_params().user_keys_pool, k.id,
- link_bl.c_str(), link_bl.length(), exclusive,
- NULL, real_time());
+ link_bl, exclusive, NULL, real_time());
if (ret < 0)
return ret;
}
continue;
ret = rgw_put_system_obj(store, store->get_zone_params().user_swift_pool, k.id,
- link_bl.c_str(), link_bl.length(), exclusive,
- NULL, real_time());
+ link_bl, exclusive, NULL, real_time());
if (ret < 0)
return ret;
}