diff options
author | Joao Eduardo Luis <joao.luis@inktank.com> | 2012-09-17 19:08:05 +0200 |
---|---|---|
committer | Joao Eduardo Luis <joao.luis@inktank.com> | 2013-02-21 19:02:22 +0100 |
commit | 091fa826d9e3442f77112bc893f66f4d4ebb6723 (patch) | |
tree | 6c9d8f1c83560eff35ffe9f6c7e611f911e4e720 /src/test/ObjectMap | |
parent | mon: Monitor: Add monitor store synchronization support (diff) | |
download | ceph-091fa826d9e3442f77112bc893f66f4d4ebb6723.tar.xz ceph-091fa826d9e3442f77112bc893f66f4d4ebb6723.zip |
os: LevelDBStore: scrap init() and create open() and create_and_open()
The init() function always implicitly created a new store if it was
missing.
This patches makes init() a private function accepting a bool that used
to specify whether or not we want to create the store if it does not
exists, and creates two functions: open() and create_and_open().
open() will fail if the store we are trying to open does not exist;
create_and_open() maintains the same behavior as the previous behavior of
init() and will create the store if it does not exist before opening it.
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
Diffstat (limited to 'src/test/ObjectMap')
-rw-r--r-- | src/test/ObjectMap/test_keyvaluedb_atomicity.cc | 2 | ||||
-rw-r--r-- | src/test/ObjectMap/test_keyvaluedb_iterators.cc | 2 | ||||
-rw-r--r-- | src/test/ObjectMap/test_object_map.cc | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/test/ObjectMap/test_keyvaluedb_atomicity.cc b/src/test/ObjectMap/test_keyvaluedb_atomicity.cc index 8a25af6e535..b19745723e9 100644 --- a/src/test/ObjectMap/test_keyvaluedb_atomicity.cc +++ b/src/test/ObjectMap/test_keyvaluedb_atomicity.cc @@ -85,7 +85,7 @@ int main() { string strpath(path); std::cerr << "Using path: " << strpath << std::endl; LevelDBStore *store = new LevelDBStore(strpath); - assert(!store->init(std::cerr)); + assert(!store->create_and_open(std::cerr)); db.reset(store); verify(db.get()); diff --git a/src/test/ObjectMap/test_keyvaluedb_iterators.cc b/src/test/ObjectMap/test_keyvaluedb_iterators.cc index e5c9089916c..f38275be98e 100644 --- a/src/test/ObjectMap/test_keyvaluedb_iterators.cc +++ b/src/test/ObjectMap/test_keyvaluedb_iterators.cc @@ -38,7 +38,7 @@ public: assert(!store_path.empty()); LevelDBStore *db_ptr = new LevelDBStore(store_path); - assert(!db_ptr->init(std::cerr)); + assert(!db_ptr->create_and_open(std::cerr)); db.reset(db_ptr); mock.reset(new KeyValueDBMemory()); } diff --git a/src/test/ObjectMap/test_object_map.cc b/src/test/ObjectMap/test_object_map.cc index e536be3b847..800443a84c3 100644 --- a/src/test/ObjectMap/test_object_map.cc +++ b/src/test/ObjectMap/test_object_map.cc @@ -519,7 +519,7 @@ public: cerr << "using path " << strpath << std::endl;; LevelDBStore *store = new LevelDBStore(strpath); - assert(!store->init(cerr)); + assert(!store->create_and_open(cerr)); db.reset(new DBObjectMap(store)); tester.db = db.get(); |