Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/db_data_store.h |
| diff --git a/components/data_reduction_proxy/core/browser/db_data_store.h b/components/data_reduction_proxy/core/browser/db_data_store.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2f9c50d076af3f9ab1682e2a465bec612d2ab39e |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/core/browser/db_data_store.h |
| @@ -0,0 +1,43 @@ |
| +// 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_H_ |
| +#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_DATA_STORE_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| + |
| +namespace data_reduction_proxy { |
| + |
| +// Interface for a permanent key/value store used by the Data Reduction Proxy |
| +// component. This class has no-op methods for clients that do not want to |
| +// support a permanent store. |DataReductionProxyStoreImpl| provides a LevelDB |
|
jeremyim
2015/07/08 18:21:46
Rename in comment
Not at Google. Contact bengr
2015/07/08 19:07:20
Done.
|
| +// implementation. |
| +class DBDataStore { |
|
jeremyim
2015/07/08 18:21:46
Just DataStore?
Not at Google. Contact bengr
2015/07/08 19:07:20
Done.
|
| + public: |
| + // Values are used in UMA. Do not change existing values; only append to the |
| + // end. STATUS_MAX should always be last element. |
| + enum Status { OK, NOT_FOUND, CORRUPTED, IO_ERROR, MISC_ERROR, STATUS_MAX }; |
| + |
| + DBDataStore(); |
| + virtual ~DBDataStore(); |
| + |
| + // Initializes the store on DB Thread. |
| + virtual void InitializeOnDBThread(); |
| + |
| + // Gets the value from the store for the provided key. |
| + virtual Status Get(const std::string& key, std::string* value); |
| + |
| + // Persists the provided keys and values into the store. |
| + virtual Status Put(const std::map<std::string, std::string>& map); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(DBDataStore); |
| +}; |
| + |
| +} // namespace data_reduction_proxy |
| + |
| +#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DB_DATA_STORE_H_ |