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

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: more satorux feedback 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_KEY_NOT_FOUND, // Key not found.
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 // Puts |entry| to the database.
34 virtual Status Put(const GDataEntry& entry) = 0;
35
36 // Deletes a database entry with key |resource_id| or |path| respectively.
37 virtual Status DeleteByResourceId(const std::string& resource_id) = 0;
38 virtual Status DeleteByPath(const FilePath& path) = 0;
39
40 // Fetches 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|.
satorux1 2012/04/24 21:47:57 nit: Creates an iterator. btw, can this be NULL?
achuithb 2012/04/24 22:15:13 It cannot be NULL, unless malloc fails. I don't kn
satorux1 2012/04/24 22:34:50 I'd say "Will not return NULL".
achuithb 2012/04/24 23:47:20 Done.
47 virtual scoped_ptr<GDataDBIter> CreateIterator(const FilePath& path) = 0;
48
49 protected:
50 GDataDB() {}
51 };
52
53 // GData Database Iterator interface class.
54 class GDataDBIter {
55 public:
56 virtual ~GDataDBIter() {}
57
58 // Fetches the next |entry| in the iteration sequence. Returns false when
59 // there are no more entries.
60 virtual bool GetNext(std::string* path, scoped_ptr<GDataEntry>* entry) = 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