#include <iterator>
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;
return;
}
index_data old_idata;
- map<key_data, pair<index_data, utime_t> >::iterator old_it =
+ std::map<key_data, std::pair<index_data, utime_t> >::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<key_data, pair<index_data, utime_t> >::iterator new_it =
+ std::map<key_data, std::pair<index_data, utime_t> >::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();
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();
if (cache_size == 0) {
return;
}
- map<utime_t, key_data>::iterator it = t2kmap.begin();
+ std::map<utime_t, key_data>::iterator it = t2kmap.begin();
utime_t time = it->first;
key_data kdata = it->second;
k2itmap.erase(kdata);
if ((int)k2itmap.size() == 0) {
return -ENODATA;
}
- map<key_data, pair<index_data, utime_t> >::const_iterator it =
+ std::map<key_data, std::pair<index_data, utime_t> >::const_iterator it =
k2itmap.lower_bound(key_data(key));
if (it == k2itmap.end() || !(it->second.first.min_kdata < key_data(key))) {
return -ENODATA;
if (cache_size == 0) {
return -ENODATA;
}
- map<key_data, pair<index_data, utime_t> >::const_iterator it =
+ std::map<key_data, std::pair<index_data, utime_t> >::const_iterator it =
k2itmap.lower_bound(key_data(key));
if (it == k2itmap.end() || ++it == k2itmap.end()) {
return -ENODATA;
args.odata.max_kdata, args.odata.name, args.odata.version));
//for lower half object
- map<std::string, bufferlist>::const_iterator it = args.odata.omap.begin();
+ std::map<std::string, bufferlist>::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();
//setting up operations
librados::ObjectWriteOperation owos[6];
- vector<pair<pair<int, string>, librados::ObjectWriteOperation*> > ops;
+ vector<std::pair<std::pair<int, string>, 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<int, string>(ADD_PREFIX, index_name),
+ ops.push_back(std::make_pair(
+ std::pair<int, string>(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);
vector<object_data> to_delete;
librados::ObjectWriteOperation create[2];//possibly only 1 will be used
librados::ObjectWriteOperation other_ops[6];
- vector<pair<pair<int, string>, librados::ObjectWriteOperation*> > ops;
- ops.push_back(make_pair(
- pair<int, string>(ADD_PREFIX, index_name),
+ vector<std::pair<std::pair<int, string>, librados::ObjectWriteOperation*> > ops;
+ ops.push_back(std::make_pair(
+ std::pair<int, string>(ADD_PREFIX, index_name),
&other_ops[0]));
if ((int)args1.odata.size + (int)args2.odata.size <= 2*k) {
<< args1.odata.name
<< " and " << args2.odata.name << " to get " << o2w
<< std::endl;
- map<string, bufferlist> write2_map;
+ std::map<string, bufferlist> 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<int, string>(MAKE_OBJECT, o2w),
+ ops.push_back(std::make_pair(
+ std::pair<int, std::string>(MAKE_OBJECT, o2w),
&create[0]));
ceph_assert((int)write2_map.size() <= 2*k);
} else {
if (verbose) cout << "\t\t" << client_name << "-rebalance: rebalancing "
<< args1.odata.name
<< " and " << args2.odata.name << std::endl;
- map<std::string, bufferlist> write1_map;
- map<std::string, bufferlist> write2_map;
- map<std::string, bufferlist>::iterator it;
+ std::map<std::string, bufferlist> write1_map;
+ std::map<std::string, bufferlist> write2_map;
+ std::map<std::string, bufferlist>::iterator it;
client_index_lock.lock();
string o1w = to_string(client_name, client_index++);
client_index_lock.unlock();
write2_map.insert(args2.odata.omap.begin(), args2.odata.omap.end());
} else {
//args1.odata.omap was small, and write2_map still needs more
- map<std::string, bufferlist>::iterator it2;
+ std::map<std::string, bufferlist>::iterator it2;
for(it2 = args2.odata.omap.begin();
(it2 != args2.odata.omap.end()) && ((int)write1_map.size()
< target_size_1);
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<int, string>(MAKE_OBJECT, o1w),
+ ops.push_back(std::make_pair(
+ std::pair<int, std::string>(MAKE_OBJECT, o1w),
&create[0]));
- ops.push_back(make_pair(
- pair<int, string>(MAKE_OBJECT, o2w),
+ ops.push_back(std::make_pair(
+ std::pair<int, std::string>(MAKE_OBJECT, o2w),
&create[1]));
}
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;
librados::ObjectWriteOperation * owo,
index_data * idata,
int * err) {
- std::map<std::string, pair<bufferlist, int> > assertions;
- map<string, bufferlist> to_insert;
+ std::map<std::string, std::pair<bufferlist, int> > assertions;
+ std::map<string, bufferlist> to_insert;
idata->prefix = "1";
idata->ts = ceph_clock_now();
for(vector<object_data>::const_iterator it = to_create.begin();
this_entry.min_kdata = idata->min_kdata;
this_entry.kdata = idata->kdata;
this_entry.obj = idata->obj;
- assertions[it->max_kdata.encoded()] = pair<bufferlist, int>
+ assertions[it->max_kdata.encoded()] = std::pair<bufferlist, int>
(to_bl(this_entry), CEPH_OSD_CMPXATTR_OP_EQ);
if (verbose) cout << "\t\t\t" << client_name
<< "-setup_prefix: will assert "
void KvFlatBtreeAsync::set_up_ops(
const vector<object_data> &create_vector,
const vector<object_data> &delete_vector,
- vector<pair<pair<int, string>, librados::ObjectWriteOperation*> > * ops,
+ vector<std::pair<std::pair<int, string>, librados::ObjectWriteOperation*> > * ops,
const index_data &idata,
int * err) {
- vector<pair<pair<int, string>,
+ vector<std::pair<std::pair<int, string>,
librados::ObjectWriteOperation* > >::iterator it;
//skip the prefixing part
for(it = ops->begin(); it->first.first == ADD_PREFIX; ++it) {}
- map<string, bufferlist> to_insert;
+ std::map<string, bufferlist> to_insert;
std::set<string> to_remove;
- map<string, pair<bufferlist, int> > assertions;
+ std::map<string, std::pair<bufferlist, int> > assertions;
if (create_vector.size() > 0) {
for (int i = 0; i < (int)idata.to_delete.size(); ++i) {
- it->first = pair<int, string>(UNWRITE_OBJECT, idata.to_delete[i].obj);
+ it->first = std::pair<int, string>(UNWRITE_OBJECT, idata.to_delete[i].obj);
set_up_unwrite_object(delete_vector[i].version, it->second);
++it;
}
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<int, string>(MAKE_OBJECT, idata.to_create[i].obj);
+ it->first = std::pair<int, string>(MAKE_OBJECT, idata.to_create[i].obj);
} else {
- it->first = pair<int, string>(AIO_MAKE_OBJECT, idata.to_create[i].obj);
+ it->first = std::pair<int, string>(AIO_MAKE_OBJECT, idata.to_create[i].obj);
}
set_up_make_object(create_vector[i].omap, it->second);
++it;
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<bufferlist, int>(
+ assertions[idata.to_delete[i].max.encoded()] = std::pair<bufferlist, int>(
to_bl(this_entry), CEPH_OSD_CMPXATTR_OP_EQ);
to_remove.insert(idata.to_delete[i].max.encoded());
- it->first = pair<int, string>(REMOVE_OBJECT, idata.to_delete[i].obj);
+ it->first = std::pair<int, string>(REMOVE_OBJECT, idata.to_delete[i].obj);
set_up_delete_object(it->second);
++it;
}
it->second->omap_set(to_insert);
- it->first = pair<int, string>(REMOVE_PREFIX, index_name);
+ it->first = std::pair<int, string>(REMOVE_PREFIX, index_name);
}
void KvFlatBtreeAsync::set_up_make_object(
- const map<std::string, bufferlist> &to_set,
+ const std::map<std::string, bufferlist> &to_set,
librados::ObjectWriteOperation *owo) {
bufferlist inbl;
encode(to_set, inbl);
int KvFlatBtreeAsync::perform_ops(const string &debug_prefix,
const index_data &idata,
- vector<pair<pair<int, string>, librados::ObjectWriteOperation*> > *ops) {
+ vector<std::pair<std::pair<int, string>, librados::ObjectWriteOperation*> > *ops) {
int err = 0;
vector<librados::AioCompletion*> aiocs(idata.to_create.size());
int count = 0;
- for (vector<pair<pair<int, string>,
+ for (vector<std::pair<std::pair<int, string>,
librados::ObjectWriteOperation*> >::iterator it = ops->begin();
it != ops->end(); ++it) {
if ((((KeyValueStructure *)this)->*KvFlatBtreeAsync::interrupt)() == 1 ) {
<< std::endl;
int err = 0;
ceph_assert(idata.prefix != "");
- map<std::string,bufferlist> new_index;
- map<std::string, pair<bufferlist, int> > assertions;
+ std::map<std::string,bufferlist> new_index;
+ std::map<std::string, std::pair<bufferlist, int> > assertions;
switch (error) {
case -EFIRSTOBJ: {
//this happens if the split or rebalance failed to mark the first object,
<< "-cleanup: will assert index contains "
<< this_entry.str() << std::endl;
assertions[it->max.encoded()] =
- pair<bufferlist, int>(to_bl(this_entry),
+ std::pair<bufferlist, int>(to_bl(this_entry),
CEPH_OSD_CMPXATTR_OP_EQ);
}
<< "-cleanup: will assert index contains "
<< this_entry.str() << std::endl;
assertions[it->max.encoded()] =
- pair<bufferlist, int>(to_bl(this_entry),
+ std::pair<bufferlist, int>(to_bl(this_entry),
CEPH_OSD_CMPXATTR_OP_EQ);
}
it = idata.to_delete.begin();
<< std::endl;
//all changes were created except for updating the index and possibly
//deleting the objects. roll forward.
- vector<pair<pair<int, string>, librados::ObjectWriteOperation*> > ops;
+ vector<std::pair<std::pair<int, string>, librados::ObjectWriteOperation*> > ops;
vector<librados::ObjectWriteOperation> owos(idata.to_delete.size() + 1);
for (int i = 0; i <= (int)idata.to_delete.size(); ++i) {
- ops.push_back(make_pair(pair<int, string>(0, ""), &owos[i]));
+ ops.push_back(std::make_pair(std::pair<int, std::string>(0, ""), &owos[i]));
}
set_up_ops(vector<object_data>(),
vector<object_data>(), &ops, idata, &err);
//roll back all changes.
if (verbose) cout << "\t\t" << client_name << "-cleanup: rolling back"
<< std::endl;
- map<std::string,bufferlist> new_index;
- std::set<string> to_remove;
- map<std::string, pair<bufferlist, int> > assertions;
+ std::map<std::string,bufferlist> new_index;
+ std::set<std::string> to_remove;
+ std::map<std::string, std::pair<bufferlist, int> > assertions;
//mark the objects to be created. if someone else already has, die.
for(vector<create_data >::const_reverse_iterator it =
<< "-cleanup: will assert index contains "
<< this_entry.str() << std::endl;
assertions[it->max.encoded()] =
- pair<bufferlist, int>(to_bl(this_entry),
+ std::pair<bufferlist, int>(to_bl(this_entry),
CEPH_OSD_CMPXATTR_OP_EQ);
librados::ObjectWriteOperation restore;
set_up_restore_object(&restore);
librados::ObjectWriteOperation make_index;
make_index.create(true);
- map<std::string,bufferlist> index_map;
+ std::map<std::string,bufferlist> index_map;
index_data idata;
idata.obj = client_name;
idata.min_kdata.raw_key = "";
int err = 0;
std::set<std::string> key_set;
key_set.insert(key);
- map<std::string,bufferlist> omap;
+ std::map<std::string,bufferlist> omap;
librados::ObjectReadOperation read;
read.omap_get_vals_by_keys(key_set, &omap, &err);
err = io_ctx.operate(idata.obj, &read, NULL);
pthread_detach(t);
}
-int KvFlatBtreeAsync::set_many(const map<string, bufferlist> &in_map) {
+int KvFlatBtreeAsync::set_many(const std::map<string, bufferlist> &in_map) {
int err = 0;
bufferlist inbl;
bufferlist outbl;
std::set<string> keys;
- map<string, bufferlist> big_map;
+ std::map<string, bufferlist> big_map;
for (map<string, bufferlist>::const_iterator it = in_map.begin();
it != in_map.end(); ++it) {
keys.insert(it->first);
return err;
}
- map<string, bufferlist> imap;//read from the index
+ std::map<string, bufferlist> imap;//read from the index
auto blit = outbl.cbegin();
decode(imap, blit);
vector<librados::ObjectWriteOperation> owos(2 + 2 * to_delete.size()
+ to_create.size());
- vector<pair<pair<int, string>, librados::ObjectWriteOperation*> > ops;
+ vector<std::pair<std::pair<int, string>, librados::ObjectWriteOperation*> > ops;
index_data idata;
if (verbose) cout << "finished making to_create and to_delete. "
<< std::endl;
- ops.push_back(make_pair(
- pair<int, string>(ADD_PREFIX, index_name),
+ ops.push_back(std::make_pair(
+ std::pair<int, string>(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);
librados::ObjectWriteOperation rm_index;
librados::AioCompletion * rm_index_aioc = rados.aio_create_completion();
- map<std::string,bufferlist> new_index;
+ std::map<std::string,bufferlist> new_index;
new_index["1"] = index_set["1"];
rm_index.omap_clear();
rm_index.omap_set(new_index);
}
int KvFlatBtreeAsync::get_all_keys_and_values(
- map<std::string,bufferlist> *kv_map) {
+ std::map<std::string,bufferlist> *kv_map) {
if (verbose) cout << client_name << ": getting all keys and values"
<< std::endl;
int err = 0;
for (std::set<std::string>::iterator it = index_set.begin();
it != index_set.end(); ++it){
librados::ObjectReadOperation sub;
- map<std::string, bufferlist> ret;
+ std::map<std::string, bufferlist> ret;
sub.omap_get_vals2("",LONG_MAX,&ret, nullptr, &err);
io_ctx.operate(*it, &sub, NULL);
kv_map->insert(ret.begin(), ret.end());
bool ret = true;
if (verbose) cout << client_name << ": checking consistency" << std::endl;
std::map<std::string,bufferlist> index;
- map<std::string, std::set<std::string> > sub_objs;
+ std::map<std::string, std::set<std::string> > sub_objs;
librados::ObjectReadOperation oro;
oro.omap_get_vals2("",LONG_MAX,&index, nullptr, &err);
io_ctx.operate(index_name, &oro, NULL);
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);
}
}
using ceph::bufferlist;
+
enum {
ADD_PREFIX = 1,
MAKE_OBJECT = 2,
struct rebalance_args;
-
/**
* stores information about a key in the index.
*
* 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()
{}
/**
* @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";
*
* @pre: encoded has a prefix
*/
- void parse(string encoded) {
+ void parse(std::string encoded) {
prefix = encoded[0];
raw_key = encoded.substr(1,encoded.length());
}
/**
* returns a string containing the encoded (prefixed) key
*/
- string encoded() const {
+ std::string encoded() const {
return prefix + raw_key;
}
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<std::string, bufferlist> omap; // the omap of the object
+ std::string name; //the object's name
+ std::map<std::string, bufferlist> 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
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),
size(0)
{}
- object_data(key_data min, key_data kdat, string the_name,
- map<std::string, bufferlist> the_omap)
+ object_data(key_data min, key_data kdat, std::string the_name,
+ std::map<std::string, bufferlist> the_omap)
: min_kdata(min),
max_kdata(kdat),
name(the_name),
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),
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)
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),
//"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;
utime_t ts; //time that a split/merge started
//objects to be created
- vector<create_data > to_create;
+ std::vector<create_data > to_create;
//objects to be deleted
- vector<delete_data > to_delete;
+ std::vector<delete_data > 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)
* :
* 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<create_data>::const_iterator it = to_create.begin();
+ for(std::vector<create_data>::const_iterator it = to_create.begin();
it != to_create.end(); ++it) {
strm << '(' << it->min.encoded() << '/' << it->max.encoded() << '|'
<< it->obj << ')';
}
strm << ';';
- for(vector<delete_data >::const_iterator it = to_delete.begin();
+ for(std::vector<delete_data >::const_iterator it = to_delete.begin();
it != to_delete.end(); ++it) {
strm << '(' << it->min.encoded() << '/' << it->max.encoded() << '|'
<< it->obj << '|'
*/
class IndexCache {
protected:
- map<key_data, pair<index_data, utime_t> > k2itmap;
- map<utime_t, key_data> t2kmap;
+ std::map<key_data, std::pair<index_data, utime_t> > k2itmap;
+ std::map<utime_t, key_data> t2kmap;
int cache_size;
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,
/**
* 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();
};
*/
struct aio_set_args {
KvFlatBtreeAsync * kvba;
- string key;
+ std::string key;
bufferlist val;
bool exc;
callback cb;
struct aio_rm_args {
KvFlatBtreeAsync * kvba;
- string key;
+ std::string key;
callback cb;
void * cb_args;
int * err;
struct aio_get_args {
KvFlatBtreeAsync * kvba;
- string key;
+ std::string key;
bufferlist * val;
bool exc;
callback cb;
//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
* @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);
/**
*
* @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.
* @pre: entries in to_create and to_delete must have keys and names.
*/
void set_up_prefix_index(
- const vector<object_data> &to_create,
- const vector<object_data> &to_delete,
+ const std::vector<object_data> &to_create,
+ const std::vector<object_data> &to_delete,
librados::ObjectWriteOperation * owo,
index_data * idata,
int * err);
* @param err: the int to get the error value for omap_cmp
*/
void set_up_ops(
- const vector<object_data> &create_vector,
- const vector<object_data> &delete_vector,
- vector<pair<pair<int, string>, librados::ObjectWriteOperation*> > * ops,
+ const std::vector<object_data> &create_vector,
+ const std::vector<object_data> &delete_vector,
+ std::vector<std::pair<std::pair<int, std::string>, librados::ObjectWriteOperation*> > * ops,
const index_data &idata,
int * err);
* unwritable to "0"
*/
void set_up_make_object(
- const map<std::string, bufferlist> &to_set,
+ const std::map<std::string, bufferlist> &to_set,
librados::ObjectWriteOperation *owo);
/**
* (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<pair<pair<int, string>, librados::ObjectWriteOperation*> > * ops);
+ std::vector<std::pair<std::pair<int, std::string>, librados::ObjectWriteOperation*> > * ops);
/**
* Called when a client discovers that another client has died during a
* 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);
/**
*/
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),
* @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;
/**
* returns the rados_id of this KvFlatBtreeAsync
*/
- string get_name();
+ std::string get_name();
/**
* sets this kvba to call inject before every ObjectWriteOperation.
*/
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:
* 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!
* * 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<string, bufferlist> &in_map) override;
+ int set_many(const std::map<std::string, bufferlist> &in_map) override;
- int get_all_keys(std::set<string> *keys) override;
- int get_all_keys_and_values(map<string,bufferlist> *kv_map) override;
+ int get_all_keys(std::set<std::string> *keys) override;
+ int get_all_keys_and_values(std::map<std::string,bufferlist> *kv_map) override;
};