Debian Codegraph @

third_party/rust/webext-storage/src/webext-storage.udl

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 [Custom]
6 typedef string JsonValue;
7
8 [Custom]
9 typedef string Guid;
10
11 namespace webextstorage {
12
13 };
14
15 enum QuotaReason {
16 "TotalBytes",
17 "ItemBytes",
18 "MaxItems",
19 };
20
21 [Error]
22 interface WebExtStorageApiError {
23 UnexpectedError(string reason);
24 JsonError(string reason);
25 QuotaError(QuotaReason reason);
26 };
27
28 dictionary SyncedExtensionChange {
29 string ext_id;
30 string changes;
31 };
32
33 dictionary StorageValueChange {
34 string key;
35 JsonValue? old_value;
36 JsonValue? new_value;
37 };
38
39 dictionary StorageChanges {
40 sequence<StorageValueChange> changes;
41 };
42
43 interface WebExtStorageStore {
44 [Throws=WebExtStorageApiError]
45 constructor(string path);
46
47 [Throws=WebExtStorageApiError]
48 StorageChanges set([ByRef] string ext_id, JsonValue val);
49
50 [Throws=WebExtStorageApiError]
51 JsonValue get([ByRef] string ext_id, JsonValue keys);
52
53 [Throws=WebExtStorageApiError]
54 u64 get_bytes_in_use([ByRef] string ext_id, JsonValue keys);
55
56 [Throws=WebExtStorageApiError]
57 void close();
58
59 [Throws=WebExtStorageApiError]
60 StorageChanges remove([ByRef] string ext_id, JsonValue keys);
61
62 [Throws=WebExtStorageApiError]
63 StorageChanges clear([ByRef] string ext_id);
64
65 [Self=ByArc]
66 WebExtStorageBridgedEngine bridged_engine();
67
68 [Throws=WebExtStorageApiError]
69 sequence<SyncedExtensionChange> get_synced_changes();
70 };
71
72 // Note the canonical docs for this are in https://github.com/mozilla/application-services/blob/main/components/sync15/src/engine/bridged_engine.rs
73 // NOTE: all timestamps here are milliseconds.
74 interface WebExtStorageBridgedEngine {
75 [Throws=WebExtStorageApiError]
76 i64 last_sync();
77
78 [Throws=WebExtStorageApiError]
79 void set_last_sync(i64 last_sync);
80
81 [Throws=WebExtStorageApiError]
82 string? sync_id();
83
84 [Throws=WebExtStorageApiError]
85 string reset_sync_id();
86
87 [Throws=WebExtStorageApiError]
88 string ensure_current_sync_id([ByRef]string new_sync_id);
89
90 [Throws=WebExtStorageApiError]
91 void prepare_for_sync([ByRef]string client_data);
92
93 [Throws=WebExtStorageApiError]
94 void sync_started();
95
96 [Throws=WebExtStorageApiError]
97 void store_incoming(sequence<string> incoming);
98
99 [Throws=WebExtStorageApiError]
100 sequence<string> apply();
101
102 [Throws=WebExtStorageApiError]
103 void set_uploaded(i64 server_modified_millis, sequence<Guid> guids);
104
105 [Throws=WebExtStorageApiError]
106 void sync_finished();
107
108 [Throws=WebExtStorageApiError]
109 void reset();
110
111 [Throws=WebExtStorageApiError]
112 void wipe();
113 };