blob: 81aa770cdb812604b48c0afabf707ca2d205e708 [file] [log] [blame]
Darin Petkov30030592010-07-27 13:53:20 -07001// 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
10namespace chromeos_update_engine {
11
Darin Petkov36275772010-10-01 11:40:57 -070012extern const char kPrefsDeltaUpdateFailures[];
Darin Petkov1cbd78f2010-07-29 12:38:34 -070013extern const char kPrefsLastActivePingDay[];
14extern const char kPrefsLastRollCallPingDay[];
Darin Petkov73058b42010-10-06 16:32:19 -070015extern const char kPrefsManifestMetadataSize[];
Darin Petkov61426142010-10-08 11:04:55 -070016extern const char kPrefsResumedUpdateFailures[];
Darin Petkov73058b42010-10-06 16:32:19 -070017extern const char kPrefsUpdateCheckResponseHash[];
18extern const char kPrefsUpdateStateNextDataOffset[];
19extern const char kPrefsUpdateStateNextOperation[];
Darin Petkov437adc42010-10-07 13:12:24 -070020extern const char kPrefsUpdateStateSHA256Context[];
Darin Petkov73058b42010-10-06 16:32:19 -070021extern const char kPrefsUpdateStateSignedSHA256Context[];
Darin Petkov1cbd78f2010-07-29 12:38:34 -070022
Darin Petkov30030592010-07-27 13:53:20 -070023// The prefs interface allows access to a persistent preferences
24// store. The two reasons for providing this as an interface are
25// testing as well as easier switching to a new implementation in the
26// future, if necessary.
27
28class PrefsInterface {
29 public:
30 // Gets a string |value| associated with |key|. Returns true on
31 // success, false on failure (including when the |key| is not
32 // present in the store).
33 virtual bool GetString(const std::string& key, std::string* value) = 0;
34
35 // Associates |key| with a string |value|. Returns true on success,
36 // false otherwise.
37 virtual bool SetString(const std::string& key, const std::string& value) = 0;
38
39 // Gets an int64 |value| associated with |key|. Returns true on
40 // success, false on failure (including when the |key| is not
41 // present in the store).
42 virtual bool GetInt64(const std::string& key, int64_t* value) = 0;
43
44 // Associates |key| with an int64 |value|. Returns true on success,
45 // false otherwise.
46 virtual bool SetInt64(const std::string& key, const int64_t value) = 0;
Darin Petkov1cbd78f2010-07-29 12:38:34 -070047
48 virtual ~PrefsInterface() {}
Darin Petkov30030592010-07-27 13:53:20 -070049};
50
51} // namespace chromeos_update_engine
52
53#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__