diff options
author | David Zafman <david.zafman@inktank.com> | 2013-09-23 13:02:16 -0700 |
---|---|---|
committer | David Zafman <david.zafman@inktank.com> | 2013-09-23 13:12:42 -0700 |
commit | 4f7526a785692795ee29f7101b8b18482b4c6e11 (patch) | |
tree | b77c9ccdcae405d4980168274defb813595a91d4 /src/os/ObjectStore.cc | |
parent | 164149209dec088c6255fb9ab79f65c152f19ba5 (diff) | |
download | ceph-wip-5862.tar.gz |
Temporary collection_list* funcs in ObjectStore to do ghobject_t to hobject_t conversionwip-5862
Signed-off-by: David Zafman <david.zafman@inktank.com>
Diffstat (limited to 'src/os/ObjectStore.cc')
-rw-r--r-- | src/os/ObjectStore.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/os/ObjectStore.cc b/src/os/ObjectStore.cc index 97c858b6773..84549821aff 100644 --- a/src/os/ObjectStore.cc +++ b/src/os/ObjectStore.cc @@ -15,6 +15,7 @@ #include <tr1/memory> #include "ObjectStore.h" #include "common/Formatter.h" +#include "FileStore.h" ostream& operator<<(ostream& out, const ObjectStore::Sequencer& s) { @@ -497,3 +498,47 @@ void ObjectStore::Transaction::generate_test_instances(list<ObjectStore::Transac o.push_back(t); } +int ObjectStore::collection_list(coll_t c, vector<hobject_t>& o) +{ + vector<ghobject_t> go; + FileStore *fs = dynamic_cast<FileStore * >(this); + int ret = fs->collection_list(c, go); + if (ret == 0) { + o.reserve(go.size()); + for (vector<ghobject_t>::iterator i = go.begin(); i != go.end() ; i++) + o.push_back(i->hobj); + } + return ret; +} + +int ObjectStore::collection_list_partial(coll_t c, hobject_t start, + int min, int max, snapid_t snap, + vector<hobject_t> *ls, hobject_t *next) +{ + vector<ghobject_t> go; + ghobject_t gnext, gstart(start); + FileStore *fs = dynamic_cast<FileStore * >(this); + int ret = fs->collection_list_partial(c, gstart, min, max, snap, &go, &gnext); + if (ret == 0) { + *next = gnext.hobj; + ls->reserve(go.size()); + for (vector<ghobject_t>::iterator i = go.begin(); i != go.end() ; i++) + ls->push_back(i->hobj); + } + return ret; +} + +int ObjectStore::collection_list_range(coll_t c, hobject_t start, hobject_t end, + snapid_t seq, vector<hobject_t> *ls) +{ + vector<ghobject_t> go; + ghobject_t gstart(start), gend(end); + FileStore *fs = dynamic_cast<FileStore * >(this); + int ret = fs->collection_list_range(c, gstart, gend, seq, &go); + if (ret == 0) { + ls->reserve(go.size()); + for (vector<ghobject_t>::iterator i = go.begin(); i != go.end() ; i++) + ls->push_back(i->hobj); + } + return ret; +} |