Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/public/platform/modules/indexeddb/indexed_db.mojom

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some (incomplete) work on struct traits. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 module indexed_db.mojom;
6
7 import "url/mojo/origin.mojom";
8
9 enum KeyPathType {
10 NONE,
11 STRING,
12 ARRAY,
13 };
14
15 enum CursorDirection {
16 Next,
17 NextNoDuplicate,
18 Prev,
19 PrevNoDuplicate,
20 Last = PrevNoDuplicate,
21 };
22
23 enum PutMode {
24 AddOrUpdate,
25 AddOnly,
26 CursorUpdate,
27 Last = CursorUpdate,
28 };
29
30 enum TaskType {
31 Normal,
32 Preemptive,
33 Last = Preemptive,
34 };
35
36 enum DataLoss {
37 None,
38 Total,
39 };
40
41 enum KeyType {
42 Invalid,
43 Array,
44 Binary,
45 String,
46 Date,
47 Number,
48 };
49
50 enum TransactionMode {
51 ReadOnly,
52 ReadWrite,
53 VersionChange,
54 };
55
56 enum ResultType {
57 Error,
58 Success,
59 };
60
61 union KeyPathData {
62 string str;
63 array<string> arr;
64 };
65
66 union KeyData {
67 array<Key> array_data;
68 array<uint8> binary_data;
69 string string_data;
70 double date;
71 double number;
72 };
73
74 struct DataLossInfo {
75 DataLoss status;
76 string message;
77 };
78
79 struct KeyPath {
80 KeyPathData data;
81 KeyPathType type;
82 };
83
84 struct Key {
85 KeyData data;
86 KeyType type;
87 };
88
89 struct KeyRange {
90 Key upper;
91 Key lower;
92 bool upper_open;
93 bool lower_open;
94 };
95
96 struct BlobInfo {
97 bool is_file;
98 string uuid;
99 string type; // MIME type
100 int64 size;
101 string file_path; // Only for File
102 string file_name; // Only for File
103 double last_modified; // Only for File
104 };
105
106 struct IndexMetadata {
107 string name;
108 KeyPath key_path;
109 bool unique = false;
110 bool multi_entry = false;
111 int64 id;
112 };
113
114 struct ObjectStoreMetadata {
115 string name;
116 KeyPath key_path;
117 bool auto_increment = false;
118 int64 id;
119 int64 max_index_id;
120 map<int64, IndexMetadata> indexes;
121 };
122
123 struct Value {
124 array<int8> data;
125 array<BlobInfo> blob_info;
126 // The auto-generated primary key and key path. Both are set when IDB is
127 // generating keys (and not JavaScript). Optional; If set then a property
128 // named |key_path| will be set to |primary_key| on the deserialized |data|
129 // object before calling the event handler.
130 Key primary_key;
131 KeyPath key_path;
132 };
133
134 struct DatabaseMetadata {
135
136 const int64 NoVersion = -1;
137
138 string name;
139 int64 version;
140 int64 id;
141 int64 max_object_store_id;
142 map<int64, ObjectStoreMetadata> object_stores;
143 };
144
145 struct ErrorInfo {
146 int16 code;
147 string message;
148 };
149
150 struct GetResult {
151 ResultType type;
152 ErrorInfo error;
153 };
154
155 struct OpenResult {
156 ResultType type;
157 Database database;
158 ErrorInfo error;
159 };
160
161 // An observer that lives for the lifetime of an open database connection. This
162 // is used by the server to send unsolicited messages to the client.
163 interface DatabaseObserver {
164 OnTransactionAborted(int64 host_transaction_id, ErrorInfo error);
165 OnTransactionCompleted(int64 host_transaction_id);
166 OnTransactionFinished(int64 host_transaction_id, bool committed);
167 OnForcedClosed();
168 OnVersionChange(int64 old_version, int64 new_version);
169 };
170
171 // Used only during database open. Maps to IDBOpenDBRequest.
172 interface OpenRequestObserver {
173 OnBlocked(int64 old_version);
174 OnUpgradeNeeded(int64 old_version, Database database, DatabaseMetadata metadat a, DataLossInfo dataLoss);
175 };
176
177 interface DatabaseFactory {
178
179 Open(string name, int64 version, int64 transaction_id,
180 url.mojom.Origin origin, OpenRequestObserver open_observer,
181 DatabaseObserver database_observer)
182 => (OpenResult out);
183
184 GetDatabaseNames(url.mojom.Origin origin);
185
186 DeleteDatabase(string name, url.mojom.Origin origin);
187 };
188
189 interface Database {
190
191 const int64 minimumIndexId = 30;
192
193 CreateObjectStore(int64 transaction_id, int64 object_store_id, string name,
194 KeyPath key_path, bool auto_increment);
195
196 Close();
197
198 DeleteObjectStore(int64 transaction_id, int64 object_store_id);
199
200 CreateTransaction(int64 id, array<int64> scope,
201 TransactionMode transaction_mode);
202
203 VersionChangeIgnored();
204
205 Abort(int64 transaction_id);
206
207 Commit(int64 transaction_id);
208
209 Get(int64 database_id, int64 transaction_id, int64 object_store_id, int64 inde x_id,
210 KeyRange key_range, bool key_only) => (GetResult out);
211
212 GetAll(int64 transaction_id, int64 object_store_id, int64 index_id,
213 KeyRange key_range, int64 max_count, bool key_only);
214
215 Put(int64 transaction_id, int64 object_store_id, array<int8> value,
216 array<BlobInfo> blob_info, Key key, PutMode put_mode,
217 array<int64> index_ids, array<array<Key>> index_keys);
218
219 DeleteRange(int64 transaction_id, int64 object_store_id, KeyRange key_range);
220
221 Clear(int64 transaction_id, int64 object_store_id);
222
223 CreateIndex(int64 transaction_id, int64 object_store_id, int64 index_id,
224 string name, KeyPath key_path, bool unique, bool multi_entry);
225
226 DeleteIndex(int64 transaction_id, int64 object_store_id, int64 index_id);
227
228 SetIndexKeys(int64 transaction_id, int64 object_store_id, Key primary_key,
229 array<int64> index_ids, array<array<Key>> index_keys);
230
231 SetIndexesReady(int64 transaction_id, int64 object_store_id,
232 array<int64> index_ids);
233
234 OpenCursor(int64 transaction_id, int64 object_store_id, int64 index_id,
235 KeyRange key_range, CursorDirection direction, bool key_only,
236 TaskType task_type);
237
238 Count(int64 transaction_id, int64 object_store_id, int64 index_id,
239 KeyRange key_range);
240
241 AckReceivedBlobs(array<string> uuids);
242 };
243
244 interface Cursor {
245
246 Advance(uint32 count);
247
248 ContinueFunction(Key key, Key primary_key);
249
250 PostSuccessHandlerCallback();
251 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698