Darin Petkov | 3003059 | 2010-07-27 13:53:20 -0700 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | namespace chromeos_update_engine { |
| 11 | |
Darin Petkov | 3627577 | 2010-10-01 11:40:57 -0700 | [diff] [blame] | 12 | extern const char kPrefsDeltaUpdateFailures[]; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 13 | extern const char kPrefsLastActivePingDay[]; |
| 14 | extern const char kPrefsLastRollCallPingDay[]; |
Darin Petkov | 73058b4 | 2010-10-06 16:32:19 -0700 | [diff] [blame^] | 15 | extern const char kPrefsManifestMetadataSize[]; |
| 16 | extern const char kPrefsUpdateCheckResponseHash[]; |
| 17 | extern const char kPrefsUpdateStateNextDataOffset[]; |
| 18 | extern const char kPrefsUpdateStateNextOperation[]; |
| 19 | extern const char kPrefsUpdateStateSignedSHA256Context[]; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 20 | |
Darin Petkov | 3003059 | 2010-07-27 13:53:20 -0700 | [diff] [blame] | 21 | // The prefs interface allows access to a persistent preferences |
| 22 | // store. The two reasons for providing this as an interface are |
| 23 | // testing as well as easier switching to a new implementation in the |
| 24 | // future, if necessary. |
| 25 | |
| 26 | class PrefsInterface { |
| 27 | public: |
| 28 | // Gets a string |value| associated with |key|. Returns true on |
| 29 | // success, false on failure (including when the |key| is not |
| 30 | // present in the store). |
| 31 | virtual bool GetString(const std::string& key, std::string* value) = 0; |
| 32 | |
| 33 | // Associates |key| with a string |value|. Returns true on success, |
| 34 | // false otherwise. |
| 35 | virtual bool SetString(const std::string& key, const std::string& value) = 0; |
| 36 | |
| 37 | // Gets an int64 |value| associated with |key|. Returns true on |
| 38 | // success, false on failure (including when the |key| is not |
| 39 | // present in the store). |
| 40 | virtual bool GetInt64(const std::string& key, int64_t* value) = 0; |
| 41 | |
| 42 | // Associates |key| with an int64 |value|. Returns true on success, |
| 43 | // false otherwise. |
| 44 | virtual bool SetInt64(const std::string& key, const int64_t value) = 0; |
Darin Petkov | 1cbd78f | 2010-07-29 12:38:34 -0700 | [diff] [blame] | 45 | |
| 46 | virtual ~PrefsInterface() {} |
Darin Petkov | 3003059 | 2010-07-27 13:53:20 -0700 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | } // namespace chromeos_update_engine |
| 50 | |
| 51 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__ |