blob: dbfa68abba09b155feb98f7eea47e98c0cfebf54 [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 Petkov1cbd78f2010-07-29 12:38:34 -070012extern const char kPrefsLastActivePingDay[];
13extern const char kPrefsLastRollCallPingDay[];
14
Darin Petkov30030592010-07-27 13:53:20 -070015// The prefs interface allows access to a persistent preferences
16// store. The two reasons for providing this as an interface are
17// testing as well as easier switching to a new implementation in the
18// future, if necessary.
19
20class PrefsInterface {
21 public:
22 // Gets a string |value| associated with |key|. Returns true on
23 // success, false on failure (including when the |key| is not
24 // present in the store).
25 virtual bool GetString(const std::string& key, std::string* value) = 0;
26
27 // Associates |key| with a string |value|. Returns true on success,
28 // false otherwise.
29 virtual bool SetString(const std::string& key, const std::string& value) = 0;
30
31 // Gets an int64 |value| associated with |key|. Returns true on
32 // success, false on failure (including when the |key| is not
33 // present in the store).
34 virtual bool GetInt64(const std::string& key, int64_t* value) = 0;
35
36 // Associates |key| with an int64 |value|. Returns true on success,
37 // false otherwise.
38 virtual bool SetInt64(const std::string& key, const int64_t value) = 0;
Darin Petkov1cbd78f2010-07-29 12:38:34 -070039
40 virtual ~PrefsInterface() {}
Darin Petkov30030592010-07-27 13:53:20 -070041};
42
43} // namespace chromeos_update_engine
44
45#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PREFS_INTERFACE_H__