| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 module leveldb; | 5 module leveldb; |
| 6 | 6 |
| 7 import "components/filesystem/public/interfaces/directory.mojom"; | 7 import "components/filesystem/public/interfaces/directory.mojom"; |
| 8 | 8 |
| 9 enum DatabaseError { | 9 enum DatabaseError { |
| 10 OK, | 10 OK, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 array<uint8> key; | 25 array<uint8> key; |
| 26 array<uint8>? value; | 26 array<uint8>? value; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Service which hands out databases. | 29 // Service which hands out databases. |
| 30 interface LevelDBService { | 30 interface LevelDBService { |
| 31 // TODO(erg): What options do we want to export? All? None? | 31 // TODO(erg): What options do we want to export? All? None? |
| 32 Open(filesystem.Directory directory, | 32 Open(filesystem.Directory directory, |
| 33 string dbname, | 33 string dbname, |
| 34 LevelDBDatabase& database) => (DatabaseError status); | 34 LevelDBDatabase& database) => (DatabaseError status); |
| 35 |
| 36 OpenInMemory(LevelDBDatabase& database) => (DatabaseError status); |
| 35 }; | 37 }; |
| 36 | 38 |
| 37 // A leveldb database. | 39 // A leveldb database. |
| 38 interface LevelDBDatabase { | 40 interface LevelDBDatabase { |
| 39 // Basic Interface ------------------------------------------------------- | 41 // Basic Interface ------------------------------------------------------- |
| 40 | 42 |
| 41 // Sets the database entry for "key" to "value". Returns OK on success. | 43 // Sets the database entry for "key" to "value". Returns OK on success. |
| 42 Put(array<uint8> key, array<uint8> value) => (DatabaseError status); | 44 Put(array<uint8> key, array<uint8> value) => (DatabaseError status); |
| 43 | 45 |
| 44 // Remove the database entry (if any) for "key". Returns OK on | 46 // Remove the database entry (if any) for "key". Returns OK on |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 GetSnapshot() => (uint64 snapshot_id); | 59 GetSnapshot() => (uint64 snapshot_id); |
| 58 | 60 |
| 59 // Releases a previously acquired snapshot. | 61 // Releases a previously acquired snapshot. |
| 60 ReleaseSnapshot(uint64 snapshot_id); | 62 ReleaseSnapshot(uint64 snapshot_id); |
| 61 | 63 |
| 62 // If |key| exists at the time |snapshot_id| was taken, return OK and the | 64 // If |key| exists at the time |snapshot_id| was taken, return OK and the |
| 63 // value. Otherwise return NOT_FOUND. | 65 // value. Otherwise return NOT_FOUND. |
| 64 GetFromSnapshot(uint64 snapshot_id, array<uint8> key) | 66 GetFromSnapshot(uint64 snapshot_id, array<uint8> key) |
| 65 => (DatabaseError status, array<uint8> value); | 67 => (DatabaseError status, array<uint8> value); |
| 66 }; | 68 }; |
| OLD | NEW |