[CF] OpenWithColumnFamilies -> Open

Summary: By discussion with @dhruba, overloading Open makes more sense

Test Plan: compiles!

Reviewers: dhruba

CC: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D16017
main
Igor Canadi 11 years ago
parent 9ff9abeb83
commit 8d4db63a2d
  1. 3
      db/column_family_test.cc
  2. 10
      db/db_impl.cc
  3. 7
      include/rocksdb/db.h

@ -41,8 +41,7 @@ class ColumnFamilyTest {
column_families.push_back( column_families.push_back(
ColumnFamilyDescriptor(x, column_family_options_)); ColumnFamilyDescriptor(x, column_family_options_));
} }
return DB::OpenWithColumnFamilies(db_options_, dbname_, column_families, return DB::Open(db_options_, dbname_, column_families, &handles_, &db_);
&handles_, &db_);
} }
void Destroy() { void Destroy() {

@ -3732,14 +3732,12 @@ Status DB::Open(const Options& options, const std::string& dbname, DB** dbptr) {
column_families.push_back( column_families.push_back(
ColumnFamilyDescriptor(default_column_family_name, cf_options)); ColumnFamilyDescriptor(default_column_family_name, cf_options));
std::vector<ColumnFamilyHandle> handles; std::vector<ColumnFamilyHandle> handles;
return DB::OpenWithColumnFamilies(db_options, dbname, column_families, return DB::Open(db_options, dbname, column_families, &handles, dbptr);
&handles, dbptr);
} }
Status DB::OpenWithColumnFamilies( Status DB::Open(const DBOptions& db_options, const std::string& dbname,
const DBOptions& db_options, const std::string& dbname, const std::vector<ColumnFamilyDescriptor>& column_families,
const std::vector<ColumnFamilyDescriptor>& column_families, std::vector<ColumnFamilyHandle>* handles, DB** dbptr) {
std::vector<ColumnFamilyHandle>* handles, DB** dbptr) {
*dbptr = nullptr; *dbptr = nullptr;
EnvOptions soptions; EnvOptions soptions;

@ -104,10 +104,9 @@ class DB {
// If everything is OK, handles will on return be the same size // If everything is OK, handles will on return be the same size
// as column_families --- handles[i] will be a handle that you // as column_families --- handles[i] will be a handle that you
// will use to operate on column family column_family[i] // will use to operate on column family column_family[i]
static Status OpenWithColumnFamilies( static Status Open(const DBOptions& db_options, const std::string& name,
const DBOptions& db_options, const std::string& name, const std::vector<ColumnFamilyDescriptor>& column_families,
const std::vector<ColumnFamilyDescriptor>& column_families, std::vector<ColumnFamilyHandle>* handles, DB** dbptr);
std::vector<ColumnFamilyHandle>* handles, DB** dbptr);
// ListColumnFamilies will open the DB specified by argument name // ListColumnFamilies will open the DB specified by argument name
// and return the list of all column families in that DB // and return the list of all column families in that DB

Loading…
Cancel
Save