shard_id(shard),
max(false) {}
+ ghobject_t(shard_id_t shard, int64_t pool, uint32_t hash,
+ const std::string& nspace, const std::string& oid,
+ snapid_t snap, gen_t gen)
+ : hobj(object_t(oid), "", snap, hash, pool, nspace),
+ generation(gen),
+ shard_id(shard),
+ max(false) {}
+
static ghobject_t make_pgmeta(int64_t pool, uint32_t hash, shard_id_t shard) {
hobject_t h(object_t(), std::string(), CEPH_NOSNAP, hash, pool, std::string());
return ghobject_t(h, NO_GEN, shard);
#include "stages/key_layout.h"
#include "tree.h"
-namespace crimson::os::seastore::onode {
+/**
+ * tree_utils
+ *
+ * Contains shared logic for unit tests and perf tool.
+ */
-ghobject_t make_ghobj(
- int shard, unsigned pool, unsigned crush,
- std::string ns, std::string oid, unsigned snap, unsigned gen) {
- assert(shard <= std::numeric_limits<shard_t>::max());
- assert(shard >= std::numeric_limits<shard_t>::min());
- assert(pool <= std::numeric_limits<pool_t>::max());
- assert(crush <= std::numeric_limits<crush_hash_t>::max());
- assert(snap <= std::numeric_limits<snap_t>::max());
- assert(gen <= std::numeric_limits<gen_t>::max());
- ghobject_t ghobj;
- ghobj.shard_id.id = shard;
- ghobj.hobj.pool = pool;
- ghobj.hobj.set_hash(crush);
- ghobj.hobj.nspace = ns;
- ghobj.hobj.oid.name = oid;
- ghobj.hobj.snap = snap;
- ghobj.generation = gen;
- return ghobj;
-}
+namespace crimson::os::seastore::onode {
class Onodes {
public:
assert(oid_size >= current_size);
os_oid << std::string(oid_size - current_size, '_');
- return make_ghobj(index2, index2, index2,
+ return ghobject_t(shard_id_t(index2), index2, index2,
os_ns.str(), os_oid.str(), index0, index0);
}
};
return crimson::get_logger(ceph_subsys_test);
}
+ ghobject_t make_ghobj(
+ shard_t shard, pool_t pool, crush_hash_t crush,
+ std::string ns, std::string oid, snap_t snap, gen_t gen) {
+ return ghobject_t{shard_id_t{shard}, pool, crush, ns, oid, snap, gen};
+ }
+
// return a key_view_t and its underlying memory buffer.
// the buffer needs to be freed manually.
std::pair<key_view_t, void*> build_key_view(const ghobject_t& hobj) {