private:
Mutex faker_lock;
ObjectStore *store;
- hash_map<coll_t, set<sobject_t> > fakecollections;
+ hash_map<coll_t, set<hobject_t> > fakecollections;
public:
FakeCollections(ObjectStore *s) : faker_lock("FakeCollections::faker_lock"), store(s) {}
int list_collections(vector<coll_t>& ls) {
faker_lock.Lock();
int r = 0;
- for (hash_map< coll_t, set<sobject_t> >::iterator p = fakecollections.begin();
+ for (hash_map< coll_t, set<hobject_t> >::iterator p = fakecollections.begin();
p != fakecollections.end();
p++) {
r++;
return r;
}
- int collection_add(coll_t c, sobject_t o,
+ int collection_add(coll_t c, hobject_t o,
Context *onsafe=0) {
faker_lock.Lock();
fakecollections[c].insert(o);
return 0;
}
- int collection_remove(coll_t c, sobject_t o,
+ int collection_remove(coll_t c, hobject_t o,
Context *onsafe=0) {
faker_lock.Lock();
fakecollections[c].erase(o);
return fakecollections[c].empty();
}
- int collection_list(coll_t c, vector<sobject_t>& o) {
+ int collection_list(coll_t c, vector<hobject_t>& o) {
faker_lock.Lock();
int r = 0;
- for (set<sobject_t>::iterator p = fakecollections[c].begin();
+ for (set<hobject_t>::iterator p = fakecollections[c].begin();
p != fakecollections[c].end();
p++) {
o.push_back(*p);
Mutex faker_lock;
ObjectStore *store;
- hash_map<sobject_t, FakeAttrSet> fakeoattrs;
+ hash_map<hobject_t, FakeAttrSet> fakeoattrs;
hash_map<coll_t, FakeAttrSet> fakecattrs;
public:
FakeAttrs(ObjectStore *s) : faker_lock("FakeAttrs::faker_lock"), store(s) {}
- int setattr(coll_t cid, sobject_t oid, const char *name,
+ int setattr(coll_t cid, hobject_t oid, const char *name,
const void *value, size_t size,
Context *onsafe=0) {
faker_lock.Lock();
faker_lock.Unlock();
return r;
}
- int setattrs(coll_t cid, sobject_t oid, map<string,bufferptr>& aset) {
+ int setattrs(coll_t cid, hobject_t oid, map<string,bufferptr>& aset) {
faker_lock.Lock();
int r = fakeoattrs[oid].setattrs(aset);
faker_lock.Unlock();
return r;
}
- int getattr(coll_t cid, sobject_t oid, const char *name,
+ int getattr(coll_t cid, hobject_t oid, const char *name,
void *value, size_t size) {
faker_lock.Lock();
int r = fakeoattrs[oid].getattr(name, value, size);
faker_lock.Unlock();
return r;
}
- int getattr(coll_t cid, sobject_t oid, const char *name, bufferptr& bp) {
+ int getattr(coll_t cid, hobject_t oid, const char *name, bufferptr& bp) {
faker_lock.Lock();
int r = fakeoattrs[oid].getattr(name, bp);
faker_lock.Unlock();
return r;
}
- int getattrs(coll_t cid, sobject_t oid, map<string,bufferptr>& aset) {
+ int getattrs(coll_t cid, hobject_t oid, map<string,bufferptr>& aset) {
faker_lock.Lock();
int r = fakeoattrs[oid].getattrs(aset);
faker_lock.Unlock();
return r;
}
- int rmattr(coll_t cid, sobject_t oid, const char *name,
+ int rmattr(coll_t cid, hobject_t oid, const char *name,
Context *onsafe=0) {
faker_lock.Lock();
int r = fakeoattrs[oid].rmattr(name);
return r;
}
- int listattr(coll_t cid, sobject_t oid, char *attrs, size_t size) {
+ int listattr(coll_t cid, hobject_t oid, char *attrs, size_t size) {
faker_lock.Lock();
int r = fakeoattrs[oid].listattr(attrs,size);
faker_lock.Unlock();
}
/*
- * sorry, these are sentitive to the sobject_t and coll_t typing.
+ * sorry, these are sentitive to the hobject_t and coll_t typing.
*/
// 11111111112222222222333333333344444444445555555555
// 012345678901234567890123456789012345678901234567890123456789
// yyyyyyyyyyyyyyyy.zzzzzzzz.a_s
-int FileStore::append_oname(const sobject_t &oid, char *s, int len)
+int FileStore::append_oname(const hobject_t &oid, char *s, int len)
{
//assert(sizeof(oid) == 28);
char *end = s + len;
return size;
}
-bool FileStore::parse_object(char *s, sobject_t& o)
+bool FileStore::parse_object(char *s, hobject_t& o)
{
char *bar = s + strlen(s) - 1;
while (*bar != '_' &&
return snprintf(s, len, "%s/current/%s", basedir.c_str(), cid_str.c_str());
}
-int FileStore::lfn_get(coll_t cid, const sobject_t& oid, char *pathname, int len, char *lfn, int lfn_len, int *exist, int *is_lfn)
+int FileStore::lfn_get(coll_t cid, const hobject_t& oid, char *pathname, int len, char *lfn, int lfn_len, int *exist, int *is_lfn)
{
int i = 0;
char *filename;
return 0; // unreachable anyway
}
-int FileStore::lfn_find(coll_t cid, const sobject_t& oid, char *pathname, int len)
+int FileStore::lfn_find(coll_t cid, const hobject_t& oid, char *pathname, int len)
{
char long_fn[PATH_MAX];
int r, exist;
return -ENOENT;
return 0;
}
-int FileStore::lfn_getxattr(coll_t cid, const sobject_t& oid, const char *name, void *val, size_t size)
+int FileStore::lfn_getxattr(coll_t cid, const hobject_t& oid, const char *name, void *val, size_t size)
{
char new_fn[PATH_MAX];
int r;
return do_getxattr(new_fn, name, val, size);
}
-int FileStore::lfn_setxattr(coll_t cid, const sobject_t& oid, const char *name, const void *val, size_t size)
+int FileStore::lfn_setxattr(coll_t cid, const hobject_t& oid, const char *name, const void *val, size_t size)
{
char new_fn[PATH_MAX];
int r;
return do_setxattr(new_fn, name, val, size);
}
-int FileStore::lfn_removexattr(coll_t cid, const sobject_t& oid, const char *name)
+int FileStore::lfn_removexattr(coll_t cid, const hobject_t& oid, const char *name)
{
char new_fn[PATH_MAX];
int r;
return do_removexattr(new_fn, name);
}
-int FileStore::lfn_listxattr(coll_t cid, const sobject_t& oid, char *names, size_t len)
+int FileStore::lfn_listxattr(coll_t cid, const hobject_t& oid, char *names, size_t len)
{
char new_fn[PATH_MAX];
int r;
return do_listxattr(new_fn, names, len);
}
-int FileStore::lfn_truncate(coll_t cid, const sobject_t& oid, off_t length)
+int FileStore::lfn_truncate(coll_t cid, const hobject_t& oid, off_t length)
{
char new_fn[PATH_MAX];
int r;
return r;
}
-int FileStore::lfn_stat(coll_t cid, const sobject_t& oid, struct stat *buf)
+int FileStore::lfn_stat(coll_t cid, const hobject_t& oid, struct stat *buf)
{
char fn[PATH_MAX];
int r;
return 0;
}
-int FileStore::lfn_open(coll_t cid, const sobject_t& oid, int flags, mode_t mode)
+int FileStore::lfn_open(coll_t cid, const hobject_t& oid, int flags, mode_t mode)
{
char long_fn[PATH_MAX];
char short_fn[PATH_MAX];
return fd;
}
-int FileStore::lfn_open(coll_t cid, const sobject_t& oid, int flags)
+int FileStore::lfn_open(coll_t cid, const hobject_t& oid, int flags)
{
return lfn_open(cid, oid, flags, 0);
}
-int FileStore::lfn_link(coll_t c, coll_t cid, const sobject_t& o)
+int FileStore::lfn_link(coll_t c, coll_t cid, const hobject_t& o)
{
char long_fn[PATH_MAX];
char short_fn_old[PATH_MAX];
return 0;
}
-int FileStore::lfn_unlink(coll_t cid, const sobject_t& o)
+int FileStore::lfn_unlink(coll_t cid, const hobject_t& o)
{
char long_fn[PATH_MAX];
char short_fn[PATH_MAX];
case Transaction::OP_TOUCH:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
r = _touch(cid, oid);
}
break;
case Transaction::OP_WRITE:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
uint64_t off = t.get_length();
uint64_t len = t.get_length();
bufferlist bl;
case Transaction::OP_ZERO:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
uint64_t off = t.get_length();
uint64_t len = t.get_length();
r = _zero(cid, oid, off, len);
case Transaction::OP_TRIMCACHE:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
uint64_t off = t.get_length();
uint64_t len = t.get_length();
trim_from_cache(cid, oid, off, len);
case Transaction::OP_TRUNCATE:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
uint64_t off = t.get_length();
r = _truncate(cid, oid, off);
}
case Transaction::OP_REMOVE:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
r = _remove(cid, oid);
}
break;
case Transaction::OP_SETATTR:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
string name = t.get_attrname();
bufferlist bl;
t.get_bl(bl);
case Transaction::OP_SETATTRS:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
map<string, bufferptr> aset;
t.get_attrset(aset);
r = _setattrs(cid, oid, aset);
case Transaction::OP_RMATTR:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
string name = t.get_attrname();
r = _rmattr(cid, oid, name.c_str());
}
case Transaction::OP_RMATTRS:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
r = _rmattrs(cid, oid);
}
break;
case Transaction::OP_CLONE:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
- sobject_t noid = t.get_oid();
+ hobject_t oid = t.get_oid();
+ hobject_t noid = t.get_oid();
r = _clone(cid, oid, noid);
}
break;
case Transaction::OP_CLONERANGE:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
- sobject_t noid = t.get_oid();
+ hobject_t oid = t.get_oid();
+ hobject_t noid = t.get_oid();
uint64_t off = t.get_length();
uint64_t len = t.get_length();
r = _clone_range(cid, oid, noid, off, len, off);
case Transaction::OP_CLONERANGE2:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
- sobject_t noid = t.get_oid();
+ hobject_t oid = t.get_oid();
+ hobject_t noid = t.get_oid();
uint64_t srcoff = t.get_length();
uint64_t len = t.get_length();
uint64_t dstoff = t.get_length();
{
coll_t ocid = t.get_cid();
coll_t ncid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
r = _collection_add(ocid, ncid, oid);
}
break;
case Transaction::OP_COLL_REMOVE:
{
coll_t cid = t.get_cid();
- sobject_t oid = t.get_oid();
+ hobject_t oid = t.get_oid();
r = _collection_remove(cid, oid);
}
break;
// --------------------
// objects
-bool FileStore::exists(coll_t cid, const sobject_t& oid)
+bool FileStore::exists(coll_t cid, const hobject_t& oid)
{
struct stat st;
if (stat(cid, oid, &st) == 0)
return false;
}
-int FileStore::stat(coll_t cid, const sobject_t& oid, struct stat *st)
+int FileStore::stat(coll_t cid, const hobject_t& oid, struct stat *st)
{
int r = lfn_stat(cid, oid, st);
dout(10) << "stat " << cid << "/" << oid << " = " << r << " (size " << st->st_size << ")" << dendl;
return r;
}
-int FileStore::read(coll_t cid, const sobject_t& oid,
+int FileStore::read(coll_t cid, const hobject_t& oid,
uint64_t offset, size_t len, bufferlist& bl)
{
int got;
return got;
}
-int FileStore::fiemap(coll_t cid, const sobject_t& oid,
+int FileStore::fiemap(coll_t cid, const hobject_t& oid,
uint64_t offset, size_t len,
bufferlist& bl)
{
}
-int FileStore::_remove(coll_t cid, const sobject_t& oid)
+int FileStore::_remove(coll_t cid, const hobject_t& oid)
{
dout(15) << "remove " << cid << "/" << oid << dendl;
int r = lfn_unlink(cid, oid);
return r;
}
-int FileStore::_truncate(coll_t cid, const sobject_t& oid, uint64_t size)
+int FileStore::_truncate(coll_t cid, const hobject_t& oid, uint64_t size)
{
dout(15) << "truncate " << cid << "/" << oid << " size " << size << dendl;
int r = lfn_truncate(cid, oid, size);
}
-int FileStore::_touch(coll_t cid, const sobject_t& oid)
+int FileStore::_touch(coll_t cid, const hobject_t& oid)
{
dout(15) << "touch " << cid << "/" << oid << dendl;
return r;
}
-int FileStore::_write(coll_t cid, const sobject_t& oid,
+int FileStore::_write(coll_t cid, const hobject_t& oid,
uint64_t offset, size_t len,
const bufferlist& bl)
{
return r;
}
-int FileStore::_zero(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len)
+int FileStore::_zero(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len)
{
// write zeros.. yuck!
bufferptr bp(len);
return _write(cid, oid, offset, len, bl);
}
-int FileStore::_clone(coll_t cid, const sobject_t& oldoid, const sobject_t& newoid)
+int FileStore::_clone(coll_t cid, const hobject_t& oldoid, const hobject_t& newoid)
{
dout(15) << "clone " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << dendl;
return r;
}
-int FileStore::_clone_range(coll_t cid, const sobject_t& oldoid, const sobject_t& newoid,
+int FileStore::_clone_range(coll_t cid, const hobject_t& oldoid, const hobject_t& newoid,
uint64_t srcoff, uint64_t len, uint64_t dstoff)
{
dout(15) << "clone_range " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " " << srcoff << "~" << len << " to " << dstoff << dendl;
// attributes
// low-level attr helpers
-int FileStore::_getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr& bp)
+int FileStore::_getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr& bp)
{
char val[100];
int l = lfn_getxattr(cid, oid, name, val, sizeof(val));
}
// note that this is a clone of the method below.. any change here should be reflected there
-int FileStore::_getattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset, bool user_only)
+int FileStore::_getattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& aset, bool user_only)
{
// get attr list
char names1[100];
// objects
-int FileStore::getattr(coll_t cid, const sobject_t& oid, const char *name,
+int FileStore::getattr(coll_t cid, const hobject_t& oid, const char *name,
void *value, size_t size)
{
if (fake_attrs) return attrs.getattr(cid, oid, name, value, size);
return r;
}
-int FileStore::getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr &bp)
+int FileStore::getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr &bp)
{
if (fake_attrs) return attrs.getattr(cid, oid, name, bp);
return r;
}
-int FileStore::getattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset, bool user_only)
+int FileStore::getattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& aset, bool user_only)
{
if (fake_attrs) return attrs.getattrs(cid, oid, aset);
return r;
}
-int FileStore::_setattr(coll_t cid, const sobject_t& oid, const char *name,
+int FileStore::_setattr(coll_t cid, const hobject_t& oid, const char *name,
const void *value, size_t size)
{
if (fake_attrs) return attrs.setattr(cid, oid, name, value, size);
return r;
}
-int FileStore::_setattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset)
+int FileStore::_setattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& aset)
{
if (fake_attrs) return attrs.setattrs(cid, oid, aset);
}
-int FileStore::_rmattr(coll_t cid, const sobject_t& oid, const char *name)
+int FileStore::_rmattr(coll_t cid, const hobject_t& oid, const char *name)
{
if (fake_attrs) return attrs.rmattr(cid, oid, name);
return r;
}
-int FileStore::_rmattrs(coll_t cid, const sobject_t& oid)
+int FileStore::_rmattrs(coll_t cid, const hobject_t& oid)
{
//if (fake_attrs) return attrs.rmattrs(cid, oid);
// parse
if (de->d_name[0] == '.') continue;
//cout << " got object " << de->d_name << std::endl;
- sobject_t o;
+ hobject_t o;
if (parse_object(de->d_name, o)) {
empty = false;
break;
return empty;
}
-int FileStore::collection_list_partial(coll_t c, snapid_t seq, vector<sobject_t>& ls, int max_count,
+int FileStore::collection_list_partial(coll_t c, snapid_t seq, vector<hobject_t>& ls, int max_count,
collection_list_handle_t *handle)
{
if (fake_collections) return collections.collection_list(c, ls);
}
//cout << " got object " << de->d_name << std::endl;
lfn_translate(dir_name, de->d_name, new_name, sizeof(new_name));
- sobject_t o;
+ hobject_t o;
if (parse_object(new_name, o)) {
if (o.snap >= seq) {
ls.push_back(o);
}
-int FileStore::collection_list(coll_t c, vector<sobject_t>& ls)
+int FileStore::collection_list(coll_t c, vector<hobject_t>& ls)
{
if (fake_collections) return collections.collection_list(c, ls);
return -errno;
// first, build (ino, object) list
- vector< pair<ino_t,sobject_t> > inolist;
+ vector< pair<ino_t,hobject_t> > inolist;
struct dirent *de;
while (::readdir_r(dir, (struct dirent*)buf, &de) == 0) {
if (de->d_name[0] == '.')
continue;
//cout << " got object " << de->d_name << std::endl;
- sobject_t o;
+ hobject_t o;
lfn_translate(dir_name, de->d_name, new_name, sizeof(new_name));
if (parse_object(new_name, o)) {
- inolist.push_back(pair<ino_t,sobject_t>(de->d_ino, o));
+ inolist.push_back(pair<ino_t,hobject_t>(de->d_ino, o));
ls.push_back(o);
}
}
// build final list
ls.resize(inolist.size());
int i = 0;
- for (vector< pair<ino_t,sobject_t> >::iterator p = inolist.begin(); p != inolist.end(); p++)
+ for (vector< pair<ino_t,hobject_t> >::iterator p = inolist.begin(); p != inolist.end(); p++)
ls[i++].swap(p->second);
dout(10) << "collection_list " << c << " = 0 (" << ls.size() << " objects)" << dendl;
}
-int FileStore::_collection_add(coll_t c, coll_t cid, const sobject_t& o)
+int FileStore::_collection_add(coll_t c, coll_t cid, const hobject_t& o)
{
if (fake_collections) return collections.collection_add(c, o);
return r;
}
-int FileStore::_collection_remove(coll_t c, const sobject_t& o)
+int FileStore::_collection_remove(coll_t c, const hobject_t& o)
{
if (fake_collections) return collections.collection_remove(c, o);
Finisher ondisk_finisher;
// helper fns
- int append_oname(const sobject_t &oid, char *s, int len);
+ int append_oname(const hobject_t &oid, char *s, int len);
int get_cdir(coll_t cid, char *s, int len);
- bool parse_object(char *s, sobject_t& o);
+ bool parse_object(char *s, hobject_t& o);
int lock_fsid();
void start_logger(int whoami, utime_t tare);
void stop_logger();
- int lfn_get(coll_t cid, const sobject_t& oid, char *pathname, int len, char *lfn, int lfn_len, int *exist, int *is_lfn);
- int lfn_find(coll_t cid, const sobject_t& oid, char *pathname, int len);
- int lfn_getxattr(coll_t cid, const sobject_t& oid, const char *name, void *val, size_t size);
- int lfn_setxattr(coll_t cid, const sobject_t& oid, const char *name, const void *val, size_t size);
- int lfn_removexattr(coll_t cid, const sobject_t& oid, const char *name);
- int lfn_listxattr(coll_t cid, const sobject_t& oid, char *names, size_t len);
- int lfn_truncate(coll_t cid, const sobject_t& oid, off_t length);
- int lfn_stat(coll_t cid, const sobject_t& oid, struct stat *buf);
- int lfn_open(coll_t cid, const sobject_t& oid, int flags, mode_t mode);
- int lfn_open(coll_t cid, const sobject_t& oid, int flags);
- int lfn_link(coll_t c, coll_t cid, const sobject_t& o) ;
- int lfn_unlink(coll_t cid, const sobject_t& o);
+ int lfn_get(coll_t cid, const hobject_t& oid, char *pathname, int len, char *lfn, int lfn_len, int *exist, int *is_lfn);
+ int lfn_find(coll_t cid, const hobject_t& oid, char *pathname, int len);
+ int lfn_getxattr(coll_t cid, const hobject_t& oid, const char *name, void *val, size_t size);
+ int lfn_setxattr(coll_t cid, const hobject_t& oid, const char *name, const void *val, size_t size);
+ int lfn_removexattr(coll_t cid, const hobject_t& oid, const char *name);
+ int lfn_listxattr(coll_t cid, const hobject_t& oid, char *names, size_t len);
+ int lfn_truncate(coll_t cid, const hobject_t& oid, off_t length);
+ int lfn_stat(coll_t cid, const hobject_t& oid, struct stat *buf);
+ int lfn_open(coll_t cid, const hobject_t& oid, int flags, mode_t mode);
+ int lfn_open(coll_t cid, const hobject_t& oid, int flags);
+ int lfn_link(coll_t c, coll_t cid, const hobject_t& o) ;
+ int lfn_unlink(coll_t cid, const hobject_t& o);
public:
FileStore(const std::string &base, const std::string &jdev);
// ------------------
// objects
- int pick_object_revision_lt(sobject_t& oid) {
+ int pick_object_revision_lt(hobject_t& oid) {
return 0;
}
- bool exists(coll_t cid, const sobject_t& oid);
- int stat(coll_t cid, const sobject_t& oid, struct stat *st);
- int read(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
- int fiemap(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
-
- int _touch(coll_t cid, const sobject_t& oid);
- int _write(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, const bufferlist& bl);
- int _zero(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len);
- int _truncate(coll_t cid, const sobject_t& oid, uint64_t size);
- int _clone(coll_t cid, const sobject_t& oldoid, const sobject_t& newoid);
- int _clone_range(coll_t cid, const sobject_t& oldoid, const sobject_t& newoid, uint64_t srcoff, uint64_t len, uint64_t dstoff);
+ bool exists(coll_t cid, const hobject_t& oid);
+ int stat(coll_t cid, const hobject_t& oid, struct stat *st);
+ int read(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
+ int fiemap(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
+
+ int _touch(coll_t cid, const hobject_t& oid);
+ int _write(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, const bufferlist& bl);
+ int _zero(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len);
+ int _truncate(coll_t cid, const hobject_t& oid, uint64_t size);
+ int _clone(coll_t cid, const hobject_t& oldoid, const hobject_t& newoid);
+ int _clone_range(coll_t cid, const hobject_t& oldoid, const hobject_t& newoid, uint64_t srcoff, uint64_t len, uint64_t dstoff);
int _do_clone_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff);
int _do_copy_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff);
- int _remove(coll_t cid, const sobject_t& oid);
+ int _remove(coll_t cid, const hobject_t& oid);
void _start_sync();
int snapshot(const string& name);
// attrs
- int getattr(coll_t cid, const sobject_t& oid, const char *name, void *value, size_t size);
- int getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr &bp);
- int getattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset, bool user_only = false);
+ int getattr(coll_t cid, const hobject_t& oid, const char *name, void *value, size_t size);
+ int getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr &bp);
+ int getattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& aset, bool user_only = false);
- int _getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr& bp);
- int _getattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset, bool user_only = false) ;
+ int _getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr& bp);
+ int _getattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& aset, bool user_only = false) ;
int _getattr(const char *fn, const char *name, bufferptr& bp);
int _getattrs(const char *fn, map<string,bufferptr>& aset, bool user_only = false);
- int _setattr(coll_t cid, const sobject_t& oid, const char *name, const void *value, size_t size);
- int _setattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset);
- int _rmattr(coll_t cid, const sobject_t& oid, const char *name);
- int _rmattrs(coll_t cid, const sobject_t& oid);
+ int _setattr(coll_t cid, const hobject_t& oid, const char *name, const void *value, size_t size);
+ int _setattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& aset);
+ int _rmattr(coll_t cid, const hobject_t& oid, const char *name);
+ int _rmattrs(coll_t cid, const hobject_t& oid);
int collection_getattr(coll_t c, const char *name, void *value, size_t size);
int collection_getattr(coll_t c, const char *name, bufferlist& bl);
int collection_stat(coll_t c, struct stat *st);
bool collection_exists(coll_t c);
bool collection_empty(coll_t c);
- int collection_list_partial(coll_t c, snapid_t seq, vector<sobject_t>& o, int count, collection_list_handle_t *handle);
- int collection_list(coll_t c, vector<sobject_t>& o);
+ int collection_list_partial(coll_t c, snapid_t seq, vector<hobject_t>& o, int count, collection_list_handle_t *handle);
+ int collection_list(coll_t c, vector<hobject_t>& o);
int _create_collection(coll_t c);
int _destroy_collection(coll_t c);
- int _collection_add(coll_t c, coll_t ocid, const sobject_t& o);
- int _collection_remove(coll_t c, const sobject_t& o);
+ int _collection_add(coll_t c, coll_t ocid, const hobject_t& o);
+ int _collection_remove(coll_t c, const hobject_t& o);
- void trim_from_cache(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) {}
- int is_cached(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) { return -1; }
+ void trim_from_cache(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) {}
+ int is_cached(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) { return -1; }
};
#endif
p = tbl.begin();
::decode(bl, p);
}
- sobject_t get_oid() {
+ hobject_t get_oid() {
if (p.get_off() == 0)
p = tbl.begin();
- sobject_t soid;
+ hobject_t soid;
::decode(soid, p);
return soid;
}
::encode(op, tbl);
ops++;
}
- void touch(coll_t cid, const sobject_t& oid) {
+ void touch(coll_t cid, const hobject_t& oid) {
__u32 op = OP_TOUCH;
::encode(op, tbl);
::encode(cid, tbl);
::encode(oid, tbl);
ops++;
}
- void write(coll_t cid, const sobject_t& oid, uint64_t off, uint64_t len, const bufferlist& data) {
+ void write(coll_t cid, const hobject_t& oid, uint64_t off, uint64_t len, const bufferlist& data) {
__u32 op = OP_WRITE;
::encode(op, tbl);
::encode(cid, tbl);
::encode(data, tbl);
ops++;
}
- void zero(coll_t cid, const sobject_t& oid, uint64_t off, uint64_t len) {
+ void zero(coll_t cid, const hobject_t& oid, uint64_t off, uint64_t len) {
__u32 op = OP_ZERO;
::encode(op, tbl);
::encode(cid, tbl);
::encode(len, tbl);
ops++;
}
- void trim_from_cache(coll_t cid, const sobject_t& oid, uint64_t off, uint64_t len) {
+ void trim_from_cache(coll_t cid, const hobject_t& oid, uint64_t off, uint64_t len) {
__u32 op = OP_TRIMCACHE;
::encode(op, tbl);
::encode(cid, tbl);
::encode(len, tbl);
ops++;
}
- void truncate(coll_t cid, const sobject_t& oid, uint64_t off) {
+ void truncate(coll_t cid, const hobject_t& oid, uint64_t off) {
__u32 op = OP_TRUNCATE;
::encode(op, tbl);
::encode(cid, tbl);
::encode(off, tbl);
ops++;
}
- void remove(coll_t cid, const sobject_t& oid) {
+ void remove(coll_t cid, const hobject_t& oid) {
__u32 op = OP_REMOVE;
::encode(op, tbl);
::encode(cid, tbl);
::encode(oid, tbl);
ops++;
}
- void setattr(coll_t cid, const sobject_t& oid, const char* name, const void* val, int len) {
+ void setattr(coll_t cid, const hobject_t& oid, const char* name, const void* val, int len) {
string n(name);
bufferlist bl;
bl.append((char*)val, len);
setattr(cid, oid, n, tbl);
}
- void setattr(coll_t cid, const sobject_t& oid, const char* name, bufferlist& val) {
+ void setattr(coll_t cid, const hobject_t& oid, const char* name, bufferlist& val) {
string n(name);
setattr(cid, oid, n, val);
}
- void setattr(coll_t cid, const sobject_t& oid, const string& s, bufferlist& val) {
+ void setattr(coll_t cid, const hobject_t& oid, const string& s, bufferlist& val) {
__u32 op = OP_SETATTR;
::encode(op, tbl);
::encode(cid, tbl);
::encode(val, tbl);
ops++;
}
- void setattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& attrset) {
+ void setattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& attrset) {
__u32 op = OP_SETATTRS;
::encode(op, tbl);
::encode(cid, tbl);
::encode(attrset, tbl);
ops++;
}
- void rmattr(coll_t cid, const sobject_t& oid, const char *name) {
+ void rmattr(coll_t cid, const hobject_t& oid, const char *name) {
string n(name);
rmattr(cid, oid, n);
}
- void rmattr(coll_t cid, const sobject_t& oid, const string& s) {
+ void rmattr(coll_t cid, const hobject_t& oid, const string& s) {
__u32 op = OP_RMATTR;
::encode(op, tbl);
::encode(cid, tbl);
::encode(s, tbl);
ops++;
}
- void rmattrs(coll_t cid, const sobject_t& oid) {
+ void rmattrs(coll_t cid, const hobject_t& oid) {
__u32 op = OP_RMATTR;
::encode(op, tbl);
::encode(cid, tbl);
::encode(oid, tbl);
ops++;
}
- void clone(coll_t cid, const sobject_t& oid, sobject_t noid) {
+ void clone(coll_t cid, const hobject_t& oid, hobject_t noid) {
__u32 op = OP_CLONE;
::encode(op, tbl);
::encode(cid, tbl);
::encode(noid, tbl);
ops++;
}
- void clone_range(coll_t cid, const sobject_t& oid, sobject_t noid,
+ void clone_range(coll_t cid, const hobject_t& oid, hobject_t noid,
uint64_t srcoff, uint64_t srclen, uint64_t dstoff) {
__u32 op = OP_CLONERANGE2;
::encode(op, tbl);
::encode(cid, tbl);
ops++;
}
- void collection_add(coll_t cid, coll_t ocid, const sobject_t& oid) {
+ void collection_add(coll_t cid, coll_t ocid, const hobject_t& oid) {
__u32 op = OP_COLL_ADD;
::encode(op, tbl);
::encode(cid, tbl);
::encode(oid, tbl);
ops++;
}
- void collection_remove(coll_t cid, const sobject_t& oid) {
+ void collection_remove(coll_t cid, const hobject_t& oid) {
__u32 op = OP_COLL_REMOVE;
::encode(op, tbl);
::encode(cid, tbl);
virtual int statfs(struct statfs *buf) = 0;
// objects
- virtual bool exists(coll_t cid, const sobject_t& oid) = 0; // useful?
- virtual int stat(coll_t cid, const sobject_t& oid, struct stat *st) = 0; // struct stat?
- virtual int read(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0;
- virtual int fiemap(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0;
+ virtual bool exists(coll_t cid, const hobject_t& oid) = 0; // useful?
+ virtual int stat(coll_t cid, const hobject_t& oid, struct stat *st) = 0; // struct stat?
+ virtual int read(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0;
+ virtual int fiemap(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0;
/*
- virtual int _remove(coll_t cid, sobject_t oid) = 0;
- virtual int _truncate(coll_t cid, sobject_t oid, uint64_t size) = 0;
- virtual int _write(coll_t cid, sobject_t oid, uint64_t offset, size_t len, const bufferlist& bl) = 0;
- virtual int _zero(coll_t cid, sobject_t oid, uint64_t offset, size_t len) {
+ virtual int _remove(coll_t cid, hobject_t oid) = 0;
+ virtual int _truncate(coll_t cid, hobject_t oid, uint64_t size) = 0;
+ virtual int _write(coll_t cid, hobject_t oid, uint64_t offset, size_t len, const bufferlist& bl) = 0;
+ virtual int _zero(coll_t cid, hobject_t oid, uint64_t offset, size_t len) {
// write zeros.. yuck!
bufferptr bp(len);
bufferlist bl;
}
*/
- virtual void trim_from_cache(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) = 0; //{ }
- virtual int is_cached(coll_t cid, const sobject_t& oid, uint64_t offset, size_t len) = 0; //{ return -1; }
+ virtual void trim_from_cache(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) = 0; //{ }
+ virtual int is_cached(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len) = 0; //{ return -1; }
- virtual int getattr(coll_t cid, const sobject_t& oid, const char *name, void *value, size_t size) = 0;
- virtual int getattr(coll_t cid, const sobject_t& oid, const char *name, bufferptr& value) = 0;
- int getattr(coll_t cid, const sobject_t& oid, const char *name, bufferlist& value) {
+ virtual int getattr(coll_t cid, const hobject_t& oid, const char *name, void *value, size_t size) = 0;
+ virtual int getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr& value) = 0;
+ int getattr(coll_t cid, const hobject_t& oid, const char *name, bufferlist& value) {
bufferptr bp;
int r = getattr(cid, oid, name, bp);
if (bp.length())
value.push_back(bp);
return r;
}
- virtual int getattrs(coll_t cid, const sobject_t& oid, map<string,bufferptr>& aset, bool user_only = false) {return 0;};
+ virtual int getattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& aset, bool user_only = false) {return 0;};
/*
- virtual int _setattr(coll_t cid, sobject_t oid, const char *name, const void *value, size_t size) = 0;
- virtual int _setattr(coll_t cid, sobject_t oid, const char *name, const bufferptr &bp) {
+ virtual int _setattr(coll_t cid, hobject_t oid, const char *name, const void *value, size_t size) = 0;
+ virtual int _setattr(coll_t cid, hobject_t oid, const char *name, const bufferptr &bp) {
return _setattr(cid, oid, name, bp.c_str(), bp.length());
}
- virtual int _setattrs(coll_t cid, sobject_t oid, map<string,bufferptr>& aset) = 0;
- virtual int _rmattr(coll_t cid, sobject_t oid, const char *name) {return 0;}
- virtual int _clone(coll_t cid, sobject_t oid, sobject_t noid) {
+ virtual int _setattrs(coll_t cid, hobject_t oid, map<string,bufferptr>& aset) = 0;
+ virtual int _rmattr(coll_t cid, hobject_t oid, const char *name) {return 0;}
+ virtual int _clone(coll_t cid, hobject_t oid, hobject_t noid) {
return -1;
}
*/
virtual int collection_getattr(coll_t cid, const char *name, bufferlist& bl) = 0;
virtual int collection_getattrs(coll_t cid, map<string,bufferptr> &aset) = 0;
virtual bool collection_empty(coll_t c) = 0;
- virtual int collection_list_partial(coll_t c, snapid_t seq, vector<sobject_t>& o, int count, collection_list_handle_t *handle) = 0;
- virtual int collection_list(coll_t c, vector<sobject_t>& o) = 0;
+ virtual int collection_list_partial(coll_t c, snapid_t seq, vector<hobject_t>& o, int count, collection_list_handle_t *handle) = 0;
+ virtual int collection_list(coll_t c, vector<hobject_t>& o) = 0;
/*
virtual int _create_collection(coll_t c) = 0;
virtual int _destroy_collection(coll_t c) = 0;
- virtual int _collection_add(coll_t c, coll_t ocid, sobject_t o) = 0;
- virtual int _collection_remove(coll_t c, sobject_t o) = 0;
+ virtual int _collection_add(coll_t c, coll_t ocid, hobject_t o) = 0;
+ virtual int _collection_remove(coll_t c, hobject_t o) = 0;
virtual int _collection_setattr(coll_t cid, const char *name,
const void *value, size_t size) = 0;
virtual int _collection_rmattr(coll_t cid, const char *name) = 0;