return coll_map.count(cid);
}
-int MemStore::collection_getattr(coll_t cid, const char *name,
- void *value, size_t size)
-{
- dout(10) << __func__ << " " << cid << " " << name << dendl;
- CollectionRef c = get_collection(cid);
- if (!c)
- return -ENOENT;
- RWLock::RLocker lc(c->lock);
-
- if (!c->xattr.count(name))
- return -ENODATA;
- bufferlist bl;
- bl.append(c->xattr[name]);
- size_t l = MIN(size, bl.length());
- bl.copy(0, size, (char *)value);
- return l;
-}
-
-int MemStore::collection_getattr(coll_t cid, const char *name, bufferlist& bl)
-{
- dout(10) << __func__ << " " << cid << " " << name << dendl;
- CollectionRef c = get_collection(cid);
- if (!c)
- return -ENOENT;
- RWLock::RLocker l(c->lock);
-
- if (!c->xattr.count(name))
- return -ENODATA;
- bl.clear();
- bl.append(c->xattr[name]);
- return bl.length();
-}
-
-int MemStore::collection_getattrs(coll_t cid, map<string,bufferptr> &aset)
-{
- dout(10) << __func__ << " " << cid << dendl;
- CollectionRef c = get_collection(cid);
- if (!c)
- return -ENOENT;
- RWLock::RLocker l(c->lock);
-
- aset = c->xattr;
- return 0;
-}
-
bool MemStore::collection_empty(coll_t cid)
{
dout(10) << __func__ << " " << cid << dendl;
string name = i.decode_attrname();
bufferlist bl;
i.decode_bl(bl);
- r = _collection_setattr(cid, name.c_str(), bl.c_str(), bl.length());
+ assert(0 == "not implemented");
}
break;
{
coll_t cid = i.decode_cid();
string name = i.decode_attrname();
- r = _collection_rmattr(cid, name.c_str());
+ assert(0 == "not implemented");
}
break;
return r;
}
-int MemStore::_collection_setattr(coll_t cid, const char *name,
- const void *value, size_t size)
-{
- dout(10) << __func__ << " " << cid << " " << name << dendl;
- ceph::unordered_map<coll_t,CollectionRef>::iterator cp = coll_map.find(cid);
- if (cp == coll_map.end())
- return -ENOENT;
- RWLock::WLocker l(cp->second->lock);
-
- cp->second->xattr[name] = bufferptr((const char *)value, size);
- return 0;
-}
-
-int MemStore::_collection_setattrs(coll_t cid, map<string,bufferptr> &aset)
-{
- dout(10) << __func__ << " " << cid << dendl;
- ceph::unordered_map<coll_t,CollectionRef>::iterator cp = coll_map.find(cid);
- if (cp == coll_map.end())
- return -ENOENT;
- RWLock::WLocker l(cp->second->lock);
-
- for (map<string,bufferptr>::const_iterator p = aset.begin();
- p != aset.end();
- ++p) {
- cp->second->xattr[p->first] = p->second;
- }
- return 0;
-}
-
-int MemStore::_collection_rmattr(coll_t cid, const char *name)
-{
- dout(10) << __func__ << " " << cid << " " << name << dendl;
- ceph::unordered_map<coll_t,CollectionRef>::iterator cp = coll_map.find(cid);
- if (cp == coll_map.end())
- return -ENOENT;
- RWLock::WLocker l(cp->second->lock);
-
- if (cp->second->xattr.count(name) == 0)
- return -ENODATA;
- cp->second->xattr.erase(name);
- return 0;
-}
-
int MemStore::_split_collection(coll_t cid, uint32_t bits, uint32_t match,
coll_t dest)
{
int _collection_add(coll_t cid, coll_t ocid, const ghobject_t& oid);
int _collection_move_rename(coll_t oldcid, const ghobject_t& oldoid,
coll_t cid, const ghobject_t& o);
- int _collection_setattr(coll_t cid, const char *name, const void *value,
- size_t size);
- int _collection_setattrs(coll_t cid, map<string,bufferptr> &aset);
- int _collection_rmattr(coll_t cid, const char *name);
int _split_collection(coll_t cid, uint32_t bits, uint32_t rem, coll_t dest);
int _save();
int list_collections(vector<coll_t>& ls);
bool collection_exists(coll_t c);
- int collection_getattr(coll_t cid, const char *name,
- void *value, size_t size);
- int collection_getattr(coll_t cid, const char *name, bufferlist& bl);
- int collection_getattrs(coll_t cid, map<string,bufferptr> &aset);
bool collection_empty(coll_t c);
int collection_list(coll_t cid, vector<ghobject_t>& o);
int collection_list_partial(coll_t cid, ghobject_t start,