OLD | NEW |
(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_LEVELDB_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_LEVELDB_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <leveldb/db.h> |
| 10 #include <string> |
| 11 |
| 12 #include "chrome/browser/chromeos/gdata/gdata_db.h" |
| 13 |
| 14 namespace gdata { |
| 15 |
| 16 class GDataLevelDB : public GDataDB { |
| 17 public: |
| 18 GDataLevelDB(); |
| 19 virtual ~GDataLevelDB(); |
| 20 |
| 21 void Init(const FilePath& db_path); |
| 22 |
| 23 // GDataDB implementation. |
| 24 virtual Status Put(const GDataEntry& file) OVERRIDE; |
| 25 virtual Status DeleteByResourceId(const std::string& resource_id) OVERRIDE; |
| 26 virtual Status DeleteByPath(const std::string& path) OVERRIDE; |
| 27 virtual Status GetByResourceId(const std::string& resource_id, |
| 28 scoped_ptr<GDataEntry>* file) OVERRIDE; |
| 29 virtual Status GetByPath(const std::string& path, |
| 30 scoped_ptr<GDataEntry>* file) OVERRIDE; |
| 31 virtual scoped_ptr<GDataDBIter> NewIterator(const std::string& path) OVERRIDE; |
| 32 |
| 33 private: |
| 34 // Returns |resource_id| for |path| by looking up path_db_. |
| 35 Status ResourceIdForPath(const std::string& path, std::string* resource_id); |
| 36 |
| 37 scoped_ptr<leveldb::DB> main_db_; |
| 38 scoped_ptr<leveldb::DB> path_db_; |
| 39 }; |
| 40 |
| 41 } // namespace gdata |
| 42 |
| 43 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_LEVELDB_H_ |
OLD | NEW |