| 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.mojom; | 5 module leveldb.mojom; |
| 6 | 6 |
| 7 import "components/filesystem/public/interfaces/directory.mojom"; | 7 import "components/filesystem/public/interfaces/directory.mojom"; |
| 8 import "mojo/common/unguessable_token.mojom"; | 8 import "mojo/common/unguessable_token.mojom"; |
| 9 | 9 |
| 10 enum DatabaseError { | 10 enum DatabaseError { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Number of open files that can be used by the DB. (Note: we globally set | 55 // Number of open files that can be used by the DB. (Note: we globally set |
| 56 // the default here to 80 instead of leveldb's default 1000 because we don't | 56 // the default here to 80 instead of leveldb's default 1000 because we don't |
| 57 // want to consume all file descriptors. See | 57 // want to consume all file descriptors. See |
| 58 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 for | 58 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 for |
| 59 // details.) | 59 // details.) |
| 60 int32 max_open_files = 80; | 60 int32 max_open_files = 80; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // Service which hands out databases. | 63 // Service which hands out databases. |
| 64 interface LevelDBService { | 64 interface LevelDBService { |
| 65 // Open the database with the specified "name" in the specified "directory". |
| 66 // Fails if the database doesn't already exist. |
| 65 Open(filesystem.mojom.Directory directory, | 67 Open(filesystem.mojom.Directory directory, |
| 66 string dbname, | 68 string dbname, |
| 67 LevelDBDatabase& database) => (DatabaseError status); | 69 associated LevelDBDatabase& database) => (DatabaseError status); |
| 70 |
| 71 // Open the database with the specified "name" in the specified "directory". |
| 68 OpenWithOptions(OpenOptions options, | 72 OpenWithOptions(OpenOptions options, |
| 69 filesystem.mojom.Directory directory, | 73 filesystem.mojom.Directory directory, |
| 70 string dbname, | 74 string dbname, |
| 71 LevelDBDatabase& database) => (DatabaseError status); | 75 associated LevelDBDatabase& database) => (DatabaseError status
); |
| 72 | 76 |
| 73 OpenInMemory(LevelDBDatabase& database) => (DatabaseError status); | 77 // Opens a database stored purely in memory. |
| 78 OpenInMemory(associated LevelDBDatabase& database) => (DatabaseError status); |
| 79 |
| 80 // Destroys the contents of the specified database. Returns OK if the database |
| 81 // already didn't exist. |
| 82 Destroy(filesystem.mojom.Directory directory, |
| 83 string dbname) => (DatabaseError status); |
| 74 }; | 84 }; |
| 75 | 85 |
| 76 // A leveldb database. | 86 // A leveldb database. |
| 77 interface LevelDBDatabase { | 87 interface LevelDBDatabase { |
| 78 // Basic Interface ------------------------------------------------------- | 88 // Basic Interface ------------------------------------------------------- |
| 79 | 89 |
| 80 // Sets the database entry for "key" to "value". Returns OK on success. | 90 // Sets the database entry for "key" to "value". Returns OK on success. |
| 81 Put(array<uint8> key, array<uint8> value) => (DatabaseError status); | 91 Put(array<uint8> key, array<uint8> value) => (DatabaseError status); |
| 82 | 92 |
| 83 // Remove the database entry (if any) for "key". Returns OK on | 93 // Remove the database entry (if any) for "key". Returns OK on |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Moves forward or backwards in iterator space. | 146 // Moves forward or backwards in iterator space. |
| 137 [Sync] | 147 [Sync] |
| 138 IteratorNext(mojo.common.mojom.UnguessableToken iterator) | 148 IteratorNext(mojo.common.mojom.UnguessableToken iterator) |
| 139 => (bool valid, DatabaseError status, array<uint8>? key, | 149 => (bool valid, DatabaseError status, array<uint8>? key, |
| 140 array<uint8>? value); | 150 array<uint8>? value); |
| 141 [Sync] | 151 [Sync] |
| 142 IteratorPrev(mojo.common.mojom.UnguessableToken iterator) | 152 IteratorPrev(mojo.common.mojom.UnguessableToken iterator) |
| 143 => (bool valid, DatabaseError status, array<uint8>? key, | 153 => (bool valid, DatabaseError status, array<uint8>? key, |
| 144 array<uint8>? value); | 154 array<uint8>? value); |
| 145 }; | 155 }; |
| OLD | NEW |