@jsm-mit/map-routes-package 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -21
- package/declarations/map-routes-coordinator/map-routes-coordinator.did +485 -0
- package/declarations/map-routes-coordinator/map-routes-coordinator.did.d.ts +764 -0
- package/declarations/map-routes-coordinator/map-routes-coordinator.did.js +303 -0
- package/declarations/map-routes-core/map-routes-core.did +107 -0
- package/declarations/map-routes-core/map-routes-core.did.d.ts +171 -0
- package/declarations/map-routes-core/map-routes-core.did.js +108 -0
- package/declarations/map-routes-worker/map-routes-worker.did +172 -0
- package/declarations/map-routes-worker/map-routes-worker.did.d.ts +296 -0
- package/declarations/{map-routes/map-routes.did.js → map-routes-worker/map-routes-worker.did.js} +53 -5
- package/dist/canister-actor.d.ts +2 -1
- package/dist/canister-actor.d.ts.map +1 -1
- package/dist/canister-actor.js +17 -0
- package/dist/client.d.ts +109 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +174 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/passes.d.ts +37 -0
- package/dist/passes.d.ts.map +1 -0
- package/dist/passes.js +28 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +10 -9
- package/declarations/map-routes/map-routes.did +0 -93
- package/declarations/map-routes/map-routes.did.d.ts +0 -153
|
@@ -0,0 +1,764 @@
|
|
|
1
|
+
import type { Principal } from '@icp-sdk/core/principal';
|
|
2
|
+
import type { ActorMethod } from '@icp-sdk/core/agent';
|
|
3
|
+
import type { IDL } from '@icp-sdk/core/candid';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* One area as a client sees it: where to ask.
|
|
7
|
+
*/
|
|
8
|
+
export interface AreaInfo {
|
|
9
|
+
'sha256' : [] | [string],
|
|
10
|
+
'area' : string,
|
|
11
|
+
'bbox' : Bbox,
|
|
12
|
+
/**
|
|
13
|
+
* The live copies: a client draws one for every call.
|
|
14
|
+
*/
|
|
15
|
+
'copies' : Array<Principal>,
|
|
16
|
+
'osmDate' : [] | [string],
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Stored: the hysteresis of one area (key = its name).
|
|
20
|
+
*/
|
|
21
|
+
export interface AreaLoad {
|
|
22
|
+
/**
|
|
23
|
+
* Readings in a row with the average per live copy above H.
|
|
24
|
+
*/
|
|
25
|
+
'above' : number,
|
|
26
|
+
/**
|
|
27
|
+
* The last copy the load made (created or unmarked).
|
|
28
|
+
*/
|
|
29
|
+
'lastGrowthNs' : [] | [bigint],
|
|
30
|
+
/**
|
|
31
|
+
* Since when the load would fit into one live copy less (sum / (n − 1) < H/2).
|
|
32
|
+
*/
|
|
33
|
+
'belowSinceNs' : [] | [bigint],
|
|
34
|
+
'area' : string,
|
|
35
|
+
}
|
|
36
|
+
export interface Areas {
|
|
37
|
+
/**
|
|
38
|
+
* How long a client keeps this list.
|
|
39
|
+
*/
|
|
40
|
+
'ttlSeconds' : number,
|
|
41
|
+
'areas' : Array<AreaInfo>,
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A rectangle in degrees, edges included.
|
|
45
|
+
*/
|
|
46
|
+
export interface Bbox {
|
|
47
|
+
'minLat' : number,
|
|
48
|
+
'minLon' : number,
|
|
49
|
+
'maxLat' : number,
|
|
50
|
+
'maxLon' : number,
|
|
51
|
+
}
|
|
52
|
+
export interface BeginWasmArgs {
|
|
53
|
+
'sha256' : string,
|
|
54
|
+
/**
|
|
55
|
+
* `null` = the worker.
|
|
56
|
+
*/
|
|
57
|
+
'kind' : [] | [WasmKind],
|
|
58
|
+
'size' : bigint,
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Stored: a bisection of one area (key = its name). The users stay in the cores.
|
|
62
|
+
*/
|
|
63
|
+
export interface BisectionRun {
|
|
64
|
+
/**
|
|
65
|
+
* Set when it ended; a new one starts at least an hour later.
|
|
66
|
+
*/
|
|
67
|
+
'endedAtNs' : [] | [bigint],
|
|
68
|
+
'area' : string,
|
|
69
|
+
'copyA' : Principal,
|
|
70
|
+
'copyB' : Principal,
|
|
71
|
+
/**
|
|
72
|
+
* Suspects left, summed over the cores.
|
|
73
|
+
*/
|
|
74
|
+
'suspects' : bigint,
|
|
75
|
+
'steps' : number,
|
|
76
|
+
/**
|
|
77
|
+
* The split of this step began then.
|
|
78
|
+
*/
|
|
79
|
+
'stepStartedNs' : bigint,
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Stored: a blocked user (key = system/user). Only a superadmin unblocks.
|
|
83
|
+
*/
|
|
84
|
+
export interface Block {
|
|
85
|
+
'who' : UserKey,
|
|
86
|
+
'atNs' : bigint,
|
|
87
|
+
/**
|
|
88
|
+
* The measured surplus in instructions/s (bisection).
|
|
89
|
+
*/
|
|
90
|
+
'load' : [] | [number],
|
|
91
|
+
'reason' : string,
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Stored: one worker copy (key = its canister). A new field is `Option<…>` + `#[serde(default)]`.
|
|
95
|
+
*/
|
|
96
|
+
export interface Copy {
|
|
97
|
+
'area' : string,
|
|
98
|
+
'createdAtNs' : bigint,
|
|
99
|
+
'state' : CopyState,
|
|
100
|
+
'subnet' : [] | [Principal],
|
|
101
|
+
'canister' : Principal,
|
|
102
|
+
/**
|
|
103
|
+
* The last step that failed; `advanceCopy` tries it again.
|
|
104
|
+
*/
|
|
105
|
+
'lastError' : [] | [string],
|
|
106
|
+
/**
|
|
107
|
+
* When the copy was marked for removal (off the list since then).
|
|
108
|
+
*/
|
|
109
|
+
'markedAtNs' : [] | [bigint],
|
|
110
|
+
}
|
|
111
|
+
export type CopyState = {
|
|
112
|
+
/**
|
|
113
|
+
* A later copy: it pulls the graph from a live copy of the area.
|
|
114
|
+
*/
|
|
115
|
+
'Copying' : null
|
|
116
|
+
} |
|
|
117
|
+
{
|
|
118
|
+
/**
|
|
119
|
+
* Answers queries and is on the list of the area.
|
|
120
|
+
*/
|
|
121
|
+
'Live' : null
|
|
122
|
+
} |
|
|
123
|
+
{
|
|
124
|
+
/**
|
|
125
|
+
* Created; its wasm is not installed yet.
|
|
126
|
+
*/
|
|
127
|
+
'Installing' : null
|
|
128
|
+
} |
|
|
129
|
+
{
|
|
130
|
+
/**
|
|
131
|
+
* The first copy of an area: an uploader sends the graph (`upload-graph.sh --no-activate`).
|
|
132
|
+
*/
|
|
133
|
+
'AwaitingData' : null
|
|
134
|
+
} |
|
|
135
|
+
{
|
|
136
|
+
/**
|
|
137
|
+
* The load fits without it; only a superadmin deletes it.
|
|
138
|
+
*/
|
|
139
|
+
'MarkedForRemoval' : null
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Stored: a pass core of the group (key = its canister).
|
|
143
|
+
*/
|
|
144
|
+
export interface CoreCanister {
|
|
145
|
+
/**
|
|
146
|
+
* The snapshot version the core holds.
|
|
147
|
+
*/
|
|
148
|
+
'syncedVersion' : [] | [bigint],
|
|
149
|
+
'createdAtNs' : bigint,
|
|
150
|
+
/**
|
|
151
|
+
* Its balance at the last round (the round tops it up like a copy).
|
|
152
|
+
*/
|
|
153
|
+
'cycles' : [] | [bigint],
|
|
154
|
+
'state' : CoreState,
|
|
155
|
+
'subnet' : [] | [Principal],
|
|
156
|
+
'canister' : Principal,
|
|
157
|
+
'lastError' : [] | [string],
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* A core's report (`coreReport`).
|
|
161
|
+
*/
|
|
162
|
+
export interface CoreReport {
|
|
163
|
+
/**
|
|
164
|
+
* Blocks made in the core (renewals).
|
|
165
|
+
*/
|
|
166
|
+
'blocks' : Array<Block>,
|
|
167
|
+
/**
|
|
168
|
+
* Users with a valid pass, per area.
|
|
169
|
+
*/
|
|
170
|
+
'users' : Array<[string, bigint]>,
|
|
171
|
+
/**
|
|
172
|
+
* Systems refused for passes a minute.
|
|
173
|
+
*/
|
|
174
|
+
'rateLimited' : Array<Principal>,
|
|
175
|
+
}
|
|
176
|
+
export type CoreState = {
|
|
177
|
+
/**
|
|
178
|
+
* Issues passes; gets the snapshot.
|
|
179
|
+
*/
|
|
180
|
+
'Live' : null
|
|
181
|
+
} |
|
|
182
|
+
{
|
|
183
|
+
/**
|
|
184
|
+
* Created; its wasm is not installed yet (`advanceCore`).
|
|
185
|
+
*/
|
|
186
|
+
'Installing' : null
|
|
187
|
+
};
|
|
188
|
+
export type Error = {
|
|
189
|
+
/**
|
|
190
|
+
* A call to another canister failed (named); the step can be tried again.
|
|
191
|
+
*/
|
|
192
|
+
'CallFailed' : string
|
|
193
|
+
} |
|
|
194
|
+
{
|
|
195
|
+
/**
|
|
196
|
+
* The user gets no pass: the reason and whom to contact.
|
|
197
|
+
*/
|
|
198
|
+
'Blocked' : string
|
|
199
|
+
} |
|
|
200
|
+
{ 'NotFound' : string } |
|
|
201
|
+
{ 'NotAuthorized' : string } |
|
|
202
|
+
{
|
|
203
|
+
/**
|
|
204
|
+
* The limit of copies of the area is reached (`maxCopies`).
|
|
205
|
+
*/
|
|
206
|
+
'LimitReached' : string
|
|
207
|
+
} |
|
|
208
|
+
{ 'InvalidData' : string } |
|
|
209
|
+
{
|
|
210
|
+
/**
|
|
211
|
+
* The system asks too often (or the demo used its hour): try later.
|
|
212
|
+
*/
|
|
213
|
+
'RateLimited' : string
|
|
214
|
+
} |
|
|
215
|
+
{
|
|
216
|
+
/**
|
|
217
|
+
* The step waits for something outside (named), e.g. the graph upload.
|
|
218
|
+
*/
|
|
219
|
+
'Waiting' : string
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Test feed (local replica only: it does not count `query_stats`).
|
|
223
|
+
*/
|
|
224
|
+
export interface FeedArgs { 'totals' : QueryTotals, 'canister' : Principal }
|
|
225
|
+
/**
|
|
226
|
+
* A Candid-encodable representation of an HTTP request. This struct is used by
|
|
227
|
+
* the `http_request` method of the HTTP Gateway Protocol's Candid interface.
|
|
228
|
+
*
|
|
229
|
+
* # Examples
|
|
230
|
+
*
|
|
231
|
+
* ```
|
|
232
|
+
* use ic_http_certification::{HttpRequest, Method};
|
|
233
|
+
*
|
|
234
|
+
* let request = HttpRequest::builder()
|
|
235
|
+
* .with_method(Method::GET)
|
|
236
|
+
* .with_url("/")
|
|
237
|
+
* .with_headers(vec![("X-Custom-Foo".into(), "Bar".into())])
|
|
238
|
+
* .with_body(&[1, 2, 3])
|
|
239
|
+
* .with_certificate_version(2)
|
|
240
|
+
* .build();
|
|
241
|
+
*
|
|
242
|
+
* assert_eq!(request.method(), Method::GET);
|
|
243
|
+
* assert_eq!(request.url(), "/");
|
|
244
|
+
* assert_eq!(request.headers(), &[("X-Custom-Foo".into(), "Bar".into())]);
|
|
245
|
+
* assert_eq!(request.body(), &[1, 2, 3]);
|
|
246
|
+
* assert_eq!(request.certificate_version(), Some(2));
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* # Helpers
|
|
250
|
+
*
|
|
251
|
+
* There are also a number of convenience methods for quickly creating an [HttpRequest] with
|
|
252
|
+
* commonly used HTTP methods:
|
|
253
|
+
*
|
|
254
|
+
* - [GET](HttpRequest::get)
|
|
255
|
+
* - [POST](HttpRequest::post)
|
|
256
|
+
* - [PUT](HttpRequest::put)
|
|
257
|
+
* - [PATCH](HttpRequest::patch)
|
|
258
|
+
* - [DELETE](HttpRequest::delete)
|
|
259
|
+
*
|
|
260
|
+
* ```
|
|
261
|
+
* use ic_http_certification::HttpRequest;
|
|
262
|
+
*
|
|
263
|
+
* let request = HttpRequest::get("/").build();
|
|
264
|
+
*
|
|
265
|
+
* assert_eq!(request.method(), "GET");
|
|
266
|
+
* assert_eq!(request.url(), "/");
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
export interface HttpRequest {
|
|
270
|
+
/**
|
|
271
|
+
* HTTP request URL.
|
|
272
|
+
*/
|
|
273
|
+
'url' : string,
|
|
274
|
+
/**
|
|
275
|
+
* HTTP request method.
|
|
276
|
+
*/
|
|
277
|
+
'method' : string,
|
|
278
|
+
/**
|
|
279
|
+
* HTTP request body as an array of bytes.
|
|
280
|
+
*/
|
|
281
|
+
'body' : Uint8Array | number[],
|
|
282
|
+
/**
|
|
283
|
+
* HTTP request headers.
|
|
284
|
+
*/
|
|
285
|
+
'headers' : Array<[string, string]>,
|
|
286
|
+
/**
|
|
287
|
+
* The max response verification version to use in the response's
|
|
288
|
+
* certificate.
|
|
289
|
+
*/
|
|
290
|
+
'certificate_version' : [] | [number],
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* A Candid-encodable representation of an HTTP response. This struct is used
|
|
294
|
+
* by the `http_request` method of the HTTP Gateway Protocol's Candid interface.
|
|
295
|
+
*
|
|
296
|
+
* # Examples
|
|
297
|
+
*
|
|
298
|
+
* ```
|
|
299
|
+
* use ic_http_certification::{HttpResponse, StatusCode};
|
|
300
|
+
*
|
|
301
|
+
* let response = HttpResponse::builder()
|
|
302
|
+
* .with_status_code(StatusCode::OK)
|
|
303
|
+
* .with_headers(vec![("Content-Type".into(), "text/plain".into())])
|
|
304
|
+
* .with_body(b"Hello, World!")
|
|
305
|
+
* .with_upgrade(false)
|
|
306
|
+
* .build();
|
|
307
|
+
*
|
|
308
|
+
* assert_eq!(response.status_code(), StatusCode::OK);
|
|
309
|
+
* assert_eq!(response.headers(), &[("Content-Type".into(), "text/plain".into())]);
|
|
310
|
+
* assert_eq!(response.body(), b"Hello, World!");
|
|
311
|
+
* assert_eq!(response.upgrade(), Some(false));
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* # Helpers
|
|
315
|
+
*
|
|
316
|
+
* There are also a number of convenience methods for quickly creating an [HttpResponse] with
|
|
317
|
+
* commonly used HTTP status codes:
|
|
318
|
+
*
|
|
319
|
+
* - [OK](HttpResponse::ok)
|
|
320
|
+
* - [CREATED](HttpResponse::created)
|
|
321
|
+
* - [NO_CONTENT](HttpResponse::no_content)
|
|
322
|
+
* - [MOVED_PERMANENTLY](HttpResponse::moved_permanently)
|
|
323
|
+
* - [TEMPORARY_REDIRECT](HttpResponse::temporary_redirect)
|
|
324
|
+
* - [BAD_REQUEST](HttpResponse::bad_request)
|
|
325
|
+
* - [UNAUTHORIZED](HttpResponse::unauthorized)
|
|
326
|
+
* - [FORBIDDEN](HttpResponse::forbidden)
|
|
327
|
+
* - [NOT_FOUND](HttpResponse::not_found)
|
|
328
|
+
* - [METHOD_NOT_ALLOWED](HttpResponse::method_not_allowed)
|
|
329
|
+
* - [TOO_MANY_REQUESTS](HttpResponse::too_many_requests)
|
|
330
|
+
* - [INTERNAL_SERVER_ERROR](HttpResponse::internal_server_error)
|
|
331
|
+
*
|
|
332
|
+
* ```
|
|
333
|
+
* use ic_http_certification::{HttpResponse, StatusCode};
|
|
334
|
+
*
|
|
335
|
+
* let response = HttpResponse::ok(b"Hello, World!", vec![("Content-Type".into(), "text/plain".into())]).build();
|
|
336
|
+
*
|
|
337
|
+
* assert_eq!(response.status_code(), StatusCode::OK);
|
|
338
|
+
* assert_eq!(response.headers(), &[("Content-Type".into(), "text/plain".into())]);
|
|
339
|
+
* assert_eq!(response.body(), b"Hello, World!");
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
export interface HttpResponse {
|
|
343
|
+
/**
|
|
344
|
+
* HTTP response body as an array of bytes.
|
|
345
|
+
*/
|
|
346
|
+
'body' : Uint8Array | number[],
|
|
347
|
+
/**
|
|
348
|
+
* HTTP response headers.
|
|
349
|
+
*/
|
|
350
|
+
'headers' : Array<[string, string]>,
|
|
351
|
+
/**
|
|
352
|
+
* Whether the corresponding HTTP request should be upgraded to an update
|
|
353
|
+
* call.
|
|
354
|
+
*/
|
|
355
|
+
'upgrade' : [] | [boolean],
|
|
356
|
+
/**
|
|
357
|
+
* HTTP response status code.
|
|
358
|
+
*/
|
|
359
|
+
'status_code' : number,
|
|
360
|
+
}
|
|
361
|
+
export interface InitArgs { 'mode' : Mode, 'superadmins' : Array<Principal> }
|
|
362
|
+
export type Mode = {
|
|
363
|
+
/**
|
|
364
|
+
* The local replica: copies by the management canister (no CMC there), any subnet.
|
|
365
|
+
*/
|
|
366
|
+
'Local' : null
|
|
367
|
+
} |
|
|
368
|
+
{ 'Stage' : null } |
|
|
369
|
+
{ 'Prod' : null };
|
|
370
|
+
/**
|
|
371
|
+
* Stored: one notification for the superadmin (key = its id).
|
|
372
|
+
*/
|
|
373
|
+
export interface Notice {
|
|
374
|
+
'id' : bigint,
|
|
375
|
+
'area' : [] | [string],
|
|
376
|
+
'atNs' : bigint,
|
|
377
|
+
'kind' : NoticeKind,
|
|
378
|
+
'text' : string,
|
|
379
|
+
'canister' : [] | [Principal],
|
|
380
|
+
}
|
|
381
|
+
export type NoticeKind = {
|
|
382
|
+
/**
|
|
383
|
+
* The status of a copy could not be read.
|
|
384
|
+
*/
|
|
385
|
+
'StatusFailed' : null
|
|
386
|
+
} |
|
|
387
|
+
{ 'BisectionStarted' : null } |
|
|
388
|
+
{ 'CopyCreated' : null } |
|
|
389
|
+
{ 'CopyDeleted' : null } |
|
|
390
|
+
{
|
|
391
|
+
/**
|
|
392
|
+
* The load needs another copy, but `maxCopies` is reached.
|
|
393
|
+
*/
|
|
394
|
+
'MaxCopiesReached' : null
|
|
395
|
+
} |
|
|
396
|
+
{
|
|
397
|
+
/**
|
|
398
|
+
* The pass keys of a copy could not be set.
|
|
399
|
+
*/
|
|
400
|
+
'KeysFailed' : null
|
|
401
|
+
} |
|
|
402
|
+
{ 'CopyMarked' : null } |
|
|
403
|
+
{ 'CopyUnmarked' : null } |
|
|
404
|
+
{ 'CopyFailed' : null } |
|
|
405
|
+
{
|
|
406
|
+
/**
|
|
407
|
+
* The bisection found no single user (the load is honest) or lost its copies.
|
|
408
|
+
*/
|
|
409
|
+
'BisectionEnded' : null
|
|
410
|
+
} |
|
|
411
|
+
{
|
|
412
|
+
/**
|
|
413
|
+
* A core did not take the snapshot or an order.
|
|
414
|
+
*/
|
|
415
|
+
'CoreFailed' : null
|
|
416
|
+
} |
|
|
417
|
+
{
|
|
418
|
+
/**
|
|
419
|
+
* A system asked for too many passes in a minute.
|
|
420
|
+
*/
|
|
421
|
+
'SystemRateLimited' : null
|
|
422
|
+
} |
|
|
423
|
+
{
|
|
424
|
+
/**
|
|
425
|
+
* A user is blocked (bisection or too many renewals).
|
|
426
|
+
*/
|
|
427
|
+
'UserBlocked' : null
|
|
428
|
+
} |
|
|
429
|
+
{
|
|
430
|
+
/**
|
|
431
|
+
* A copy runs low and the coordinator cannot top it up.
|
|
432
|
+
*/
|
|
433
|
+
'CyclesLow' : null
|
|
434
|
+
};
|
|
435
|
+
export interface PassState {
|
|
436
|
+
/**
|
|
437
|
+
* Copy → the id of its newest key and whether it holds `passRequired`.
|
|
438
|
+
*/
|
|
439
|
+
'keys' : Array<[Principal, number, boolean]>,
|
|
440
|
+
'cores' : Array<CoreCanister>,
|
|
441
|
+
/**
|
|
442
|
+
* Users with a valid pass, as the cores reported last.
|
|
443
|
+
*/
|
|
444
|
+
'activePasses' : bigint,
|
|
445
|
+
'systems' : Array<System>,
|
|
446
|
+
'blocks' : Array<Block>,
|
|
447
|
+
'bisections' : Array<BisectionRun>,
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* The cumulative `query_stats` of one copy (`canister_status`), as numbers.
|
|
451
|
+
*/
|
|
452
|
+
export interface QueryTotals {
|
|
453
|
+
'calls' : bigint,
|
|
454
|
+
'instructions' : bigint,
|
|
455
|
+
'responseBytes' : bigint,
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* The load of one copy between two readings, per second.
|
|
459
|
+
*/
|
|
460
|
+
export interface Rates {
|
|
461
|
+
'responseBytesPerS' : number,
|
|
462
|
+
'callsPerS' : number,
|
|
463
|
+
'instructionsPerS' : number,
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Stored: the last reading of one copy (key = its canister).
|
|
467
|
+
*/
|
|
468
|
+
export interface Reading {
|
|
469
|
+
'atNs' : bigint,
|
|
470
|
+
/**
|
|
471
|
+
* The reading before (the rates cover `sinceNs..atNs`).
|
|
472
|
+
*/
|
|
473
|
+
'sinceNs' : [] | [bigint],
|
|
474
|
+
'cycles' : bigint,
|
|
475
|
+
'totals' : QueryTotals,
|
|
476
|
+
'canister' : Principal,
|
|
477
|
+
/**
|
|
478
|
+
* Since the reading before; none after the first one (or after the totals went down).
|
|
479
|
+
*/
|
|
480
|
+
'rates' : [] | [Rates],
|
|
481
|
+
}
|
|
482
|
+
export type Result = { 'Ok' : Shard } |
|
|
483
|
+
{ 'Err' : Error };
|
|
484
|
+
export type Result_1 = { 'Ok' : Array<Principal> } |
|
|
485
|
+
{ 'Err' : Error };
|
|
486
|
+
export type Result_10 = { 'Ok' : System } |
|
|
487
|
+
{ 'Err' : Error };
|
|
488
|
+
export type Result_11 = { 'Ok' : RoundReport } |
|
|
489
|
+
{ 'Err' : Error };
|
|
490
|
+
export type Result_12 = { 'Ok' : Settings } |
|
|
491
|
+
{ 'Err' : Error };
|
|
492
|
+
export type Result_13 = { 'Ok' : boolean } |
|
|
493
|
+
{ 'Err' : Error };
|
|
494
|
+
export type Result_2 = { 'Ok' : Copy } |
|
|
495
|
+
{ 'Err' : Error };
|
|
496
|
+
export type Result_3 = { 'Ok' : CoreCanister } |
|
|
497
|
+
{ 'Err' : Error };
|
|
498
|
+
export type Result_4 = { 'Ok' : WasmMeta } |
|
|
499
|
+
{ 'Err' : Error };
|
|
500
|
+
export type Result_5 = { 'Ok' : number } |
|
|
501
|
+
{ 'Err' : Error };
|
|
502
|
+
export type Result_6 = { 'Ok' : null } |
|
|
503
|
+
{ 'Err' : Error };
|
|
504
|
+
export type Result_7 = { 'Ok' : PassState } |
|
|
505
|
+
{ 'Err' : Error };
|
|
506
|
+
export type Result_8 = { 'Ok' : State } |
|
|
507
|
+
{ 'Err' : Error };
|
|
508
|
+
export type Result_9 = { 'Ok' : Array<Notice> } |
|
|
509
|
+
{ 'Err' : Error };
|
|
510
|
+
/**
|
|
511
|
+
* What one round saw and did.
|
|
512
|
+
*/
|
|
513
|
+
export interface RoundReport {
|
|
514
|
+
'atNs' : bigint,
|
|
515
|
+
/**
|
|
516
|
+
* What the round did, one line each.
|
|
517
|
+
*/
|
|
518
|
+
'actions' : Array<string>,
|
|
519
|
+
'loads' : Array<AreaLoad>,
|
|
520
|
+
'readings' : Array<Reading>,
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Stored: the settings (key 0).
|
|
524
|
+
*/
|
|
525
|
+
export interface Settings {
|
|
526
|
+
'hInstructionsPerS' : bigint,
|
|
527
|
+
'subnets' : Array<Subnet>,
|
|
528
|
+
'copyCycles' : bigint,
|
|
529
|
+
/**
|
|
530
|
+
* `null` = false (stored before phase 4).
|
|
531
|
+
*/
|
|
532
|
+
'passRequired' : [] | [boolean],
|
|
533
|
+
'mode' : Mode,
|
|
534
|
+
/**
|
|
535
|
+
* `null` = `DEFAULT_CORE_CYCLES` (stored before 2026-11-06).
|
|
536
|
+
*/
|
|
537
|
+
'coreCycles' : [] | [bigint],
|
|
538
|
+
'superadmins' : Array<Principal>,
|
|
539
|
+
'maxCopies' : number,
|
|
540
|
+
}
|
|
541
|
+
export interface SettingsArgs {
|
|
542
|
+
'hInstructionsPerS' : bigint,
|
|
543
|
+
/**
|
|
544
|
+
* Where copies may go (stage / prod); ignored on the local replica.
|
|
545
|
+
*/
|
|
546
|
+
'subnets' : Array<Subnet>,
|
|
547
|
+
'copyCycles' : bigint,
|
|
548
|
+
/**
|
|
549
|
+
* Workers refuse a query without a pass (`PassMissing`); `null` keeps the value held.
|
|
550
|
+
*/
|
|
551
|
+
'passRequired' : [] | [boolean],
|
|
552
|
+
/**
|
|
553
|
+
* Cycles of a new pass core (≥ 0.6 TC); `null` keeps the value held.
|
|
554
|
+
*/
|
|
555
|
+
'coreCycles' : [] | [bigint],
|
|
556
|
+
'maxCopies' : number,
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Stored: one area (key = its name).
|
|
560
|
+
*/
|
|
561
|
+
export interface Shard {
|
|
562
|
+
/**
|
|
563
|
+
* The graph every live copy holds; set when the first copy goes live.
|
|
564
|
+
*/
|
|
565
|
+
'sha256' : [] | [string],
|
|
566
|
+
'area' : string,
|
|
567
|
+
'bbox' : Bbox,
|
|
568
|
+
'osmDate' : [] | [string],
|
|
569
|
+
}
|
|
570
|
+
export interface State {
|
|
571
|
+
'coreWasm' : [] | [WasmMeta],
|
|
572
|
+
'shards' : Array<Shard>,
|
|
573
|
+
'lastRoundNs' : [] | [bigint],
|
|
574
|
+
'cores' : Array<CoreCanister>,
|
|
575
|
+
'wasm' : [] | [WasmMeta],
|
|
576
|
+
'loads' : Array<AreaLoad>,
|
|
577
|
+
/**
|
|
578
|
+
* The coordinator's own balance now.
|
|
579
|
+
*/
|
|
580
|
+
'cycles' : bigint,
|
|
581
|
+
'readings' : Array<Reading>,
|
|
582
|
+
'settings' : Settings,
|
|
583
|
+
'copies' : Array<Copy>,
|
|
584
|
+
}
|
|
585
|
+
export interface Subnet {
|
|
586
|
+
'id' : Principal,
|
|
587
|
+
/**
|
|
588
|
+
* A SEV subnet: the first copy of an area must stand on one.
|
|
589
|
+
*/
|
|
590
|
+
'sev' : boolean,
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Stored: one system (key = its principal).
|
|
594
|
+
*/
|
|
595
|
+
export interface System {
|
|
596
|
+
'id' : Principal,
|
|
597
|
+
'demo' : boolean,
|
|
598
|
+
'blocked' : boolean,
|
|
599
|
+
'name' : string,
|
|
600
|
+
'hourlyLimit' : [] | [number],
|
|
601
|
+
/**
|
|
602
|
+
* The demo hour: its start and the passes in it.
|
|
603
|
+
*/
|
|
604
|
+
'hourStartNs' : bigint,
|
|
605
|
+
'passesThisHour' : number,
|
|
606
|
+
'perMinute' : number,
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* A trusted system: a canister of another project or an outside system with a principal.
|
|
610
|
+
*/
|
|
611
|
+
export interface SystemArgs {
|
|
612
|
+
/**
|
|
613
|
+
* Its principal (`principal` is a Candid keyword).
|
|
614
|
+
*/
|
|
615
|
+
'id' : Principal,
|
|
616
|
+
/**
|
|
617
|
+
* Demo: short passes, a small bbox, `hourlyLimit` passes an hour for the whole system.
|
|
618
|
+
*/
|
|
619
|
+
'demo' : boolean,
|
|
620
|
+
/**
|
|
621
|
+
* A blocked system gets nothing (the superadmin's decision).
|
|
622
|
+
*/
|
|
623
|
+
'blocked' : boolean,
|
|
624
|
+
'name' : string,
|
|
625
|
+
'hourlyLimit' : [] | [number],
|
|
626
|
+
/**
|
|
627
|
+
* Passes a minute before `RateLimited`.
|
|
628
|
+
*/
|
|
629
|
+
'perMinute' : number,
|
|
630
|
+
}
|
|
631
|
+
export interface UserKey { 'user' : Principal, 'system' : Principal }
|
|
632
|
+
export interface WasmChunkArgs {
|
|
633
|
+
/**
|
|
634
|
+
* `null` = the worker.
|
|
635
|
+
*/
|
|
636
|
+
'kind' : [] | [WasmKind],
|
|
637
|
+
'offset' : bigint,
|
|
638
|
+
'bytes' : Uint8Array | number[],
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Which wasm: the worker of the copies, or the pass core.
|
|
642
|
+
*/
|
|
643
|
+
export type WasmKind = { 'Core' : null } |
|
|
644
|
+
{ 'Worker' : null };
|
|
645
|
+
/**
|
|
646
|
+
* Stored: the worker wasm that is uploaded or held (key 0); its bytes lie in their own memory.
|
|
647
|
+
*/
|
|
648
|
+
export interface WasmMeta {
|
|
649
|
+
'sha256' : string,
|
|
650
|
+
'size' : bigint,
|
|
651
|
+
'ready' : boolean,
|
|
652
|
+
}
|
|
653
|
+
export interface _SERVICE {
|
|
654
|
+
/**
|
|
655
|
+
* A new area; its first copy comes with `createCopy`.
|
|
656
|
+
*/
|
|
657
|
+
'addShard' : ActorMethod<[string, Bbox], Result>,
|
|
658
|
+
/**
|
|
659
|
+
* A superadmin adds another (e.g. the Internet Identity principal of the front: it differs
|
|
660
|
+
* from a dfx identity). At most 8; never anonymous.
|
|
661
|
+
*/
|
|
662
|
+
'addSuperadmin' : ActorMethod<[Principal], Result_1>,
|
|
663
|
+
/**
|
|
664
|
+
* The next steps of a copy, from where it stands; a failed step is tried again.
|
|
665
|
+
*/
|
|
666
|
+
'advanceCopy' : ActorMethod<[Principal], Result_2>,
|
|
667
|
+
/**
|
|
668
|
+
* Installs a core that was created but not installed (a failed `createCore`).
|
|
669
|
+
*/
|
|
670
|
+
'advanceCore' : ActorMethod<[Principal], Result_3>,
|
|
671
|
+
/**
|
|
672
|
+
* Where to ask: the areas and their live copies. Public; a client keeps it `ttlSeconds`.
|
|
673
|
+
*/
|
|
674
|
+
'areas' : ActorMethod<[], Areas>,
|
|
675
|
+
'beginWasm' : ActorMethod<[BeginWasmArgs], Result_4>,
|
|
676
|
+
/**
|
|
677
|
+
* The superadmin has read the notifications up to `id`.
|
|
678
|
+
*/
|
|
679
|
+
'clearNotifications' : ActorMethod<[bigint], Result_5>,
|
|
680
|
+
/**
|
|
681
|
+
* `null` = the worker.
|
|
682
|
+
*/
|
|
683
|
+
'commitWasm' : ActorMethod<[[] | [WasmKind]], Result_4>,
|
|
684
|
+
/**
|
|
685
|
+
* A core reports: its users per area (the bisection starts on them), its blocks, the systems
|
|
686
|
+
* it refused. It arms a round (at most every 10 min).
|
|
687
|
+
*/
|
|
688
|
+
'coreReport' : ActorMethod<[CoreReport], Result_6>,
|
|
689
|
+
/**
|
|
690
|
+
* A new copy of `area`: created, installed, then its steps as far as they go (`advanceCopy`
|
|
691
|
+
* goes on).
|
|
692
|
+
*/
|
|
693
|
+
'createCopy' : ActorMethod<[string], Result_2>,
|
|
694
|
+
/**
|
|
695
|
+
* A new pass core: created (on a SEV subnet outside the local replica), installed with the
|
|
696
|
+
* core wasm, then given the snapshot.
|
|
697
|
+
*/
|
|
698
|
+
'createCore' : ActorMethod<[], Result_3>,
|
|
699
|
+
/**
|
|
700
|
+
* Only a superadmin deletes, only a marked copy off the list for one list TTL.
|
|
701
|
+
*/
|
|
702
|
+
'deleteCopy' : ActorMethod<[Principal], Result_6>,
|
|
703
|
+
/**
|
|
704
|
+
* Local replica only: totals of `query_stats` for the next rounds (it counts none itself).
|
|
705
|
+
*/
|
|
706
|
+
'feedQueryStats' : ActorMethod<[Array<FeedArgs>], Result_6>,
|
|
707
|
+
'getPassState' : ActorMethod<[], Result_7>,
|
|
708
|
+
'getState' : ActorMethod<[], Result_8>,
|
|
709
|
+
/**
|
|
710
|
+
* Every coordinator (`sharding.md`): the crafting table asks before a reinstall.
|
|
711
|
+
*/
|
|
712
|
+
'hasDependents' : ActorMethod<[], boolean>,
|
|
713
|
+
/**
|
|
714
|
+
* The superadmin front, for everybody: the page and its files. It shows nothing by itself;
|
|
715
|
+
* it asks the methods of the superadmins, as the person who signed in.
|
|
716
|
+
*/
|
|
717
|
+
'http_request' : ActorMethod<[HttpRequest], HttpResponse>,
|
|
718
|
+
/**
|
|
719
|
+
* Which core issues the passes of `user` (public; a system keeps it with the list TTL).
|
|
720
|
+
*/
|
|
721
|
+
'issuerFor' : ActorMethod<[Principal], [] | [Principal]>,
|
|
722
|
+
'listDependents' : ActorMethod<[], Array<Principal>>,
|
|
723
|
+
/**
|
|
724
|
+
* A superadmin takes a live copy off the list (the coordinator marks after 24 h of low load).
|
|
725
|
+
*/
|
|
726
|
+
'markCopy' : ActorMethod<[Principal], Result_2>,
|
|
727
|
+
'notifications' : ActorMethod<[], Result_9>,
|
|
728
|
+
/**
|
|
729
|
+
* A superadmin removes one; the last one stays.
|
|
730
|
+
*/
|
|
731
|
+
'removeSuperadmin' : ActorMethod<[Principal], Result_1>,
|
|
732
|
+
/**
|
|
733
|
+
* A system is gone: the cores forget it (its users' passes are refused from the next sync;
|
|
734
|
+
* passes already given stay valid until they end). E.g. a core of a group replaced by the
|
|
735
|
+
* group's coordinator as the system.
|
|
736
|
+
*/
|
|
737
|
+
'removeSystem' : ActorMethod<[Principal], Result_10>,
|
|
738
|
+
/**
|
|
739
|
+
* A round now, whatever the time of the last one; refused while one runs.
|
|
740
|
+
*/
|
|
741
|
+
'runRound' : ActorMethod<[], Result_11>,
|
|
742
|
+
'setSettings' : ActorMethod<[SettingsArgs], Result_12>,
|
|
743
|
+
/**
|
|
744
|
+
* A system added or changed; the cores get it at once.
|
|
745
|
+
*/
|
|
746
|
+
'setSystem' : ActorMethod<[SystemArgs], Result_10>,
|
|
747
|
+
/**
|
|
748
|
+
* Only a superadmin unblocks: every core lifts the block (the renewal count starts again).
|
|
749
|
+
*/
|
|
750
|
+
'unblockUser' : ActorMethod<[UserKey], Result_13>,
|
|
751
|
+
/**
|
|
752
|
+
* A live (or marked) replicated instance gets the worker wasm held (stop → upgrade → start);
|
|
753
|
+
* its graphs and pass keys stay (stable memory). A failed step is kept in `lastError`.
|
|
754
|
+
*/
|
|
755
|
+
'upgradeCopy' : ActorMethod<[Principal], Result_2>,
|
|
756
|
+
/**
|
|
757
|
+
* A live core gets the core wasm held (stop → upgrade → start); its state stays. Then every
|
|
758
|
+
* core gets the snapshot again. A failed step is kept in `lastError`.
|
|
759
|
+
*/
|
|
760
|
+
'upgradeCore' : ActorMethod<[Principal], Result_3>,
|
|
761
|
+
'wasmChunk' : ActorMethod<[WasmChunkArgs], Result_6>,
|
|
762
|
+
}
|
|
763
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
764
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|