From eb0eef8d8656f01c0ceaf7881c029917ef58e87c Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Mon, 16 Aug 2021 11:28:28 +0000 Subject: [PATCH] key_value_store: fix missing std following PR #42742 Signed-off-by: Ronen Friedman --- src/key_value_store/kv_flat_btree_async.cc | 138 +++++++++++---------- src/key_value_store/kv_flat_btree_async.h | 138 ++++++++++----------- 2 files changed, 140 insertions(+), 136 deletions(-) diff --git a/src/key_value_store/kv_flat_btree_async.cc b/src/key_value_store/kv_flat_btree_async.cc index d84239409e3..6c2fd0ef796 100644 --- a/src/key_value_store/kv_flat_btree_async.cc +++ b/src/key_value_store/kv_flat_btree_async.cc @@ -31,6 +31,10 @@ #include using ceph::bufferlist; +using std::cout; +using std::vector; +using std::cerr; +using std::stringstream; bool index_data::is_timed_out(utime_t now, utime_t timeout) const { return prefix != "" && now - ts > timeout; @@ -46,20 +50,20 @@ void IndexCache::push(const string &key, const index_data &idata) { return; } index_data old_idata; - map >::iterator old_it = + std::map >::iterator old_it = k2itmap.lower_bound(key_data(key)); if (old_it != k2itmap.end()) { t2kmap.erase(old_it->second.second); k2itmap.erase(old_it); } - map >::iterator new_it = + std::map >::iterator new_it = k2itmap.find(idata.kdata); if (new_it != k2itmap.end()) { utime_t old_time = new_it->second.second; t2kmap.erase(old_time); } utime_t time = ceph_clock_now(); - k2itmap[idata.kdata] = make_pair(idata, time); + k2itmap[idata.kdata] = std::make_pair(idata, time); t2kmap[time] = idata.kdata; if ((int)k2itmap.size() > cache_size) { pop(); @@ -77,7 +81,7 @@ void IndexCache::push(const index_data &idata) { k2itmap.erase(idata.kdata); } utime_t time = ceph_clock_now(); - k2itmap[idata.kdata] = make_pair(idata, time); + k2itmap[idata.kdata] = std::make_pair(idata, time); t2kmap[time] = idata.kdata; if ((int)k2itmap.size() > cache_size) { pop(); @@ -88,7 +92,7 @@ void IndexCache::pop() { if (cache_size == 0) { return; } - map::iterator it = t2kmap.begin(); + std::map::iterator it = t2kmap.begin(); utime_t time = it->first; key_data kdata = it->second; k2itmap.erase(kdata); @@ -113,7 +117,7 @@ int IndexCache::get(const string &key, index_data *idata) const { if ((int)k2itmap.size() == 0) { return -ENODATA; } - map >::const_iterator it = + std::map >::const_iterator it = k2itmap.lower_bound(key_data(key)); if (it == k2itmap.end() || !(it->second.first.min_kdata < key_data(key))) { return -ENODATA; @@ -128,7 +132,7 @@ int IndexCache::get(const string &key, index_data *idata, if (cache_size == 0) { return -ENODATA; } - map >::const_iterator it = + std::map >::const_iterator it = k2itmap.lower_bound(key_data(key)); if (it == k2itmap.end() || ++it == k2itmap.end()) { return -ENODATA; @@ -361,7 +365,7 @@ int KvFlatBtreeAsync::split(const index_data &idata) { args.odata.max_kdata, args.odata.name, args.odata.version)); //for lower half object - map::const_iterator it = args.odata.omap.begin(); + std::map::const_iterator it = args.odata.omap.begin(); client_index_lock.lock(); to_create.push_back(object_data(to_string(client_name, client_index++))); client_index_lock.unlock(); @@ -384,14 +388,14 @@ int KvFlatBtreeAsync::split(const index_data &idata) { //setting up operations librados::ObjectWriteOperation owos[6]; - vector, librados::ObjectWriteOperation*> > ops; + vector, librados::ObjectWriteOperation*> > ops; index_data out_data; set_up_prefix_index(to_create, to_delete, &owos[0], &out_data, &err); - ops.push_back(make_pair( - pair(ADD_PREFIX, index_name), + ops.push_back(std::make_pair( + std::pair(ADD_PREFIX, index_name), &owos[0])); for (int i = 1; i < 6; i++) { - ops.push_back(make_pair(make_pair(0,""), &owos[i])); + ops.push_back(std::make_pair(std::make_pair(0,""), &owos[i])); } set_up_ops(to_create, to_delete, &ops, out_data, &err); @@ -539,9 +543,9 @@ int KvFlatBtreeAsync::rebalance(const index_data &idata1, vector to_delete; librados::ObjectWriteOperation create[2];//possibly only 1 will be used librados::ObjectWriteOperation other_ops[6]; - vector, librados::ObjectWriteOperation*> > ops; - ops.push_back(make_pair( - pair(ADD_PREFIX, index_name), + vector, librados::ObjectWriteOperation*> > ops; + ops.push_back(std::make_pair( + std::pair(ADD_PREFIX, index_name), &other_ops[0])); if ((int)args1.odata.size + (int)args2.odata.size <= 2*k) { @@ -550,13 +554,13 @@ int KvFlatBtreeAsync::rebalance(const index_data &idata1, << args1.odata.name << " and " << args2.odata.name << " to get " << o2w << std::endl; - map write2_map; + std::map write2_map; write2_map.insert(args1.odata.omap.begin(), args1.odata.omap.end()); write2_map.insert(args2.odata.omap.begin(), args2.odata.omap.end()); to_create.push_back(object_data(args1.odata.min_kdata, args2.odata.max_kdata, o2w, write2_map)); - ops.push_back(make_pair( - pair(MAKE_OBJECT, o2w), + ops.push_back(std::make_pair( + std::pair(MAKE_OBJECT, o2w), &create[0])); ceph_assert((int)write2_map.size() <= 2*k); } else { @@ -564,9 +568,9 @@ int KvFlatBtreeAsync::rebalance(const index_data &idata1, if (verbose) cout << "\t\t" << client_name << "-rebalance: rebalancing " << args1.odata.name << " and " << args2.odata.name << std::endl; - map write1_map; - map write2_map; - map::iterator it; + std::map write1_map; + std::map write2_map; + std::map::iterator it; client_index_lock.lock(); string o1w = to_string(client_name, client_index++); client_index_lock.unlock(); @@ -589,7 +593,7 @@ int KvFlatBtreeAsync::rebalance(const index_data &idata1, write2_map.insert(args2.odata.omap.begin(), args2.odata.omap.end()); } else { //args1.odata.omap was small, and write2_map still needs more - map::iterator it2; + std::map::iterator it2; for(it2 = args2.odata.omap.begin(); (it2 != args2.odata.omap.end()) && ((int)write1_map.size() < target_size_1); @@ -608,11 +612,11 @@ int KvFlatBtreeAsync::rebalance(const index_data &idata1, o1w,write1_map)); to_create.push_back(object_data( key_data(write1_map.rbegin()->first), args2.odata.max_kdata, o2w, write2_map)); - ops.push_back(make_pair( - pair(MAKE_OBJECT, o1w), + ops.push_back(std::make_pair( + std::pair(MAKE_OBJECT, o1w), &create[0])); - ops.push_back(make_pair( - pair(MAKE_OBJECT, o2w), + ops.push_back(std::make_pair( + std::pair(MAKE_OBJECT, o2w), &create[1])); } @@ -621,7 +625,7 @@ int KvFlatBtreeAsync::rebalance(const index_data &idata1, to_delete.push_back(object_data(args2.odata.min_kdata, args2.odata.max_kdata, args2.odata.name, args2.odata.version)); for (int i = 1; i < 6; i++) { - ops.push_back(make_pair(make_pair(0,""), &other_ops[i])); + ops.push_back(std::make_pair(std::make_pair(0,""), &other_ops[i])); } index_data out_data; @@ -703,8 +707,8 @@ void KvFlatBtreeAsync::set_up_prefix_index( librados::ObjectWriteOperation * owo, index_data * idata, int * err) { - std::map > assertions; - map to_insert; + std::map > assertions; + std::map to_insert; idata->prefix = "1"; idata->ts = ceph_clock_now(); for(vector::const_iterator it = to_create.begin(); @@ -732,7 +736,7 @@ void KvFlatBtreeAsync::set_up_prefix_index( this_entry.min_kdata = idata->min_kdata; this_entry.kdata = idata->kdata; this_entry.obj = idata->obj; - assertions[it->max_kdata.encoded()] = pair + assertions[it->max_kdata.encoded()] = std::pair (to_bl(this_entry), CEPH_OSD_CMPXATTR_OP_EQ); if (verbose) cout << "\t\t\t" << client_name << "-setup_prefix: will assert " @@ -749,20 +753,20 @@ void KvFlatBtreeAsync::set_up_prefix_index( void KvFlatBtreeAsync::set_up_ops( const vector &create_vector, const vector &delete_vector, - vector, librados::ObjectWriteOperation*> > * ops, + vector, librados::ObjectWriteOperation*> > * ops, const index_data &idata, int * err) { - vector, + vector, librados::ObjectWriteOperation* > >::iterator it; //skip the prefixing part for(it = ops->begin(); it->first.first == ADD_PREFIX; ++it) {} - map to_insert; + std::map to_insert; std::set to_remove; - map > assertions; + std::map > assertions; if (create_vector.size() > 0) { for (int i = 0; i < (int)idata.to_delete.size(); ++i) { - it->first = pair(UNWRITE_OBJECT, idata.to_delete[i].obj); + it->first = std::pair(UNWRITE_OBJECT, idata.to_delete[i].obj); set_up_unwrite_object(delete_vector[i].version, it->second); ++it; } @@ -772,9 +776,9 @@ void KvFlatBtreeAsync::set_up_ops( idata.to_create[i].obj); to_insert[idata.to_create[i].max.encoded()] = to_bl(this_entry); if (idata.to_create.size() <= 2) { - it->first = pair(MAKE_OBJECT, idata.to_create[i].obj); + it->first = std::pair(MAKE_OBJECT, idata.to_create[i].obj); } else { - it->first = pair(AIO_MAKE_OBJECT, idata.to_create[i].obj); + it->first = std::pair(AIO_MAKE_OBJECT, idata.to_create[i].obj); } set_up_make_object(create_vector[i].omap, it->second); ++it; @@ -786,10 +790,10 @@ void KvFlatBtreeAsync::set_up_ops( this_entry.kdata = idata.to_delete[i].max; if (verbose) cout << "\t\t\t" << client_name << "-setup_ops: will assert " << this_entry.str() << std::endl; - assertions[idata.to_delete[i].max.encoded()] = pair( + assertions[idata.to_delete[i].max.encoded()] = std::pair( to_bl(this_entry), CEPH_OSD_CMPXATTR_OP_EQ); to_remove.insert(idata.to_delete[i].max.encoded()); - it->first = pair(REMOVE_OBJECT, idata.to_delete[i].obj); + it->first = std::pair(REMOVE_OBJECT, idata.to_delete[i].obj); set_up_delete_object(it->second); ++it; } @@ -800,11 +804,11 @@ void KvFlatBtreeAsync::set_up_ops( it->second->omap_set(to_insert); - it->first = pair(REMOVE_PREFIX, index_name); + it->first = std::pair(REMOVE_PREFIX, index_name); } void KvFlatBtreeAsync::set_up_make_object( - const map &to_set, + const std::map &to_set, librados::ObjectWriteOperation *owo) { bufferlist inbl; encode(to_set, inbl); @@ -834,11 +838,11 @@ void KvFlatBtreeAsync::set_up_delete_object( int KvFlatBtreeAsync::perform_ops(const string &debug_prefix, const index_data &idata, - vector, librados::ObjectWriteOperation*> > *ops) { + vector, librados::ObjectWriteOperation*> > *ops) { int err = 0; vector aiocs(idata.to_create.size()); int count = 0; - for (vector, + for (vector, librados::ObjectWriteOperation*> >::iterator it = ops->begin(); it != ops->end(); ++it) { if ((((KeyValueStructure *)this)->*KvFlatBtreeAsync::interrupt)() == 1 ) { @@ -994,8 +998,8 @@ int KvFlatBtreeAsync::cleanup(const index_data &idata, const int &error) { << std::endl; int err = 0; ceph_assert(idata.prefix != ""); - map new_index; - map > assertions; + std::map new_index; + std::map > assertions; switch (error) { case -EFIRSTOBJ: { //this happens if the split or rebalance failed to mark the first object, @@ -1017,7 +1021,7 @@ int KvFlatBtreeAsync::cleanup(const index_data &idata, const int &error) { << "-cleanup: will assert index contains " << this_entry.str() << std::endl; assertions[it->max.encoded()] = - pair(to_bl(this_entry), + std::pair(to_bl(this_entry), CEPH_OSD_CMPXATTR_OP_EQ); } @@ -1063,7 +1067,7 @@ int KvFlatBtreeAsync::cleanup(const index_data &idata, const int &error) { << "-cleanup: will assert index contains " << this_entry.str() << std::endl; assertions[it->max.encoded()] = - pair(to_bl(this_entry), + std::pair(to_bl(this_entry), CEPH_OSD_CMPXATTR_OP_EQ); } it = idata.to_delete.begin(); @@ -1114,10 +1118,10 @@ int KvFlatBtreeAsync::cleanup(const index_data &idata, const int &error) { << std::endl; //all changes were created except for updating the index and possibly //deleting the objects. roll forward. - vector, librados::ObjectWriteOperation*> > ops; + vector, librados::ObjectWriteOperation*> > ops; vector owos(idata.to_delete.size() + 1); for (int i = 0; i <= (int)idata.to_delete.size(); ++i) { - ops.push_back(make_pair(pair(0, ""), &owos[i])); + ops.push_back(std::make_pair(std::pair(0, ""), &owos[i])); } set_up_ops(vector(), vector(), &ops, idata, &err); @@ -1139,9 +1143,9 @@ int KvFlatBtreeAsync::cleanup(const index_data &idata, const int &error) { //roll back all changes. if (verbose) cout << "\t\t" << client_name << "-cleanup: rolling back" << std::endl; - map new_index; - std::set to_remove; - map > assertions; + std::map new_index; + std::set to_remove; + std::map > assertions; //mark the objects to be created. if someone else already has, die. for(vector::const_reverse_iterator it = @@ -1185,7 +1189,7 @@ int KvFlatBtreeAsync::cleanup(const index_data &idata, const int &error) { << "-cleanup: will assert index contains " << this_entry.str() << std::endl; assertions[it->max.encoded()] = - pair(to_bl(this_entry), + std::pair(to_bl(this_entry), CEPH_OSD_CMPXATTR_OP_EQ); librados::ObjectWriteOperation restore; set_up_restore_object(&restore); @@ -1344,7 +1348,7 @@ int KvFlatBtreeAsync::setup(int argc, const char** argv) { librados::ObjectWriteOperation make_index; make_index.create(true); - map index_map; + std::map index_map; index_data idata; idata.obj = client_name; idata.min_kdata.raw_key = ""; @@ -1691,7 +1695,7 @@ int KvFlatBtreeAsync::get_op(const string &key, bufferlist *val, int err = 0; std::set key_set; key_set.insert(key); - map omap; + std::map omap; librados::ObjectReadOperation read; read.omap_get_vals_by_keys(key_set, &omap, &err); err = io_ctx.operate(idata.obj, &read, NULL); @@ -1803,13 +1807,13 @@ void KvFlatBtreeAsync::aio_get(const string &key, bufferlist *val, pthread_detach(t); } -int KvFlatBtreeAsync::set_many(const map &in_map) { +int KvFlatBtreeAsync::set_many(const std::map &in_map) { int err = 0; bufferlist inbl; bufferlist outbl; std::set keys; - map big_map; + std::map big_map; for (map::const_iterator it = in_map.begin(); it != in_map.end(); ++it) { keys.insert(it->first); @@ -1829,7 +1833,7 @@ int KvFlatBtreeAsync::set_many(const map &in_map) { return err; } - map imap;//read from the index + std::map imap;//read from the index auto blit = outbl.cbegin(); decode(imap, blit); @@ -1885,7 +1889,7 @@ int KvFlatBtreeAsync::set_many(const map &in_map) { vector owos(2 + 2 * to_delete.size() + to_create.size()); - vector, librados::ObjectWriteOperation*> > ops; + vector, librados::ObjectWriteOperation*> > ops; index_data idata; @@ -1894,12 +1898,12 @@ int KvFlatBtreeAsync::set_many(const map &in_map) { if (verbose) cout << "finished making to_create and to_delete. " << std::endl; - ops.push_back(make_pair( - pair(ADD_PREFIX, index_name), + ops.push_back(std::make_pair( + std::pair(ADD_PREFIX, index_name), &owos[0])); for (int i = 1; i < 2 + 2 * (int)to_delete.size() + (int)to_create.size(); i++) { - ops.push_back(make_pair(make_pair(0,""), &owos[i])); + ops.push_back(std::make_pair(std::make_pair(0,""), &owos[i])); } set_up_ops(to_create, to_delete, &ops, idata, &err); @@ -1947,7 +1951,7 @@ int KvFlatBtreeAsync::remove_all() { librados::ObjectWriteOperation rm_index; librados::AioCompletion * rm_index_aioc = rados.aio_create_completion(); - map new_index; + std::map new_index; new_index["1"] = index_set["1"]; rm_index.omap_clear(); rm_index.omap_set(new_index); @@ -2007,7 +2011,7 @@ int KvFlatBtreeAsync::get_all_keys(std::set *keys) { } int KvFlatBtreeAsync::get_all_keys_and_values( - map *kv_map) { + std::map *kv_map) { if (verbose) cout << client_name << ": getting all keys and values" << std::endl; int err = 0; @@ -2022,7 +2026,7 @@ int KvFlatBtreeAsync::get_all_keys_and_values( for (std::set::iterator it = index_set.begin(); it != index_set.end(); ++it){ librados::ObjectReadOperation sub; - map ret; + std::map ret; sub.omap_get_vals2("",LONG_MAX,&ret, nullptr, &err); io_ctx.operate(*it, &sub, NULL); kv_map->insert(ret.begin(), ret.end()); @@ -2035,7 +2039,7 @@ bool KvFlatBtreeAsync::is_consistent() { bool ret = true; if (verbose) cout << client_name << ": checking consistency" << std::endl; std::map index; - map > sub_objs; + std::map > sub_objs; librados::ObjectReadOperation oro; oro.omap_get_vals2("",LONG_MAX,&index, nullptr, &err); io_ctx.operate(index_name, &oro, NULL); @@ -2098,7 +2102,7 @@ bool KvFlatBtreeAsync::is_consistent() { special_names.insert(cit->obj); } } - parsed_index.insert(make_pair(it->first, idata.obj)); + parsed_index.insert(std::make_pair(it->first, idata.obj)); onames.insert(idata.obj); } } diff --git a/src/key_value_store/kv_flat_btree_async.h b/src/key_value_store/kv_flat_btree_async.h index 3f1a96b3c71..7ba0ada6f52 100644 --- a/src/key_value_store/kv_flat_btree_async.h +++ b/src/key_value_store/kv_flat_btree_async.h @@ -34,6 +34,7 @@ using ceph::bufferlist; + enum { ADD_PREFIX = 1, MAKE_OBJECT = 2, @@ -46,7 +47,6 @@ enum { struct rebalance_args; - /** * stores information about a key in the index. * @@ -54,8 +54,8 @@ struct rebalance_args; * the object with key "" will always be the highest key in the index. */ struct key_data { - string raw_key; - string prefix; + std::string raw_key; + std::string prefix; key_data() {} @@ -63,7 +63,7 @@ struct key_data { /** * @pre: key is a raw key (does not contain a prefix) */ - key_data(string key) + key_data(std::string key) : raw_key(key) { raw_key == "" ? prefix = "1" : prefix = "0"; @@ -90,7 +90,7 @@ struct key_data { * * @pre: encoded has a prefix */ - void parse(string encoded) { + void parse(std::string encoded) { prefix = encoded[0]; raw_key = encoded.substr(1,encoded.length()); } @@ -98,7 +98,7 @@ struct key_data { /** * returns a string containing the encoded (prefixed) key */ - string encoded() const { + std::string encoded() const { return prefix + raw_key; } @@ -124,8 +124,8 @@ WRITE_CLASS_ENCODER(key_data) struct object_data { key_data min_kdata; //the max key from the previous index entry key_data max_kdata; //the max key, from the index - string name; //the object's name - map omap; // the omap of the object + std::string name; //the object's name + std::map omap; // the omap of the object bool unwritable; // an xattr that, if false, means an op is in // progress and other clients should not write to it. uint64_t version; //the version at time of read @@ -137,14 +137,14 @@ struct object_data { size(0) {} - object_data(string the_name) + object_data(std::string the_name) : name(the_name), unwritable(false), version(0), size(0) {} - object_data(key_data min, key_data kdat, string the_name) + object_data(key_data min, key_data kdat, std::string the_name) : min_kdata(min), max_kdata(kdat), name(the_name), @@ -153,8 +153,8 @@ struct object_data { size(0) {} - object_data(key_data min, key_data kdat, string the_name, - map the_omap) + object_data(key_data min, key_data kdat, std::string the_name, + std::map the_omap) : min_kdata(min), max_kdata(kdat), name(the_name), @@ -164,7 +164,7 @@ struct object_data { size(0) {} - object_data(key_data min, key_data kdat, string the_name, int the_version) + object_data(key_data min, key_data kdat, std::string the_name, int the_version) : min_kdata(min), max_kdata(kdat), name(the_name), @@ -205,12 +205,12 @@ WRITE_CLASS_ENCODER(object_data) struct create_data { key_data min; key_data max; - string obj; + std::string obj; create_data() {} - create_data(key_data n, key_data x, string o) + create_data(key_data n, key_data x, std::string o) : min(n), max(x), obj(o) @@ -253,14 +253,14 @@ WRITE_CLASS_ENCODER(create_data) struct delete_data { key_data min; key_data max; - string obj; + std::string obj; uint64_t version; delete_data() : version(0) {} - delete_data(key_data n, key_data x, string o, uint64_t v) + delete_data(key_data n, key_data x, std::string o, uint64_t v) : min(n), max(x), obj(o), @@ -310,7 +310,7 @@ struct index_data { //"1" if there is a prefix (because a split or merge is //in progress), otherwise "" - string prefix; + std::string prefix; //the kdata of the previous index entry key_data min_kdata; @@ -318,22 +318,22 @@ struct index_data { utime_t ts; //time that a split/merge started //objects to be created - vector to_create; + std::vector to_create; //objects to be deleted - vector to_delete; + std::vector to_delete; //the name of the object where the key range is located. - string obj; + std::string obj; index_data() {} - index_data(string raw_key) + index_data(std::string raw_key) : kdata(raw_key) {} - index_data(key_data max, key_data min, string o) + index_data(key_data max, key_data min, std::string o) : kdata(max), min_kdata(min), obj(o) @@ -387,19 +387,19 @@ struct index_data { * : * val) */ - string str() const { - stringstream strm; + std::string str() const { + std::stringstream strm; strm << '(' << min_kdata.encoded() << "/" << kdata.encoded() << ',' << prefix; if (prefix == "1") { strm << ts.sec() << '.' << ts.usec(); - for(vector::const_iterator it = to_create.begin(); + for(std::vector::const_iterator it = to_create.begin(); it != to_create.end(); ++it) { strm << '(' << it->min.encoded() << '/' << it->max.encoded() << '|' << it->obj << ')'; } strm << ';'; - for(vector::const_iterator it = to_delete.begin(); + for(std::vector::const_iterator it = to_delete.begin(); it != to_delete.end(); ++it) { strm << '(' << it->min.encoded() << '/' << it->max.encoded() << '|' << it->obj << '|' @@ -418,8 +418,8 @@ WRITE_CLASS_ENCODER(index_data) */ class IndexCache { protected: - map > k2itmap; - map t2kmap; + std::map > k2itmap; + std::map t2kmap; int cache_size; public: @@ -430,7 +430,7 @@ public: * Inserts idata into the cache and removes whatever key mapped to before. * If the cache is full, pops the oldest entry. */ - void push(const string &key, const index_data &idata); + void push(const std::string &key, const index_data &idata); /** * Inserts idata into the cache. If idata.kdata is already in the cache, @@ -451,13 +451,13 @@ public: /** * gets the idata where key belongs. If none, returns -ENODATA. */ - int get(const string &key, index_data *idata) const; + int get(const std::string &key, index_data *idata) const; /** * Gets the idata where key goes and the one after it. If there are not * valid entries for both of them, returns -ENODATA. */ - int get(const string &key, index_data *idata, index_data * next_idata) const; + int get(const std::string &key, index_data *idata, index_data * next_idata) const; void clear(); }; @@ -470,7 +470,7 @@ class KvFlatBtreeAsync; */ struct aio_set_args { KvFlatBtreeAsync * kvba; - string key; + std::string key; bufferlist val; bool exc; callback cb; @@ -480,7 +480,7 @@ struct aio_set_args { struct aio_rm_args { KvFlatBtreeAsync * kvba; - string key; + std::string key; callback cb; void * cb_args; int * err; @@ -488,7 +488,7 @@ struct aio_rm_args { struct aio_get_args { KvFlatBtreeAsync * kvba; - string key; + std::string key; bufferlist * val; bool exc; callback cb; @@ -502,12 +502,12 @@ protected: //don't change these once operations start being called - they are not //protected with mutexes! int k; - string index_name; + std::string index_name; librados::IoCtx io_ctx; - string rados_id; - string client_name; + std::string rados_id; + std::string client_name; librados::Rados rados; - string pool_name; + std::string pool_name; injection_t interrupt; int wait_ms; utime_t timeout; //declare a client dead if it goes this long without @@ -565,7 +565,7 @@ protected: * @post: idata contains complete information * stored */ - int read_index(const string &key, index_data * idata, + int read_index(const std::string &key, index_data * idata, index_data * next_idata, bool force_update); /** @@ -600,13 +600,13 @@ protected: * * @post: odata has all information about obj except for key (which is "") */ - int read_object(const string &obj, object_data * odata); + int read_object(const std::string &obj, object_data * odata); /** * performs a maybe_read_for_balance ObjectOperation so the omap is only * read if the object is out of bounds. */ - int read_object(const string &obj, rebalance_args * args); + int read_object(const std::string &obj, rebalance_args * args); /** * sets up owo to change the index in preparation for a split/merge. @@ -619,8 +619,8 @@ protected: * @pre: entries in to_create and to_delete must have keys and names. */ void set_up_prefix_index( - const vector &to_create, - const vector &to_delete, + const std::vector &to_create, + const std::vector &to_delete, librados::ObjectWriteOperation * owo, index_data * idata, int * err); @@ -643,9 +643,9 @@ protected: * @param err: the int to get the error value for omap_cmp */ void set_up_ops( - const vector &create_vector, - const vector &delete_vector, - vector, librados::ObjectWriteOperation*> > * ops, + const std::vector &create_vector, + const std::vector &delete_vector, + std::vector, librados::ObjectWriteOperation*> > * ops, const index_data &idata, int * err); @@ -654,7 +654,7 @@ protected: * unwritable to "0" */ void set_up_make_object( - const map &to_set, + const std::map &to_set, librados::ObjectWriteOperation *owo); /** @@ -693,9 +693,9 @@ protected: * (e.g., cleans up if an assertion fails). If an unknown error is found, * returns it. */ - int perform_ops( const string &debug_prefix, + int perform_ops( const std::string &debug_prefix, const index_data &idata, - vector, librados::ObjectWriteOperation*> > * ops); + std::vector, librados::ObjectWriteOperation*> > * ops); /** * Called when a client discovers that another client has died during a @@ -713,26 +713,26 @@ protected: * does the ObjectWriteOperation and splits, reads the index, and/or retries * until success. */ - int set_op(const string &key, const bufferlist &val, + int set_op(const std::string &key, const bufferlist &val, bool update_on_existing, index_data &idata); /** * does the ObjectWriteOperation and merges, reads the index, and/or retries * until success. */ - int remove_op(const string &key, index_data &idata, index_data &next_idata); + int remove_op(const std::string &key, index_data &idata, index_data &next_idata); /** * does the ObjectWriteOperation and reads the index and/or retries * until success. */ - int get_op(const string &key, bufferlist * val, index_data &idata); + int get_op(const std::string &key, bufferlist * val, index_data &idata); /** * does the ObjectWriteOperation and splits, reads the index, and/or retries * until success. */ - int handle_set_rm_errors(int &err, string key, string obj, + int handle_set_rm_errors(int &err, std::string key, std::string obj, index_data * idata, index_data * next_idata); /** @@ -758,12 +758,12 @@ public: */ int suicide() override; -KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, +KvFlatBtreeAsync(int k_val, std::string name, int cache, double cache_r, bool verb) : k(k_val), index_name("index_object"), rados_id(name), - client_name(string(name).append(".")), + client_name(std::string(name).append(".")), pool_name("rbd"), interrupt(&KeyValueStructure::nothing), wait_ms(0), @@ -782,12 +782,12 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, * @param i: the int to be appended to the string * @return the string */ - static string to_string(string s, int i); + static std::string to_string(std::string s, int i); /** * returns in encoded */ - static bufferlist to_bl(const string &in) { + static bufferlist to_bl(const std::string &in) { bufferlist bl; bl.append(in); return bl; @@ -805,7 +805,7 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, /** * returns the rados_id of this KvFlatBtreeAsync */ - string get_name(); + std::string get_name(); /** * sets this kvba to call inject before every ObjectWriteOperation. @@ -820,10 +820,10 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, */ int setup(int argc, const char** argv) override; - int set(const string &key, const bufferlist &val, + int set(const std::string &key, const bufferlist &val, bool update_on_existing) override; - int remove(const string &key) override; + int remove(const std::string &key) override; /** * returns true if all of the following are true: @@ -844,16 +844,16 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, * stats about each object and all omaps. Don't use if you have more than * about 10 objects. */ - string str() override; + std::string str() override; - int get(const string &key, bufferlist *val) override; + int get(const std::string &key, bufferlist *val) override; //async versions of these methods - void aio_get(const string &key, bufferlist *val, callback cb, + void aio_get(const std::string &key, bufferlist *val, callback cb, void *cb_args, int * err) override; - void aio_set(const string &key, const bufferlist &val, bool exclusive, + void aio_set(const std::string &key, const bufferlist &val, bool exclusive, callback cb, void * cb_args, int * err) override; - void aio_remove(const string &key, callback cb, void *cb_args, int * err) override; + void aio_remove(const std::string &key, callback cb, void *cb_args, int * err) override; //these methods that deal with multiple keys at once are efficient, but make //no guarantees about atomicity! @@ -887,10 +887,10 @@ KvFlatBtreeAsync(int k_val, string name, int cache, double cache_r, * * The keys are distributed across the range of keys in the store * * there is a small number of keys compared to k */ - int set_many(const map &in_map) override; + int set_many(const std::map &in_map) override; - int get_all_keys(std::set *keys) override; - int get_all_keys_and_values(map *kv_map) override; + int get_all_keys(std::set *keys) override; + int get_all_keys_and_values(std::map *kv_map) override; }; -- 2.39.5