SpatialDB change API

Summary: I changed SpatialDB API so that we only specify list of indexes when we create the database. That way, whoever is querying the DB doesn't need to know the full list of indexes and their options.

Test Plan: spatial_db_test

Reviewers: yinwang

Reviewed By: yinwang

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D20571
This commit is contained in:
Igor Canadi
2014-07-24 16:39:33 -04:00
parent 07a7d870b8
commit 0754d4cb3b
4 changed files with 279 additions and 118 deletions

View File

@@ -196,13 +196,15 @@ struct SpatialIndexOptions {
class SpatialDB : public StackableDB {
public:
// Open the SpatialDB. List of spatial_indexes need to include all indexes
// that already exist in the DB (if the DB already exists). It can include new
// indexes, which will be created and initialized as empty (data will not be
// re-indexed). The resulting db object will be returned through db parameter.
// TODO(icanadi) read_only = true doesn't yet work because of #4743185
// Creates the SpatialDB with specified list of indexes.
// REQUIRED: db doesn't exist
static Status Create(const SpatialDBOptions& options, const std::string& name,
const std::vector<SpatialIndexOptions>& spatial_indexes);
// Open the existing SpatialDB. The resulting db object will be returned
// through db parameter.
// REQUIRED: db was created using SpatialDB::Create
static Status Open(const SpatialDBOptions& options, const std::string& name,
const std::vector<SpatialIndexOptions>& spatial_indexes,
SpatialDB** db, bool read_only = false);
explicit SpatialDB(DB* db) : StackableDB(db) {}