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

Side by Side Diff: third_party/WebKit/Source/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: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 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 union KeyPathData {
57 string str;
58 array<string> arr;
59 };
60
61 union KeyData {
62 array<Key> array_data;
63 array<uint8> binary_data;
64 string string_data;
65 double date;
66 double number;
67 };
68
69 struct DataLossInfo {
70 DataLoss status;
71 string message;
72 };
73
74 // TODO(cmumford): Can we make KeyPath a union, and pass a NULL value for type n one?
75 struct KeyPath {
76 KeyPathType type;
77 KeyPathData data;
78 };
79
80 struct Key {
81 KeyData data;
82 KeyType type;
83 };
84
85 struct KeyRange {
86 Key upper;
87 Key lower;
88 bool upper_open;
89 bool lower_open;
90 };
91
92 struct BlobInfo {
93 bool is_file;
94 string uuid;
95 string type; // MIME type
96 int64 size;
97 string file_path; // Only for File
98 string file_name; // Only for File
99 double last_modified; // Only for File
100 };
101
102 struct IndexMetadata {
103 string name;
104 KeyPath key_path;
105 bool unique = false;
106 bool multi_entry = false;
107 int64 id;
108 };
109
110 struct ObjectStoreMetadata {
111 string name;
112 KeyPath key_path;
113 bool auto_increment = false;
114 int64 id;
115 int64 max_index_id;
116 map<int64, IndexMetadata> indexes;
117 };
118
119 struct Value {
120 array<int8> data;
121 array<BlobInfo> blob_info;
122 // The auto-generated primary key and key path. Both are set when IDB is
123 // generating keys (and not JavaScript). Optional; If set then a property
124 // named |key_path| will be set to |primary_key| on the deserialized |data|
125 // object before calling the event handler.
126 Key primary_key;
127 KeyPath key_path;
128 };
129
130 struct DatabaseMetadata {
131
132 const int64 NoVersion = -1;
133
134 string name;
135 int64 version;
136 int64 id;
137 int64 max_object_store_id;
138 map<int64, ObjectStoreMetadata> object_stores;
139 };
140
141 struct ErrorInfo {
142 int16 code;
143 string message;
144 };
145
146 union GetResult {
147 ErrorInfo error;
148 };
149
150 // Data for a newly opened database connection.
151 struct DatabaseOpenData {
152 Database database;
153 DatabaseMetadata metadata;
154 };
155
156 union OpenResult {
157 DatabaseOpenData data;
158 ErrorInfo error;
159 };
160
161 // An observer that lives for the lifetime of an open database connection. Used
162 // 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 OnForcedClosed();
167 OnVersionChange(int64 old_version, int64 new_version);
168 };
169
170 // Used during database open and delete. Maps to IDBOpenDBRequest.
171 interface OpenRequestObserver {
172 OnBlocked(int64 old_version);
173 OnUpgradeNeeded(int64 old_version, Database database, DatabaseMetadata metadat a, DataLossInfo dataLoss);
174 };
175
176 interface DatabaseFactory {
177
178 Open(string name, int64 version, int64 transaction_id,
179 url.mojom.Origin origin, OpenRequestObserver open_observer,
180 DatabaseObserver database_observer)
181 => (OpenResult out);
182
183 GetDatabaseNames(url.mojom.Origin origin);
184
185 DeleteDatabase(string name, url.mojom.Origin origin);
186 };
187
188 interface Database {
189
190 const int64 minimumIndexId = 30;
191
192 CreateObjectStore(int64 transaction_id, int64 object_store_id, string name,
193 KeyPath key_path, bool auto_increment);
194
195 Close();
196
197 DeleteObjectStore(int64 transaction_id, int64 object_store_id);
198
199 CreateTransaction(int64 transaction_id, array<int64> scope,
200 TransactionMode transaction_mode);
201
202 VersionChangeIgnored();
203
204 Abort(int64 transaction_id);
205
206 Commit(int64 transaction_id);
207
208 Get(int64 transaction_id, int64 object_store_id, int64 index_id,
209 KeyRange key_range, bool key_only) => (GetResult out);
210
211 GetAll(int64 transaction_id, int64 object_store_id, int64 index_id,
212 KeyRange key_range, int64 max_count, bool key_only);
213
214 Put(int64 transaction_id, int64 object_store_id, array<int8> value,
215 array<BlobInfo> blob_info, Key key, PutMode put_mode,
216 array<int64> index_ids, array<array<Key>> index_keys);
217
218 DeleteRange(int64 transaction_id, int64 object_store_id, KeyRange key_range);
219
220 Clear(int64 transaction_id, int64 object_store_id);
221
222 CreateIndex(int64 transaction_id, int64 object_store_id, int64 index_id,
223 string name, KeyPath key_path, bool unique, bool multi_entry);
224
225 DeleteIndex(int64 transaction_id, int64 object_store_id, int64 index_id);
226
227 SetIndexKeys(int64 transaction_id, int64 object_store_id, Key primary_key,
228 array<int64> index_ids, array<array<Key>> index_keys);
229
230 SetIndexesReady(int64 transaction_id, int64 object_store_id,
231 array<int64> index_ids);
232
233 OpenCursor(int64 transaction_id, int64 object_store_id, int64 index_id,
234 KeyRange key_range, CursorDirection direction, bool key_only,
235 TaskType task_type);
236
237 Count(int64 transaction_id, int64 object_store_id, int64 index_id,
238 KeyRange key_range);
239
240 AckReceivedBlobs(array<string> uuids);
241 };
242
243 interface Cursor {
244
245 Advance(uint32 count);
246
247 ContinueFunction(Key key, Key primary_key);
248
249 PostSuccessHandlerCallback();
250 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698