OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ | 5 #ifndef COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ |
6 #define COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ | 6 #define COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/strings/string_split.h" |
13 #include "base/threading/thread_collision_warner.h" | 14 #include "base/threading/thread_collision_warner.h" |
14 | 15 |
15 namespace leveldb { | 16 namespace leveldb { |
16 class DB; | 17 class DB; |
17 } // namespace leveldb | 18 } // namespace leveldb |
18 | 19 |
19 namespace leveldb_proto { | 20 namespace leveldb_proto { |
20 | 21 |
21 // Interacts with the LevelDB third party module. | 22 // Interacts with the LevelDB third party module. |
22 // Once constructed, function calls and destruction should all occur on the | 23 // Once constructed, function calls and destruction should all occur on the |
23 // same thread (not necessarily the same as the constructor). | 24 // same thread (not necessarily the same as the constructor). |
24 class LevelDB { | 25 class LevelDB { |
25 public: | 26 public: |
26 LevelDB(); | 27 LevelDB(); |
27 virtual ~LevelDB(); | 28 virtual ~LevelDB(); |
28 | 29 |
29 virtual bool Init(const base::FilePath& database_dir); | 30 virtual bool Init(const base::FilePath& database_dir); |
30 virtual bool Save( | 31 virtual bool Save(const base::StringPairs& pairs_to_save, |
31 const std::vector<std::pair<std::string, std::string> >& pairs_to_save, | 32 const std::vector<std::string>& keys_to_remove); |
32 const std::vector<std::string>& keys_to_remove); | |
33 virtual bool Load(std::vector<std::string>* entries); | 33 virtual bool Load(std::vector<std::string>* entries); |
34 | 34 |
35 private: | 35 private: |
36 DFAKE_MUTEX(thread_checker_); | 36 DFAKE_MUTEX(thread_checker_); |
37 scoped_ptr<leveldb::DB> db_; | 37 scoped_ptr<leveldb::DB> db_; |
38 }; | 38 }; |
39 | 39 |
40 } // namespace leveldb_proto | 40 } // namespace leveldb_proto |
41 | 41 |
42 #endif // COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ | 42 #endif // COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ |
OLD | NEW |