Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1082)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_db.h

Issue 10168025: GDataDB support with leveldb. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: minor Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium 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 CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/memory/scoped_ptr.h"
12
13 class FilePath;
14
15 namespace gdata {
16
17 class GDataEntry;
18 class GDataDBIter;
19
20 // GData Database interface class.
21 class GDataDB {
22 public:
23 enum Status {
24 DB_OK = 0,
25 DB_NOT_FOUND, // Key not found.
satorux1 2012/04/24 20:25:15 DB_KEY_NOT_FOUND to be more descriptive?
achuithb 2012/04/24 21:36:25 Done.
26 DB_CORRUPTION, // Database file corrupt.
27 DB_IO_ERROR, // File I/O error.
28 DB_INTERNAL_ERROR,
29 };
30
31 virtual ~GDataDB() {}
32
33 // Add |entry| to the database.
satorux1 2012/04/24 20:25:15 Add -> Adds Puts may be better to be consistent w
achuithb 2012/04/24 21:36:25 Done.
34 virtual Status Put(const GDataEntry& entry) = 0;
35
36 // Delete a database entry with key |resource_id| or |path| respectively.
satorux1 2012/04/24 20:25:15 Deletes. please fix other places too.
achuithb 2012/04/24 21:36:25 Done.
37 virtual Status DeleteByResourceId(const std::string& resource_id) = 0;
38 virtual Status DeleteByPath(const FilePath& path) = 0;
39
40 // Fetch a GDataEntry* by key |resource_id| or |path| respectively.
41 virtual Status GetByResourceId(const std::string& resource_id,
42 scoped_ptr<GDataEntry>* entry) = 0;
43 virtual Status GetByPath(const FilePath& path,
44 scoped_ptr<GDataEntry>* entry) = 0;
45
46 // An iterator to fetch all GDataEntry's under |path|.
47 virtual scoped_ptr<GDataDBIter> NewIterator(const FilePath& path) = 0;
satorux1 2012/04/24 20:25:15 maybe CreateIterator()? Create looks more common i
achuithb 2012/04/24 21:36:25 Done.
48
49 protected:
50 GDataDB() {}
51 };
52
53 // GData Database Iterator interface class.
54 class GDataDBIter {
55 public:
56 virtual ~GDataDBIter() {}
57
58 // Returns all GDataEntry's under path.
59 // NULL is returned upon loop termination.
60 virtual scoped_ptr<GDataEntry> GetNext() = 0;
61
62 protected:
63 GDataDBIter() {}
64 };
65
66 } // namespace gdata
67
68 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_db_factory.h » ('j') | chrome/browser/chromeos/gdata/gdata_db_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698