diff options
author | Samuel Just <sam.just@dreamhost.com> | 2012-05-29 21:47:50 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2012-06-05 16:09:50 -0700 |
commit | 875bec29a42ddc2acb057af83cfa564421ddea85 (patch) | |
tree | 6cdafc3ca7be8b96d033ca809885c9704796b2f1 /src/os | |
parent | ebfde20aab0396f393295258944b6e3c3c396077 (diff) | |
download | ceph-875bec29a42ddc2acb057af83cfa564421ddea85.tar.gz |
DBObjectMap,FileStore: Remove IndexedPath parameters from ObjectMap
IndexedPath parameters are no longer needed for getting the object
collections or for supporting the TMAP implementation.
Signed-off-by: Samuel Just <sam.just@inktank.com>
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/DBObjectMap.cc | 25 | ||||
-rw-r--r-- | src/os/DBObjectMap.h | 23 | ||||
-rw-r--r-- | src/os/FileStore.cc | 40 | ||||
-rw-r--r-- | src/os/ObjectMap.h | 25 |
4 files changed, 31 insertions, 82 deletions
diff --git a/src/os/DBObjectMap.cc b/src/os/DBObjectMap.cc index c40d14c61cf..da2f3cd938d 100644 --- a/src/os/DBObjectMap.cc +++ b/src/os/DBObjectMap.cc @@ -12,7 +12,6 @@ #include <vector> #include <tr1/memory> -#include "IndexManager.h" #include "ObjectMap.h" #include "KeyValueDB.h" #include "DBObjectMap.h" @@ -313,8 +312,7 @@ int DBObjectMap::DBObjectMapIteratorImpl::init() } ObjectMap::ObjectMapIterator DBObjectMap::get_iterator( - const hobject_t &hoid, - Index index) + const hobject_t &hoid) { Header header = lookup_map_header(hoid); if (!header) @@ -500,7 +498,6 @@ int DBObjectMap::DBObjectMapIteratorImpl::status() } int DBObjectMap::set_keys(const hobject_t &hoid, - Index index, const map<string, bufferlist> &set) { KeyValueDB::Transaction t = db->get_transaction(); @@ -514,7 +511,6 @@ int DBObjectMap::set_keys(const hobject_t &hoid, } int DBObjectMap::set_header(const hobject_t &hoid, - Index index, const bufferlist &bl) { KeyValueDB::Transaction t = db->get_transaction(); @@ -534,7 +530,6 @@ void DBObjectMap::_set_header(Header header, const bufferlist &bl, } int DBObjectMap::get_header(const hobject_t &hoid, - Index index, bufferlist *bl) { Header header = lookup_map_header(hoid); @@ -569,8 +564,7 @@ int DBObjectMap::_get_header(Header header, return 0; } -int DBObjectMap::clear(const hobject_t &hoid, - Index index) +int DBObjectMap::clear(const hobject_t &hoid) { KeyValueDB::Transaction t = db->get_transaction(); Header header = lookup_map_header(hoid); @@ -689,7 +683,6 @@ int DBObjectMap::need_parent(DBObjectMapIterator iter) } int DBObjectMap::rm_keys(const hobject_t &hoid, - Index index, const set<string> &to_clear) { Header header = lookup_map_header(hoid); @@ -762,7 +755,6 @@ int DBObjectMap::rm_keys(const hobject_t &hoid, } int DBObjectMap::get(const hobject_t &hoid, - Index index, bufferlist *_header, map<string, bufferlist> *out) { @@ -780,13 +772,12 @@ int DBObjectMap::get(const hobject_t &hoid, } int DBObjectMap::get_keys(const hobject_t &hoid, - Index index, set<string> *keys) { Header header = lookup_map_header(hoid); if (!header) return -ENOENT; - ObjectMapIterator iter = get_iterator(hoid, index); + ObjectMapIterator iter = get_iterator(hoid); for (; iter->valid(); iter->next()) { if (iter->status()) return iter->status(); @@ -818,7 +809,6 @@ int DBObjectMap::scan(Header header, } int DBObjectMap::get_values(const hobject_t &hoid, - Index index, const set<string> &keys, map<string, bufferlist> *out) { @@ -829,7 +819,6 @@ int DBObjectMap::get_values(const hobject_t &hoid, } int DBObjectMap::check_keys(const hobject_t &hoid, - Index index, const set<string> &keys, set<string> *out) { @@ -840,7 +829,6 @@ int DBObjectMap::check_keys(const hobject_t &hoid, } int DBObjectMap::get_xattrs(const hobject_t &hoid, - Index index, const set<string> &to_get, map<string, bufferlist> *out) { @@ -851,7 +839,6 @@ int DBObjectMap::get_xattrs(const hobject_t &hoid, } int DBObjectMap::get_all_xattrs(const hobject_t &hoid, - Index index, set<string> *out) { Header header = lookup_map_header(hoid); @@ -866,7 +853,6 @@ int DBObjectMap::get_all_xattrs(const hobject_t &hoid, } int DBObjectMap::set_xattrs(const hobject_t &hoid, - Index index, const map<string, bufferlist> &to_set) { KeyValueDB::Transaction t = db->get_transaction(); @@ -878,7 +864,6 @@ int DBObjectMap::set_xattrs(const hobject_t &hoid, } int DBObjectMap::remove_xattrs(const hobject_t &hoid, - Index index, const set<string> &to_remove) { KeyValueDB::Transaction t = db->get_transaction(); @@ -890,9 +875,7 @@ int DBObjectMap::remove_xattrs(const hobject_t &hoid, } int DBObjectMap::clone(const hobject_t &hoid, - Index index, - const hobject_t &target, - Index target_index) + const hobject_t &target) { if (hoid == target) return 0; diff --git a/src/os/DBObjectMap.h b/src/os/DBObjectMap.h index f9e143fd33b..1ff87f1289d 100644 --- a/src/os/DBObjectMap.h +++ b/src/os/DBObjectMap.h @@ -12,7 +12,6 @@ #include <tr1/memory> #include <boost/scoped_ptr.hpp> -#include "IndexManager.h" #include "ObjectMap.h" #include "KeyValueDB.h" #include "osd/osd_types.h" @@ -76,90 +75,75 @@ public: int set_keys( const hobject_t &hoid, - Index index, const map<string, bufferlist> &set ); int set_header( const hobject_t &hoid, - Index index, const bufferlist &bl ); int get_header( const hobject_t &hoid, - Index index, bufferlist *bl ); int clear( - const hobject_t &hoid, - Index index + const hobject_t &hoid ); int rm_keys( const hobject_t &hoid, - Index index, const set<string> &to_clear ); int get( const hobject_t &hoid, - Index index, bufferlist *header, map<string, bufferlist> *out ); int get_keys( const hobject_t &hoid, - Index index, set<string> *keys ); int get_values( const hobject_t &hoid, - Index index, const set<string> &keys, map<string, bufferlist> *out ); int check_keys( const hobject_t &hoid, - Index index, const set<string> &keys, set<string> *out ); int get_xattrs( const hobject_t &hoid, - Index index, const set<string> &to_get, map<string, bufferlist> *out ); int get_all_xattrs( const hobject_t &hoid, - Index index, set<string> *out ); int set_xattrs( const hobject_t &hoid, - Index index, const map<string, bufferlist> &to_set ); int remove_xattrs( const hobject_t &hoid, - Index index, const set<string> &to_remove ); int clone( const hobject_t &hoid, - Index index, - const hobject_t &target, - Index target_index + const hobject_t &target ); /// Read initial state from backing store @@ -174,8 +158,7 @@ public: /// Ensure that all previous operations are durable int sync(); - ObjectMapIterator get_iterator(const hobject_t &hoid, - Index index); + ObjectMapIterator get_iterator(const hobject_t &hoid); static const string USER_PREFIX; static const string XATTR_PREFIX; diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index ba2df957996..540ecdcdaa3 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -385,7 +385,7 @@ int FileStore::lfn_unlink(coll_t cid, const hobject_t& o) return -errno; } if (st.st_nlink == 1) { - r = object_map->clear(o, path->get_index()); + r = object_map->clear(o); if (r < 0 && r != -ENOENT) return r; } @@ -3249,7 +3249,7 @@ int FileStore::_clone(coll_t cid, const hobject_t& oldoid, const hobject_t& newo goto out3; } dout(20) << "objectmap clone" << dendl; - r = object_map->clone(oldoid, from->get_index(), newoid, to->get_index()); + r = object_map->clone(oldoid, newoid); if (r < 0 && r != -ENOENT) goto out3; } @@ -4028,7 +4028,7 @@ int FileStore::getattr(coll_t cid, const hobject_t& oid, const char *name, buffe dout(10) << __func__ << " could not get index r = " << r << dendl; return r; } - r = object_map->get_xattrs(oid, index, to_get, &got); + r = object_map->get_xattrs(oid, to_get, &got); if (r < 0 && r != -ENOENT) { dout(10) << __func__ << " get_xattrs err r =" << r << dendl; return r; @@ -4058,12 +4058,12 @@ int FileStore::getattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr>& dout(10) << __func__ << " could not get index r = " << r << dendl; return r; } - r = object_map->get_all_xattrs(oid, index, &omap_attrs); + r = object_map->get_all_xattrs(oid, &omap_attrs); if (r < 0 && r != -ENOENT) { dout(10) << __func__ << " could not get omap_attrs r = " << r << dendl; return r; } - r = object_map->get_xattrs(oid, index, omap_attrs, &omap_aset); + r = object_map->get_xattrs(oid, omap_attrs, &omap_aset); if (r < 0 && r != -ENOENT) { dout(10) << __func__ << " could not get omap_attrs r = " << r << dendl; return r; @@ -4151,12 +4151,12 @@ int FileStore::_setattrs(coll_t cid, const hobject_t& oid, map<string,bufferptr> dout(10) << __func__ << " could not get index r = " << r << dendl; return r; } - r = object_map->remove_xattrs(oid, index, omap_remove); + r = object_map->remove_xattrs(oid, omap_remove); if (r < 0 && r != -ENOENT) { dout(10) << __func__ << " could not remove_xattrs r = " << r << dendl; return r; } - r = object_map->set_xattrs(oid, index, omap_set); + r = object_map->set_xattrs(oid, omap_set); if (r < 0) { dout(10) << __func__ << " could not set_xattrs r = " << r << dendl; return r; @@ -4182,7 +4182,7 @@ int FileStore::_rmattr(coll_t cid, const hobject_t& oid, const char *name) } set<string> to_remove; to_remove.insert(string(name)); - r = object_map->remove_xattrs(oid, index, to_remove); + r = object_map->remove_xattrs(oid, to_remove); if (r < 0 && r != -ENOENT) { dout(10) << __func__ << " could not remove_xattrs index r = " << r << dendl; return r; @@ -4215,12 +4215,12 @@ int FileStore::_rmattrs(coll_t cid, const hobject_t& oid) dout(10) << __func__ << " could not get index r = " << r << dendl; return r; } - r = object_map->get_all_xattrs(oid, index, &omap_attrs); + r = object_map->get_all_xattrs(oid, &omap_attrs); if (r < 0 && r != -ENOENT) { dout(10) << __func__ << " could not get omap_attrs r = " << r << dendl; return r; } - r = object_map->remove_xattrs(oid, index, omap_attrs); + r = object_map->remove_xattrs(oid, omap_attrs); if (r < 0 && r != -ENOENT) { dout(10) << __func__ << " could not remove omap_attrs r = " << r << dendl; return r; @@ -4486,7 +4486,7 @@ int FileStore::omap_get(coll_t c, const hobject_t &hoid, int r = lfn_find(c, hoid, &path); if (r < 0) return r; - r = object_map->get(hoid, path->get_index(), header, out); + r = object_map->get(hoid, header, out); if (r < 0 && r != -ENOENT) return r; return 0; @@ -4500,7 +4500,7 @@ int FileStore::omap_get_header(coll_t c, const hobject_t &hoid, int r = lfn_find(c, hoid, &path); if (r < 0) return r; - r = object_map->get_header(hoid, path->get_index(), bl); + r = object_map->get_header(hoid, bl); if (r < 0 && r != -ENOENT) return r; return 0; @@ -4513,7 +4513,7 @@ int FileStore::omap_get_keys(coll_t c, const hobject_t &hoid, set<string> *keys) int r = lfn_find(c, hoid, &path); if (r < 0) return r; - r = object_map->get_keys(hoid, path->get_index(), keys); + r = object_map->get_keys(hoid, keys); if (r < 0 && r != -ENOENT) return r; return 0; @@ -4528,7 +4528,7 @@ int FileStore::omap_get_values(coll_t c, const hobject_t &hoid, int r = lfn_find(c, hoid, &path); if (r < 0) return r; - r = object_map->get_values(hoid, path->get_index(), keys, out); + r = object_map->get_values(hoid, keys, out); if (r < 0 && r != -ENOENT) return r; return 0; @@ -4543,7 +4543,7 @@ int FileStore::omap_check_keys(coll_t c, const hobject_t &hoid, int r = lfn_find(c, hoid, &path); if (r < 0) return r; - r = object_map->check_keys(hoid, path->get_index(), keys, out); + r = object_map->check_keys(hoid, keys, out); if (r < 0 && r != -ENOENT) return r; return 0; @@ -4557,7 +4557,7 @@ ObjectMap::ObjectMapIterator FileStore::get_omap_iterator(coll_t c, int r = lfn_find(c, hoid, &path); if (r < 0) return ObjectMap::ObjectMapIterator(); - return object_map->get_iterator(hoid, path->get_index()); + return object_map->get_iterator(hoid); } int FileStore::_create_collection(coll_t c) @@ -4661,7 +4661,7 @@ int FileStore::_omap_clear(coll_t cid, const hobject_t &hoid) { int r = lfn_find(cid, hoid, &path); if (r < 0) return r; - r = object_map->clear(hoid, path->get_index()); + r = object_map->clear(hoid); if (r < 0 && r != -ENOENT) return r; return 0; @@ -4673,7 +4673,7 @@ int FileStore::_omap_setkeys(coll_t cid, const hobject_t &hoid, int r = lfn_find(cid, hoid, &path); if (r < 0) return r; - return object_map->set_keys(hoid, path->get_index(), aset); + return object_map->set_keys(hoid, aset); } int FileStore::_omap_rmkeys(coll_t cid, const hobject_t &hoid, const set<string> &keys) { @@ -4682,7 +4682,7 @@ int FileStore::_omap_rmkeys(coll_t cid, const hobject_t &hoid, int r = lfn_find(cid, hoid, &path); if (r < 0) return r; - r = object_map->rm_keys(hoid, path->get_index(), keys); + r = object_map->rm_keys(hoid, keys); if (r < 0 && r != -ENOENT) return r; return 0; @@ -4695,7 +4695,7 @@ int FileStore::_omap_setheader(coll_t cid, const hobject_t &hoid, int r = lfn_find(cid, hoid, &path); if (r < 0) return r; - return object_map->set_header(hoid, path->get_index(), bl); + return object_map->set_header(hoid, bl); } diff --git a/src/os/ObjectMap.h b/src/os/ObjectMap.h index ea6c78ec9ea..8e52fbb6ea0 100644 --- a/src/os/ObjectMap.h +++ b/src/os/ObjectMap.h @@ -15,12 +15,11 @@ #ifndef OS_KEYVALUESTORE_H #define OS_KEYVALUESTORE_H +#include "IndexManager.h" #include <string> #include <vector> #include <tr1/memory> -#include "IndexManager.h" - /** * Encapsulates the FileStore key value store * @@ -31,41 +30,35 @@ public: /// Set keys and values from specified map virtual int set_keys( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid const map<string, bufferlist> &set ///< [in] key to value map to set ) = 0; /// Set header virtual int set_header( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid const bufferlist &bl ///< [in] header to set ) = 0; /// Retrieve header virtual int get_header( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid bufferlist *bl ///< [out] header to set ) = 0; /// Clear all map keys and values from hoid virtual int clear( - const hobject_t &hoid, ///< [in] object containing map - Index index ///< [in] Path to hoid + const hobject_t &hoid ///< [in] object containing map ) = 0; /// Clear all map keys and values from hoid virtual int rm_keys( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid const set<string> &to_clear ///< [in] Keys to clear ) = 0; /// Get all keys and values virtual int get( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid bufferlist *header, ///< [out] Returned Header map<string, bufferlist> *out ///< [out] Returned keys and values ) = 0; @@ -73,14 +66,12 @@ public: /// Get values for supplied keys virtual int get_keys( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid set<string> *keys ///< [out] Keys defined on hoid ) = 0; /// Get values for supplied keys virtual int get_values( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid const set<string> &keys, ///< [in] Keys to get map<string, bufferlist> *out ///< [out] Returned keys and values ) = 0; @@ -88,7 +79,6 @@ public: /// Check key existence virtual int check_keys( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid const set<string> &keys, ///< [in] Keys to check set<string> *out ///< [out] Subset of keys defined on hoid ) = 0; @@ -96,7 +86,6 @@ public: /// Get xattrs virtual int get_xattrs( const hobject_t &hoid, ///< [in] object - Index index, ///< [in] path to hoid const set<string> &to_get, ///< [in] keys to get map<string, bufferlist> *out ///< [out] subset of attrs/vals defined ) = 0; @@ -104,21 +93,18 @@ public: /// Get all xattrs virtual int get_all_xattrs( const hobject_t &hoid, ///< [in] object - Index index, ///< [in] path to hoid set<string> *out ///< [out] attrs and values ) = 0; /// set xattrs in to_set virtual int set_xattrs( const hobject_t &hoid, ///< [in] object - Index index, ///< [in] path to object const map<string, bufferlist> &to_set ///< [in] attrs/values to set ) = 0; /// remove xattrs in to_remove virtual int remove_xattrs( const hobject_t &hoid, ///< [in] object - Index index, ///< [in] path to hoid const set<string> &to_remove ///< [in] attrs to remove ) = 0; @@ -126,9 +112,7 @@ public: /// Clone keys efficiently from hoid map to target map virtual int clone( const hobject_t &hoid, ///< [in] object containing map - Index index, ///< [in] Path to hoid - const hobject_t &target, ///< [in] target of clone - Index target_index ///< [in] path to target + const hobject_t &target ///< [in] target of clone ) { return 0; } /// Ensure all previous writes are durable @@ -149,8 +133,7 @@ public: virtual ~ObjectMapIteratorImpl() {} }; typedef std::tr1::shared_ptr<ObjectMapIteratorImpl> ObjectMapIterator; - virtual ObjectMapIterator get_iterator(const hobject_t &hoid, - Index index) { + virtual ObjectMapIterator get_iterator(const hobject_t &hoid) { return ObjectMapIterator(); } |