void open( const fc::path& dir, bool create = true ) { ldb::Options opts; opts.create_if_missing = create; opts.comparator = & _comparer; ldb::DB* ndb = nullptr; /// \waring Given path must exist to succeed toNativeAnsiPath fc::create_directories(dir); std::string ldbPath = dir.toNativeAnsiPath(); auto ntrxstat = ldb::DB::Open( opts, ldbPath.c_str(), &ndb ); if( !ntrxstat.ok() ) { FC_THROW_EXCEPTION( db_in_use_exception, "Unable to open database ${db}\n\t${msg}", ("db",dir) ("msg",ntrxstat.ToString()) ); } _db.reset(ndb); }