summaryrefslogtreecommitdiffstats
path: root/extensions/browser/value_store/leveldb_value_store.h
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/browser/value_store/leveldb_value_store.h')
-rw-r--r--extensions/browser/value_store/leveldb_value_store.h49
1 files changed, 4 insertions, 45 deletions
diff --git a/extensions/browser/value_store/leveldb_value_store.h b/extensions/browser/value_store/leveldb_value_store.h
index 058e282..41e91a3 100644
--- a/extensions/browser/value_store/leveldb_value_store.h
+++ b/extensions/browser/value_store/leveldb_value_store.h
@@ -15,6 +15,7 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/trace_event/memory_dump_provider.h"
+#include "extensions/browser/value_store/lazy_leveldb.h"
#include "extensions/browser/value_store/value_store.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
@@ -25,6 +26,7 @@ class HistogramBase;
// Value store area, backed by a leveldb database.
// All methods must be run on the FILE thread.
class LeveldbValueStore : public ValueStore,
+ public LazyLevelDb,
public base::trace_event::MemoryDumpProvider {
public:
// Creates a database bound to |path|. The underlying database won't be
@@ -46,10 +48,10 @@ class LeveldbValueStore : public ValueStore,
ReadResult Get(const std::string& key) override;
ReadResult Get(const std::vector<std::string>& keys) override;
ReadResult Get() override;
- WriteResult Set(WriteOptions options,
+ WriteResult Set(ValueStore::WriteOptions options,
const std::string& key,
const base::Value& value) override;
- WriteResult Set(WriteOptions options,
+ WriteResult Set(ValueStore::WriteOptions options,
const base::DictionaryValue& values) override;
WriteResult Remove(const std::string& key) override;
WriteResult Remove(const std::vector<std::string>& keys) override;
@@ -64,23 +66,6 @@ class LeveldbValueStore : public ValueStore,
base::trace_event::ProcessMemoryDump* pmd) override;
private:
- // Fix the |key| or database. If |key| is not null and the database is open
- // then the key will be deleted. Otherwise the database will be repaired, and
- // failing that will be deleted.
- BackingStoreRestoreStatus FixCorruption(const std::string* key);
-
- // Log, to UMA, the status of an attempt to restore a database.
- BackingStoreRestoreStatus LogRestoreStatus(
- BackingStoreRestoreStatus restore_status);
-
- // Tries to open the database if it hasn't been opened already.
- ValueStore::Status EnsureDbIsOpen();
-
- // Reads a setting from the database.
- ValueStore::Status ReadFromDb(const std::string& key,
- // Will be reset() with the result, if any.
- scoped_ptr<base::Value>* setting);
-
// Adds a setting to a WriteBatch, and logs the change in |changes|. For use
// with WriteToDb.
ValueStore::Status AddToBatch(ValueStore::WriteOptions options,
@@ -92,32 +77,6 @@ class LeveldbValueStore : public ValueStore,
// Commits the changes in |batch| to the database.
ValueStore::Status WriteToDb(leveldb::WriteBatch* batch);
- // Converts an error leveldb::Status to a ValueStore::Error.
- ValueStore::Status ToValueStoreError(const leveldb::Status& status);
-
- // Delete a value (identified by |key|) from the value store.
- leveldb::Status Delete(const std::string& key);
-
- // Removes the on-disk database at |db_path_|. Any file system locks should
- // be released before calling this method.
- bool DeleteDbFile();
-
- // Returns whether the database is empty.
- bool IsEmpty();
-
- // The location of the leveldb backend.
- const base::FilePath db_path_;
- leveldb::Options open_options_;
- leveldb::ReadOptions read_options_;
-
- // leveldb backend.
- scoped_ptr<leveldb::DB> db_;
- // Database is corrupt - restoration failed.
- bool db_unrecoverable_;
- base::HistogramBase* open_histogram_;
- base::HistogramBase* db_restore_histogram_;
- base::HistogramBase* value_restore_histogram_;
-
DISALLOW_COPY_AND_ASSIGN(LeveldbValueStore);
};