Index: chrome/browser/chromeos/gdata/gdata_db.h |
=================================================================== |
--- chrome/browser/chromeos/gdata/gdata_db.h (revision 0) |
+++ chrome/browser/chromeos/gdata/gdata_db.h (revision 0) |
@@ -0,0 +1,68 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ |
+#define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ |
+#pragma once |
+ |
+#include <string> |
+ |
+#include "base/memory/scoped_ptr.h" |
+ |
+class FilePath; |
+ |
+namespace gdata { |
+ |
+class GDataEntry; |
+class GDataDBIter; |
+ |
+// GData Database interface class. |
+class GDataDB { |
+ public: |
+ enum Status { |
+ DB_OK = 0, |
+ 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.
|
+ DB_CORRUPTION, // Database file corrupt. |
+ DB_IO_ERROR, // File I/O error. |
+ DB_INTERNAL_ERROR, |
+ }; |
+ |
+ virtual ~GDataDB() {} |
+ |
+ // 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.
|
+ virtual Status Put(const GDataEntry& entry) = 0; |
+ |
+ // 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.
|
+ virtual Status DeleteByResourceId(const std::string& resource_id) = 0; |
+ virtual Status DeleteByPath(const FilePath& path) = 0; |
+ |
+ // Fetch a GDataEntry* by key |resource_id| or |path| respectively. |
+ virtual Status GetByResourceId(const std::string& resource_id, |
+ scoped_ptr<GDataEntry>* entry) = 0; |
+ virtual Status GetByPath(const FilePath& path, |
+ scoped_ptr<GDataEntry>* entry) = 0; |
+ |
+ // An iterator to fetch all GDataEntry's under |path|. |
+ 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.
|
+ |
+ protected: |
+ GDataDB() {} |
+}; |
+ |
+// GData Database Iterator interface class. |
+class GDataDBIter { |
+ public: |
+ virtual ~GDataDBIter() {} |
+ |
+ // Returns all GDataEntry's under path. |
+ // NULL is returned upon loop termination. |
+ virtual scoped_ptr<GDataEntry> GetNext() = 0; |
+ |
+ protected: |
+ GDataDBIter() {} |
+}; |
+ |
+} // namespace gdata |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ |
Property changes on: chrome/browser/chromeos/gdata/gdata_db.h |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |