Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/db_data_store_impl.h |
| diff --git a/components/data_reduction_proxy/core/browser/db_data_store_impl.h b/components/data_reduction_proxy/core/browser/db_data_store_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c8e9ba0b6aafbc111ccb7a4f1cc522a84239cd7b |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/core/browser/db_data_store_impl.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_DATA_STORE_IMPL_H_ |
| +#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_DATA_STORE_IMPL_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/sequence_checker.h" |
| +#include "components/data_reduction_proxy/core/browser/db_data_store.h" |
| + |
| +namespace leveldb { |
| +class DB; |
| +} |
| + |
| +namespace data_reduction_proxy { |
| + |
| +// Implementation of DataReductionProxyStore using LevelDB. |
|
jeremyim
2015/07/08 18:21:46
Rename in comment
Not at Google. Contact bengr
2015/07/08 19:07:20
Done.
|
| +class DBDataStoreImpl : public DBDataStore { |
| + public: |
| + explicit DBDataStoreImpl(const base::FilePath& profile_path); |
| + ~DBDataStoreImpl() override; |
| + |
| + void InitializeOnDBThread() override; |
| + |
| + Status Get(const std::string& key, std::string* value) override; |
| + |
| + Status Put(const std::map<std::string, std::string>& map) override; |
| + |
| + private: |
| + // Opens the underlying Level DB for read and write. |
| + Status OpenDB(); |
| + |
| + // Deletes the LevelDB and recreates it. Call this method if any DB calls |
| + // return |CORRUPTED| status. |
| + void RecreateDB(); |
| + |
| + scoped_ptr<leveldb::DB> db_; |
| + const base::FilePath profile_path_; |
| + base::SequenceChecker sequence_checker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DBDataStoreImpl); |
| +}; |
| + |
| +} // namespace data_reduction_proxy |
| + |
| +#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_DATA_STORE_IMPL_H_ |