Call out those creating collections with strings.
Signed-off-by: Sage Weil <sage@redhat.com>
(de->d_name[1] == '.' &&
de->d_name[2] == '\0')))
continue;
- ls.push_back(coll_t(de->d_name));
+ ls.push_back(coll_t::make_string_collection(de->d_name));
}
if (r > 0) {
}
if (out_coll)
- *out_coll = coll_t(coll);
+ *out_coll = coll_t::make_string_coll(coll);
return true;
}
for (vector<ghobject_t>::const_iterator iter = oids.begin();
iter != oids.end(); ++iter) {
- ls.push_back(coll_t(iter->hobj.oid.name));
+ ls.push_back(coll_t::make_string_coll(iter->hobj.oid.name));
}
return 0;
// A special coll used by store collection info, each obj in this coll
// represent a coll_t
static bool is_coll_obj(coll_t c) {
- return c == coll_t("COLLECTIONS");
+ return c == coll_t::make_string_coll("COLLECTIONS");
}
static coll_t get_coll_for_coll() {
- return coll_t("COLLECTIONS");
+ return coll_t::make_string_coll("COLLECTIONS");
}
static ghobject_t make_ghobject_for_coll(const coll_t &col) {
return ghobject_t(hobject_t(sobject_t(col.to_str(), CEPH_NOSNAP)));
// ----------------------
class coll_t {
+ explicit coll_t(const std::string &str_)
+ : str(str_)
+ { }
+
public:
coll_t()
: str("meta")
{ }
- explicit coll_t(const std::string &str_)
- : str(str_)
- { }
+ coll_t(const coll_t& other) : str(other.str) {}
explicit coll_t(spg_t pgid, snapid_t snap = CEPH_NOSNAP)
: str(pg_and_snap_to_str(pgid, snap))
{ }
+ static coll_t make_string_coll(const std::string& s) {
+ return coll_t(s);
+ }
+
const std::string& to_str() const {
return str;
}
coll << "collection_" << num;
std::cout << "collection " << coll.str() << std::endl;
ObjectStore::Transaction t;
- t.create_collection(coll_t(coll.str()));
+ t.create_collection(coll_t::make_string_coll(coll.str()));
fs.apply_transaction(t);
}
{
ObjectStore::Sequencer *osr = &(osrs.find(coll_str)->second);
- coll_t c(coll_str);
+ coll_t c(coll_t::make_string_coll(coll_str));
hobject_t h(sobject_t(oid.substr(sep+1), 0));
t->write(c, h, offset, bl.length(), bl);
size_t sep = oid.find("/");
assert(sep != string::npos);
assert(sep + 1 < oid.size());
- coll_t c(oid.substr(0, sep));
+ coll_t c(coll_t::make_string_coll(oid.substr(0, sep)));
hobject_t h(sobject_t(oid.substr(sep+1), 0));
os->read(c, h, offset, length, *bl);
finisher.queue(on_complete);
TEST_P(StoreTest, SimpleCloneRangeTest) {
int r;
- coll_t cid = coll_t("coll");
+ coll_t cid;
{
ObjectStore::Transaction t;
t.create_collection(cid);
ASSERT_EQ(r, 0);
}
ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP)));
+ hoid.hobj.pool = -1;
bufferlist small, newdata;
small.append("small");
{
ASSERT_EQ(r, 0);
}
ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP)));
+ hoid2.hobj.pool = -1;
{
ObjectStore::Transaction t;
t.clone_range(cid, hoid, hoid2, 10, 5, 0);