bool MemStore::exists(coll_t cid, const ghobject_t& oid)
{
- dout(10) << __func__ << " " << cid << " " << oid << dendl;
- CollectionRef c = get_collection(cid);
+ CollectionHandle c = get_collection(cid);
if (!c)
return false;
+ return exists(c, oid);
+}
+
+bool MemStore::exists(CollectionHandle &c_, const ghobject_t& oid)
+{
+ Collection *c = static_cast<Collection*>(c_.get());
+ dout(10) << __func__ << " " << c->get_cid() << " " << oid << dendl;
+ if (!c->exists)
+ return false;
// Perform equivalent of c->get_object_(oid) != NULL. In C++11 the
// shared_ptr needs to be compared to nullptr.
struct stat *st,
bool allow_eio)
{
- dout(10) << __func__ << " " << cid << " " << oid << dendl;
- CollectionRef c = get_collection(cid);
+ CollectionHandle c = get_collection(cid);
if (!c)
return -ENOENT;
+ return stat(c, oid, st, allow_eio);
+}
+int MemStore::stat(
+ CollectionHandle &c_,
+ const ghobject_t& oid,
+ struct stat *st,
+ bool allow_eio)
+{
+ Collection *c = static_cast<Collection*>(c_.get());
+ dout(10) << __func__ << " " << c->cid << " " << oid << dendl;
+ if (!c->exists)
+ return -ENOENT;
ObjectRef o = c->get_object(oid);
if (!o)
return -ENOENT;
uint32_t op_flags,
bool allow_eio)
{
- dout(10) << __func__ << " " << cid << " " << oid << " "
- << offset << "~" << len << dendl;
- CollectionRef c = get_collection(cid);
+ CollectionHandle c = get_collection(cid);
if (!c)
return -ENOENT;
+ return read(c, oid, offset, len, bl, op_flags, allow_eio);
+}
+int MemStore::read(
+ CollectionHandle &c_,
+ const ghobject_t& oid,
+ uint64_t offset,
+ size_t len,
+ bufferlist& bl,
+ uint32_t op_flags,
+ bool allow_eio)
+{
+ Collection *c = static_cast<Collection*>(c_.get());
+ dout(10) << __func__ << " " << c->cid << " " << oid << " "
+ << offset << "~" << len << dendl;
+ if (!c->exists)
+ return -ENOENT;
ObjectRef o = c->get_object(oid);
if (!o)
return -ENOENT;
int MemStore::getattr(coll_t cid, const ghobject_t& oid,
const char *name, bufferptr& value)
{
- dout(10) << __func__ << " " << cid << " " << oid << " " << name << dendl;
- CollectionRef c = get_collection(cid);
+ CollectionHandle c = get_collection(cid);
if (!c)
return -ENOENT;
+ return getattr(c, oid, name, value);
+}
+int MemStore::getattr(CollectionHandle &c_, const ghobject_t& oid,
+ const char *name, bufferptr& value)
+{
+ Collection *c = static_cast<Collection*>(c_.get());
+ dout(10) << __func__ << " " << c->cid << " " << oid << " " << name << dendl;
+ if (!c->exists)
+ return -ENOENT;
ObjectRef o = c->get_object(oid);
if (!o)
return -ENOENT;
int MemStore::getattrs(coll_t cid, const ghobject_t& oid,
map<string,bufferptr>& aset)
{
- dout(10) << __func__ << " " << cid << " " << oid << dendl;
- CollectionRef c = get_collection(cid);
+ CollectionHandle c = get_collection(cid);
if (!c)
return -ENOENT;
+ return getattrs(c, oid, aset);
+}
+
+int MemStore::getattrs(CollectionHandle &c_, const ghobject_t& oid,
+ map<string,bufferptr>& aset)
+{
+ Collection *c = static_cast<Collection*>(c_.get());
+ dout(10) << __func__ << " " << c->cid << " " << oid << dendl;
+ if (!c->exists)
+ return -ENOENT;
ObjectRef o = c->get_object(oid);
if (!o)
int statfs(struct statfs *buf);
- bool exists(coll_t cid, const ghobject_t& oid);
- int stat(
+ bool exists(coll_t cid, const ghobject_t& oid) override;
+ bool exists(CollectionHandle &c, const ghobject_t& oid) override;
+ int stat(coll_t cid, const ghobject_t& oid,
+ struct stat *st, bool allow_eio = false) override;
+ int stat(CollectionHandle &c, const ghobject_t& oid,
+ struct stat *st, bool allow_eio = false) override;
+ int read(
coll_t cid,
const ghobject_t& oid,
- struct stat *st,
- bool allow_eio = false); // struct stat?
+ uint64_t offset,
+ size_t len,
+ bufferlist& bl,
+ uint32_t op_flags = 0,
+ bool allow_eio = false) override;
int read(
- coll_t cid,
+ CollectionHandle &c,
const ghobject_t& oid,
uint64_t offset,
size_t len,
bufferlist& bl,
uint32_t op_flags = 0,
- bool allow_eio = false);
+ bool allow_eio = false) override;
int fiemap(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
- int getattr(coll_t cid, const ghobject_t& oid, const char *name, bufferptr& value);
- int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset);
+ int getattr(coll_t cid, const ghobject_t& oid, const char *name,
+ bufferptr& value) override;
+ int getattr(CollectionHandle &c, const ghobject_t& oid, const char *name,
+ bufferptr& value) override;
+ int getattrs(coll_t cid, const ghobject_t& oid,
+ map<string,bufferptr>& aset) override;
+ int getattrs(CollectionHandle &c, const ghobject_t& oid,
+ map<string,bufferptr>& aset) override;
int list_collections(vector<coll_t>& ls);