| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 leveldb::DB* m_db; | 59 leveldb::DB* m_db; |
| 60 const leveldb::Snapshot* m_snapshot; | 60 const leveldb::Snapshot* m_snapshot; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 class LevelDBDatabase { | 63 class LevelDBDatabase { |
| 64 public: | 64 public: |
| 65 static PassOwnPtr<LevelDBDatabase> open(const String& fileName, const LevelD
BComparator*); | 65 static PassOwnPtr<LevelDBDatabase> open(const String& fileName, const LevelD
BComparator*); |
| 66 static PassOwnPtr<LevelDBDatabase> openInMemory(const LevelDBComparator*); | 66 static PassOwnPtr<LevelDBDatabase> openInMemory(const LevelDBComparator*); |
| 67 static bool destroy(const String& fileName); | 67 static bool destroy(const String& fileName); |
| 68 ~LevelDBDatabase(); | 68 virtual ~LevelDBDatabase(); |
| 69 | 69 |
| 70 bool put(const LevelDBSlice& key, const Vector<char>& value); | 70 bool put(const LevelDBSlice& key, const Vector<char>& value); |
| 71 bool remove(const LevelDBSlice& key); | 71 bool remove(const LevelDBSlice& key); |
| 72 bool safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found, cons
t LevelDBSnapshot* = 0); | 72 virtual bool safeGet(const LevelDBSlice& key, Vector<char>& value, bool& fou
nd, const LevelDBSnapshot* = 0); |
| 73 bool write(LevelDBWriteBatch&); | 73 bool write(LevelDBWriteBatch&); |
| 74 PassOwnPtr<LevelDBIterator> createIterator(const LevelDBSnapshot* = 0); | 74 PassOwnPtr<LevelDBIterator> createIterator(const LevelDBSnapshot* = 0); |
| 75 const LevelDBComparator* comparator() const; | 75 const LevelDBComparator* comparator() const; |
| 76 | 76 |
| 77 protected: |
| 78 LevelDBDatabase(); |
| 79 |
| 77 private: | 80 private: |
| 78 friend class LevelDBSnapshot; | 81 friend class LevelDBSnapshot; |
| 79 LevelDBDatabase(); | |
| 80 | 82 |
| 81 OwnPtr<leveldb::Env> m_env; | 83 OwnPtr<leveldb::Env> m_env; |
| 82 OwnPtr<leveldb::Comparator> m_comparatorAdapter; | 84 OwnPtr<leveldb::Comparator> m_comparatorAdapter; |
| 83 OwnPtr<leveldb::DB> m_db; | 85 OwnPtr<leveldb::DB> m_db; |
| 84 const LevelDBComparator* m_comparator; | 86 const LevelDBComparator* m_comparator; |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 } | 89 } |
| 88 | 90 |
| 89 #endif | 91 #endif |
| 90 #endif | 92 #endif |
| OLD | NEW |