#include "include/compat.h"
-using std::list;
+using std::vector;
using std::string;
using ceph::bufferlist;
-void cls_log_add(librados::ObjectWriteOperation& op, list<cls_log_entry>& entries, bool monotonic_inc)
+void cls_log_add(librados::ObjectWriteOperation& op, vector<cls_log_entry>& entries, bool monotonic_inc)
{
bufferlist in;
cls_log_add_op call;
}
class LogListCtx : public ObjectOperationCompletion {
- list<cls_log_entry> *entries;
+ vector<cls_log_entry> *entries;
string *marker;
bool *truncated;
public:
- LogListCtx(list<cls_log_entry> *_entries, string *_marker, bool *_truncated) :
+ LogListCtx(vector<cls_log_entry> *_entries, string *_marker, bool *_truncated) :
entries(_entries), marker(_marker), truncated(_truncated) {}
void handle_completion(int r, bufferlist& outbl) override {
if (r >= 0) {
void cls_log_list(librados::ObjectReadOperation& op, const utime_t& from,
const utime_t& to, const string& in_marker, int max_entries,
- list<cls_log_entry>& entries,
+ vector<cls_log_entry>& entries,
string *out_marker, bool *truncated)
{
bufferlist inbl;
void cls_log_add_prepare_entry(cls_log_entry& entry, const utime_t& timestamp,
const std::string& section, const std::string& name, ceph::buffer::list& bl);
-void cls_log_add(librados::ObjectWriteOperation& op, std::list<cls_log_entry>& entries, bool monotonic_inc);
+void cls_log_add(librados::ObjectWriteOperation& op, std::vector<cls_log_entry>& entries, bool monotonic_inc);
void cls_log_add(librados::ObjectWriteOperation& op, cls_log_entry& entry);
void cls_log_add(librados::ObjectWriteOperation& op, const utime_t& timestamp,
const std::string& section, const std::string& name, ceph::buffer::list& bl);
void cls_log_list(librados::ObjectReadOperation& op, const utime_t& from,
const utime_t& to, const std::string& in_marker,
- int max_entries, std::list<cls_log_entry>& entries,
+ int max_entries, std::vector<cls_log_entry>& entries,
std::string *out_marker, bool *truncated);
void cls_log_trim(librados::ObjectWriteOperation& op, const utime_t& from_time, const utime_t& to_time,
#include "cls_log_types.h"
struct cls_log_add_op {
- std::list<cls_log_entry> entries;
+ std::vector<cls_log_entry> entries;
bool monotonic_inc;
cls_log_add_op() : monotonic_inc(true) {}
WRITE_CLASS_ENCODER(cls_log_list_op)
struct cls_log_list_ret {
- std::list<cls_log_entry> entries;
+ std::vector<cls_log_entry> entries;
std::string marker;
bool truncated;
class RGWRadosTimelogAddCR : public RGWSimpleCoroutine {
const DoutPrefixProvider *dpp;
rgw::sal::RadosStore* store;
- std::list<cls_log_entry> entries;
+ std::vector<cls_log_entry> entries;
std::string oid;
}
class RGWDataChangesOmap final : public RGWDataChangesBE {
- using centries = std::list<cls_log_entry>;
+ using centries = std::vector<cls_log_entry>;
std::vector<std::string> oids;
public:
std::optional<std::string_view> marker,
std::string* out_marker, bool* truncated,
optional_yield y) override {
- std::list<cls_log_entry> log_entries;
+ std::vector<cls_log_entry> log_entries;
lr::ObjectReadOperation op;
cls_log_list(op, {}, {}, std::string(marker.value_or("")),
max_entries, log_entries, out_marker, truncated);
}
int is_empty(const DoutPrefixProvider *dpp, optional_yield y) override {
for (auto shard = 0u; shard < oids.size(); ++shard) {
- std::list<cls_log_entry> log_entries;
+ std::vector<cls_log_entry> log_entries;
lr::ObjectReadOperation op;
std::string out_marker;
bool truncated;
return datalog.get_oid(gen_id, shard_id);
}
public:
- using entries = std::variant<std::list<cls_log_entry>,
+ using entries = std::variant<std::vector<cls_log_entry>,
std::vector<ceph::buffer::list>>;
const uint64_t gen_id;
return 0;
}
-int RGWMetadataLog::store_entries_in_shard(const DoutPrefixProvider *dpp, list<cls_log_entry>& entries, int shard_id, librados::AioCompletion *completion)
+int RGWMetadataLog::store_entries_in_shard(const DoutPrefixProvider *dpp, vector<cls_log_entry>& entries, int shard_id, librados::AioCompletion *completion)
{
string oid;
int RGWMetadataLog::list_entries(const DoutPrefixProvider *dpp, void *handle,
int max_entries,
- list<cls_log_entry>& entries,
+ vector<cls_log_entry>& entries,
string *last_marker,
bool *truncated,
optional_yield y) {
s->formatter->dump_bool("truncated", truncated);
{
s->formatter->open_array_section("entries");
- for (list<cls_log_entry>::iterator iter = entries.begin();
+ for (auto iter = entries.begin();
iter != entries.end(); ++iter) {
cls_log_entry& entry = *iter;
static_cast<rgw::sal::RadosStore*>(driver)->ctl()->meta.mgr->dump_log_entry(entry, s->formatter);
};
class RGWOp_MDLog_List : public RGWRESTOp {
- std::list<cls_log_entry> entries;
+ std::vector<cls_log_entry> entries;
std::string last_marker;
bool truncated;
public:
}
public:
string marker;
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
bool truncated;
RGWAsyncReadMDLogEntries(const DoutPrefixProvider *dpp, RGWCoroutine *caller, RGWAioCompletionNotifier *cn, rgw::sal::RadosStore* _store,
string marker;
string *pmarker;
int max_entries;
- list<cls_log_entry> *entries;
+ vector<cls_log_entry> *entries;
bool *truncated;
RGWAsyncReadMDLogEntries *req{nullptr};
public:
RGWReadMDLogEntriesCR(RGWMetaSyncEnv *_sync_env, RGWMetadataLog* mdlog,
int _shard_id, string*_marker, int _max_entries,
- list<cls_log_entry> *_entries, bool *_truncated)
+ vector<cls_log_entry> *_entries, bool *_truncated)
: RGWSimpleCoroutine(_sync_env->cct), sync_env(_sync_env), mdlog(mdlog),
shard_id(_shard_id), pmarker(_marker), max_entries(_max_entries),
entries(_entries), truncated(_truncated) {}
RGWMetaSyncShardMarkerTrack *marker_tracker = nullptr;
- list<cls_log_entry> log_entries;
- list<cls_log_entry>::iterator log_iter;
+ vector<cls_log_entry> log_entries;
+ decltype(log_entries)::iterator log_iter;
bool truncated = false;
string mdlog_marker;
int RGWCloneMetaLogCoroutine::state_store_mdlog_entries()
{
- list<cls_log_entry> dest_entries;
+ vector<cls_log_entry> dest_entries;
vector<rgw_mdlog_entry>::iterator iter;
for (iter = data.entries.begin(); iter != data.entries.end(); ++iter) {
formatter->open_array_section("entries");
for (; i < g_ceph_context->_conf->rgw_md_log_max_shards; i++) {
void *handle;
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
meta_log->init_list_entries(i, {}, {}, marker, &handle);
bool truncated;
return -ret;
}
- for (list<cls_log_entry>::iterator iter = entries.begin(); iter != entries.end(); ++iter) {
+ for (auto iter = entries.begin(); iter != entries.end(); ++iter) {
cls_log_entry& entry = *iter;
static_cast<rgw::sal::RadosStore*>(driver)->ctl()->meta.mgr->dump_log_entry(entry, formatter.get());
}
string oid = RGWSyncErrorLogger::get_shard_oid(RGW_SYNC_ERROR_LOG_SHARD_PREFIX, shard_id);
do {
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
ret = static_cast<rgw::sal::RadosStore*>(driver)->svc()->cls->timelog.list(dpp(), oid, {}, {}, max_entries - count, entries, marker, &marker, &truncated,
null_yield);
if (ret == -ENOENT) {
formatter->open_array_section("entries");
for (; i < g_ceph_context->_conf->rgw_data_log_num_shards; i++) {
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
RGWDataChangesLogInfo info;
static_cast<rgw::sal::RadosStore*>(driver)->svc()->
int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl, optional_yield y);
int get_shard_id(const std::string& hash_key, int *shard_id);
- int store_entries_in_shard(const DoutPrefixProvider *dpp, std::list<cls_log_entry>& entries, int shard_id, librados::AioCompletion *completion);
+ int store_entries_in_shard(const DoutPrefixProvider *dpp, std::vector<cls_log_entry>& entries, int shard_id, librados::AioCompletion *completion);
struct LogListCtx {
int cur_shard;
int list_entries(const DoutPrefixProvider *dpp,
void *handle,
int max_entries,
- std::list<cls_log_entry>& entries,
+ std::vector<cls_log_entry>& entries,
std::string *out_marker,
bool *truncated,
optional_yield y);
return obj.operate(dpp, &op, y);
}
-int RGWSI_Cls::TimeLog::add(const DoutPrefixProvider *dpp,
+int RGWSI_Cls::TimeLog::add(const DoutPrefixProvider *dpp,
const string& oid,
- std::list<cls_log_entry>& entries,
+ std::vector<cls_log_entry>& entries,
librados::AioCompletion *completion,
bool monotonic_inc,
optional_yield y)
const string& oid,
const real_time& start_time,
const real_time& end_time,
- int max_entries, std::list<cls_log_entry>& entries,
+ int max_entries, std::vector<cls_log_entry>& entries,
const string& marker,
string *out_marker,
bool *truncated,
optional_yield y);
int add(const DoutPrefixProvider *dpp,
const std::string& oid,
- std::list<cls_log_entry>& entries,
+ std::vector<cls_log_entry>& entries,
librados::AioCompletion *completion,
bool monotonic_inc,
optional_yield y);
const std::string& oid,
const real_time& start_time,
const real_time& end_time,
- int max_entries, std::list<cls_log_entry>& entries,
+ int max_entries, std::vector<cls_log_entry>& entries,
const std::string& marker,
std::string *out_marker,
bool *truncated,
static int log_list(librados::IoCtx& ioctx, const std::string& oid,
utime_t& from, utime_t& to,
const string& in_marker, int max_entries,
- list<cls_log_entry>& entries,
+ vector<cls_log_entry>& entries,
string *out_marker, bool *truncated)
{
librados::ObjectReadOperation rop;
static int log_list(librados::IoCtx& ioctx, const std::string& oid,
utime_t& from, utime_t& to, int max_entries,
- list<cls_log_entry>& entries, bool *truncated)
+ vector<cls_log_entry>& entries, bool *truncated)
{
std::string marker;
return log_list(ioctx, oid, from, to, marker, max_entries,
}
static int log_list(librados::IoCtx& ioctx, const std::string& oid,
- list<cls_log_entry>& entries)
+ vector<cls_log_entry>& entries)
{
utime_t from, to;
bool truncated{false};
utime_t to_time = get_time(start_time, 1, true);
generate_log(ioctx, oid, 10, start_time, false);
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
bool truncated;
/* check list */
ASSERT_EQ(10, (int)entries.size());
ASSERT_EQ(0, (int)truncated);
}
- list<cls_log_entry>::iterator iter;
+ vector<cls_log_entry>::iterator iter;
/* need to sort returned entries, all were using the same time as key */
map<int, cls_log_entry> check_ents;
utime_t start_time = ceph_clock_now();
generate_log(ioctx, oid, 10, start_time, true);
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
bool truncated;
utime_t to_time = utime_t(start_time.sec() + 10, start_time.nsec());
ASSERT_EQ(0, (int)truncated);
}
- list<cls_log_entry>::iterator iter;
+ vector<cls_log_entry>::iterator iter;
/* returned entries should be sorted by time */
map<int, cls_log_entry> check_ents;
utime_t start_time = ceph_clock_now();
generate_log(ioctx, oid, 10, start_time, true);
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
bool truncated;
/* check list */
utime_t zero_time;
std::vector<cls_log_entry> log1;
{
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
ASSERT_EQ(0, log_list(ioctx, oid, entries));
ASSERT_EQ(10u, entries.size());
const std::string from = "";
const std::string to = log1[0].id;
ASSERT_EQ(0, do_log_trim(ioctx, oid, from, to));
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
ASSERT_EQ(0, log_list(ioctx, oid, entries));
ASSERT_EQ(9u, entries.size());
EXPECT_EQ(log1[1].id, entries.begin()->id);
const std::string from = log1[8].id;
const std::string to = "9";
ASSERT_EQ(0, do_log_trim(ioctx, oid, from, to));
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
ASSERT_EQ(0, log_list(ioctx, oid, entries));
ASSERT_EQ(8u, entries.size());
EXPECT_EQ(log1[8].id, entries.rbegin()->id);
const std::string from = log1[3].id;
const std::string to = log1[4].id;
ASSERT_EQ(0, do_log_trim(ioctx, oid, from, to));
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
ASSERT_EQ(0, log_list(ioctx, oid, entries));
ASSERT_EQ(7u, entries.size());
ASSERT_EQ(-ENODATA, do_log_trim(ioctx, oid, from, to));
const std::string from = "";
const std::string to = "9";
ASSERT_EQ(0, do_log_trim(ioctx, oid, from, to));
- list<cls_log_entry> entries;
+ vector<cls_log_entry> entries;
ASSERT_EQ(0, log_list(ioctx, oid, entries));
ASSERT_EQ(0u, entries.size());
ASSERT_EQ(-ENODATA, do_log_trim(ioctx, oid, from, to));
std::string to_marker;
{
lr::ObjectReadOperation op;
- std::list<cls_log_entry> entries;
+ std::vector<cls_log_entry> entries;
bool truncated = false;
cls_log_list(op, {}, {}, {}, 1, entries, &to_marker, &truncated);
auto r = rgw_rados_operate(&dp, ioctx, oid, &op, nullptr, null_yield);
}
{
lr::ObjectReadOperation op;
- std::list<cls_log_entry> entries;
+ std::vector<cls_log_entry> entries;
bool truncated = false;
cls_log_list(op, {}, {}, {}, 1, entries, &to_marker, &truncated);
auto r = rgw_rados_operate(&dp, ioctx, oid, &op, nullptr, null_yield);