@jsm-mit/tigi-sharded-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 +41 -1
- package/declarations/coordinator/coordinator.did +68 -31
- package/declarations/coordinator/coordinator.did.d.ts +90 -30
- package/declarations/coordinator/coordinator.did.js +55 -31
- package/declarations/core/core.did +104 -38
- package/declarations/core/core.did.d.ts +98 -39
- package/declarations/core/core.did.js +66 -32
- package/dist/actors/profiles-actor.d.ts +9 -1
- package/dist/actors/profiles-actor.d.ts.map +1 -1
- package/dist/actors/profiles-actor.js +16 -0
- package/dist/actors/rides-actor.d.ts +12 -1
- package/dist/actors/rides-actor.d.ts.map +1 -1
- package/dist/actors/rides-actor.js +17 -0
- package/dist/chat.d.ts +51 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +87 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/interfaces.d.ts +19 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@ carries the rider's few driver-canister endpoints (U-14: `getRide`, `cancelRide`
|
|
|
6
6
|
`getLicence`), built from `protocol/tigi-driver.did`, so the consumer never sees a driver
|
|
7
7
|
canister's id.
|
|
8
8
|
|
|
9
|
-
Status: the rider's side (night 1, U-42)
|
|
9
|
+
Status: the rider's side (night 1, U-42); 0.2.0 (stage 2a, U-43) adds the rider's own
|
|
10
|
+
rating and WHERE the chat with a driver is. Version 0.1.0 was the first to publish.
|
|
10
11
|
|
|
11
12
|
## The rider
|
|
12
13
|
|
|
@@ -39,6 +40,7 @@ await request.getLicenceAsyncUnsafe(); // from accepted to
|
|
|
39
40
|
await request.rateDriverAsyncUnsafe(5); // after completed, once
|
|
40
41
|
|
|
41
42
|
const page = await profiles.getMyRidesAsyncUnsafe(); // the history in the core, 20 a page
|
|
43
|
+
const mine = await profiles.getMyRatingAsyncUnsafe(); // PF-4: { average: 4.87, count, sum } | undefined ("Brak ocen")
|
|
42
44
|
await rides.getPastRideAsyncUnsafe(page.rides[0].rideRef); // its details from the driver canister
|
|
43
45
|
```
|
|
44
46
|
|
|
@@ -56,6 +58,44 @@ Errors: `CanisterError` (with `errorKey`; `refusalKeyOf(err)` gives the worker's
|
|
|
56
58
|
`NOT_COMPLETED`, `EXPIRED`, `BLOCKED`), `CallRefusedAtInspectionStage`,
|
|
57
59
|
`CriticalCanisterError`.
|
|
58
60
|
|
|
61
|
+
## For the fronts: the chat (U-43)
|
|
62
|
+
|
|
63
|
+
One chat room per DRIVER in `chat-sharded` (not per ride): its recipient is the owner of
|
|
64
|
+
the driver canister, and every Tigi account may open a chat there (the chat asks the Tigi
|
|
65
|
+
coordinator WHERE the accounts are and the core `isUser`). The core makes the rooms through
|
|
66
|
+
the coordinator; this package only says WHERE — the fronts send and read messages with
|
|
67
|
+
`@jsm-mit/chat-sharded-package` themselves (this package does not wrap the chat).
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { ChatPlacesActor, driverRoomId } from "@jsm-mit/tigi-sharded-package";
|
|
71
|
+
import { ChatsActor, MessagesActor } from "@jsm-mit/chat-sharded-package";
|
|
72
|
+
|
|
73
|
+
// The rider (PR-25): from `accepted` to the end of the ride.
|
|
74
|
+
const place = await request.getChatPlaceAsyncUnsafe(); // { chatCoordinatorId, projectId, roomId } | undefined
|
|
75
|
+
if (place) {
|
|
76
|
+
const chats = new ChatsActor(place.chatCoordinatorId, identity, { host });
|
|
77
|
+
const chat = await chats.openChatAsyncUnsafe({ projectId: place.projectId, roomId: place.roomId, customerName: profile.name });
|
|
78
|
+
// … MessagesActor(place.chatCoordinatorId, identity).postAsyncUnsafe / pollNewMessagesAsyncUnsafe
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// The driver (FK-20): the room of their own canister; they are its recipient.
|
|
82
|
+
const driverPlace = await new ChatPlacesActor(coordinatorId, identity, { host }).getDriverChatPlaceAsyncUnsafe(myDriverCanisterId);
|
|
83
|
+
// list the chats of driverPlace.roomId (ChatsActor.getMyChatsAsyncUnsafe({ projectId, roomId }))
|
|
84
|
+
// and show only the current rider's chat
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- `undefined` = no chat in this environment yet (no chat config in the core) or a
|
|
88
|
+
simulated driver (no chat in MVP).
|
|
89
|
+
- The room id is deterministic: `driverRoomId(canister)` = `drv-<canister id>` (the
|
|
90
|
+
core's `ChatRoomFunctions.driverRoomId`).
|
|
91
|
+
- The rider needs a Tigi profile (`setMyProfileAsyncUnsafe`) — without one the chat
|
|
92
|
+
refuses to open it (`CanisterError`, `NotAuthorized`).
|
|
93
|
+
- One chat per (room, rider, recipients): the rider has one chat with a driver over all
|
|
94
|
+
their rides. A demo pool canister taken over by another tester gets that tester as
|
|
95
|
+
the recipient; the chats with the previous tester stay with them.
|
|
96
|
+
- The room may appear a few seconds after the driver's canister (the core's outbox);
|
|
97
|
+
`openChatAsyncUnsafe` answers `NotFound` until then — try again.
|
|
98
|
+
|
|
59
99
|
The Test Manager (stage and the test modes): `TestManagerActor.hasSimulatedDriversAsyncUnsafe`,
|
|
60
100
|
`spawnDriversAsyncUnsafe` (12 drivers), `setSpeedUpAsyncUnsafe(request, 10)` before choosing.
|
|
61
101
|
Offers of the simulator have `simulated: true`.
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
// WHERE the accounts of a principal are (rule `sharding.md`, "A WHERE answer is a place"):
|
|
2
|
+
// a canister to ask, or a referral to another coordinator to ask the same question (after
|
|
3
|
+
// the core budded into a peer group). The client follows at most 2 referrals.
|
|
4
|
+
type AccountsPlace = variant {
|
|
5
|
+
// Ask this canister `isUser` (today: the core of the group).
|
|
6
|
+
canister : principal;
|
|
7
|
+
// Ask this coordinator `accountsCanisterFor` again.
|
|
8
|
+
coordinator : principal;
|
|
9
|
+
};
|
|
1
10
|
type AssignPrefixArgs = record { prefix : text; worker : principal };
|
|
2
11
|
type CanisterArgs = record { canister : principal };
|
|
12
|
+
// The chat group's admin methods this coordinator calls for its core (rule `sharding.md`,
|
|
13
|
+
// "Between two groups": the coordinator calls for its group). A fixed list: the core
|
|
14
|
+
// composes the arguments and keeps the logic, the coordinator only forwards. A new
|
|
15
|
+
// method of the chat group is a new case here, never a free method name.
|
|
16
|
+
type ChatAdminMethod = variant { updateRoom; createRoom; deleteRoom };
|
|
3
17
|
type CommitWasmArgs = record {
|
|
4
18
|
// Of the whole module. The coordinator refuses a module that does not match.
|
|
5
19
|
sha256 : blob;
|
|
@@ -121,6 +135,16 @@ type Event = record {
|
|
|
121
135
|
kind : text;
|
|
122
136
|
"text" : text;
|
|
123
137
|
};
|
|
138
|
+
// The arguments of the method are the core's, Candid-encoded (`to_candid` in Motoko) —
|
|
139
|
+
// the coordinator does not read them and keeps no copy of the chat group's types.
|
|
140
|
+
type ForwardChatAdminArgs = record {
|
|
141
|
+
method : ChatAdminMethod;
|
|
142
|
+
// The one argument of the method, Candid-encoded.
|
|
143
|
+
args : blob;
|
|
144
|
+
// The chat group's COORDINATOR (the core's chat config) — the group's address. The
|
|
145
|
+
// coordinator asks it where the chat core is.
|
|
146
|
+
chatCoordinator : principal;
|
|
147
|
+
};
|
|
124
148
|
type GeohashesArgs = record { geohashes : vec text };
|
|
125
149
|
// DEPLOYED: fresh from the deploy, the deploy admins rule, no worker exists or is created.
|
|
126
150
|
// LIVE: a person claimed the superadmin role; the group works.
|
|
@@ -320,25 +344,26 @@ type ReportOutboxStuckArgs = record {
|
|
|
320
344
|
};
|
|
321
345
|
type Result = variant { Ok : vec principal; Err : CoordinatorError };
|
|
322
346
|
type Result_1 = variant { Ok : Roles; Err : CoordinatorError };
|
|
323
|
-
type Result_10 = variant { Ok :
|
|
324
|
-
type Result_11 = variant { Ok :
|
|
325
|
-
type Result_12 = variant { Ok :
|
|
326
|
-
type Result_13 = variant { Ok :
|
|
327
|
-
type Result_14 = variant { Ok :
|
|
328
|
-
type Result_15 = variant { Ok :
|
|
329
|
-
type Result_16 = variant { Ok :
|
|
330
|
-
type Result_17 = variant { Ok :
|
|
331
|
-
type Result_18 = variant { Ok :
|
|
332
|
-
type Result_19 = variant { Ok :
|
|
347
|
+
type Result_10 = variant { Ok : vec WorkerLive; Err : CoordinatorError };
|
|
348
|
+
type Result_11 = variant { Ok : bool; Err : CoordinatorError };
|
|
349
|
+
type Result_12 = variant { Ok : vec WorkerRecord; Err : CoordinatorError };
|
|
350
|
+
type Result_13 = variant { Ok : CoreRecord; Err : CoordinatorError };
|
|
351
|
+
type Result_14 = variant { Ok : WorkerStatus; Err : CoordinatorError };
|
|
352
|
+
type Result_15 = variant { Ok : Dependents; Err : CoordinatorError };
|
|
353
|
+
type Result_16 = variant { Ok : Config; Err : CoordinatorError };
|
|
354
|
+
type Result_17 = variant { Ok : SetWorkerConfigResult; Err : CoordinatorError };
|
|
355
|
+
type Result_18 = variant { Ok : WorkerView; Err : CoordinatorError };
|
|
356
|
+
type Result_19 = variant { Ok : SplitResult; Err : CoordinatorError };
|
|
333
357
|
type Result_2 = variant { Ok : vec PrefixEntry; Err : CoordinatorError };
|
|
334
|
-
type Result_20 = variant { Ok :
|
|
358
|
+
type Result_20 = variant { Ok : nat; Err : CoordinatorError };
|
|
359
|
+
type Result_21 = variant { Ok : nat64; Err : CoordinatorError };
|
|
335
360
|
type Result_3 = variant { Ok : WasmInfo; Err : CoordinatorError };
|
|
336
361
|
type Result_4 = variant { Ok : principal; Err : CoordinatorError };
|
|
337
362
|
type Result_5 = variant { Ok : DeletedWorker; Err : CoordinatorError };
|
|
338
363
|
type Result_6 = variant { Ok : vec text; Err : CoordinatorError };
|
|
339
|
-
type Result_7 = variant { Ok :
|
|
340
|
-
type Result_8 = variant { Ok :
|
|
341
|
-
type Result_9 = variant { Ok :
|
|
364
|
+
type Result_7 = variant { Ok : blob; Err : CoordinatorError };
|
|
365
|
+
type Result_8 = variant { Ok : CoreLive; Err : CoordinatorError };
|
|
366
|
+
type Result_9 = variant { Ok : Status; Err : CoordinatorError };
|
|
342
367
|
// Somebody asked for the superadmin role.
|
|
343
368
|
type RoleRequest = record { "principal" : principal; atNs : nat64 };
|
|
344
369
|
// Who rules the group — for the front.
|
|
@@ -477,6 +502,11 @@ type WorkerView = record {
|
|
|
477
502
|
"record" : WorkerRecord;
|
|
478
503
|
};
|
|
479
504
|
service : (InitArgs) -> {
|
|
505
|
+
// KO-16: WHERE the accounts of a principal are — a place: `canister` (ask it `isUser`) or
|
|
506
|
+
// `coordinator` (a referral: ask that coordinator again). Asked by the chat core for a
|
|
507
|
+
// customer of the project whose accounts field names this coordinator. Today `canister` =
|
|
508
|
+
// the core of the group for every principal (null = no core yet). Never the answer itself.
|
|
509
|
+
accountsCanisterFor : (principal) -> (opt AccountsPlace) query;
|
|
480
510
|
// An admin of the core, added by a superadmin through the coordinator.
|
|
481
511
|
addCoreAdmin : (PrincipalArgs) -> (Result);
|
|
482
512
|
// A deploy admin more — a machine that runs seeds or tests. Not in a live prod group.
|
|
@@ -506,8 +536,15 @@ service : (InitArgs) -> {
|
|
|
506
536
|
// KO-9: every prefix of the worker goes to `target`, and the worker is closed. The
|
|
507
537
|
// emptied worker stays until a superadmin deletes it or opens it again.
|
|
508
538
|
drainWorker : (DrainWorkerArgs) -> (Result_6);
|
|
539
|
+
// KO-16: the core only — one admin call on the chat group, made by this coordinator, the
|
|
540
|
+
// admin of the project there. The core composes the argument (`to_candid`) and reads the
|
|
541
|
+
// answer (`from_candid`); the coordinator checks the method against its fixed list, finds
|
|
542
|
+
// the chat core through the chat coordinator, and answers with the chat core's reply as it
|
|
543
|
+
// came (`Ok`), whatever it says. `Err` = the chat group could not be reached: a rejected
|
|
544
|
+
// call forgets the chat core, asks the chat coordinator again and tries once more.
|
|
545
|
+
forwardChatAdmin : (ForwardChatAdminArgs) -> (Result_7);
|
|
509
546
|
// What the core says of itself right now — one composite query for the front.
|
|
510
|
-
getCoreStatus : () -> (
|
|
547
|
+
getCoreStatus : () -> (Result_8) composite_query;
|
|
511
548
|
// The core of the group.
|
|
512
549
|
getHomeCanister : () -> (opt principal) query;
|
|
513
550
|
// The whole prefix map: which worker serves which area.
|
|
@@ -516,10 +553,10 @@ service : (InitArgs) -> {
|
|
|
516
553
|
// ask. The principal who asked is for the superadmin only.
|
|
517
554
|
getRoles : () -> (Roles) query;
|
|
518
555
|
// Everything the superadmin front shows.
|
|
519
|
-
getStatus : () -> (
|
|
556
|
+
getStatus : () -> (Result_9) query;
|
|
520
557
|
// What every worker says of itself right now — one composite query, the workers' own
|
|
521
558
|
// `getStatus` queries inside it. A worker that cannot be asked carries the reason instead.
|
|
522
|
-
getWorkersStatus : () -> (
|
|
559
|
+
getWorkersStatus : () -> (Result_10) composite_query;
|
|
523
560
|
// The superadmin hands the role over to the one who asked.
|
|
524
561
|
handOverSuperadmin : () -> (Result_1);
|
|
525
562
|
// Whether this coordinator still has dependents — the core it owns, or workers, code or
|
|
@@ -532,7 +569,7 @@ service : (InitArgs) -> {
|
|
|
532
569
|
// A test mode only (`prod` and `stage` refuse, and so does the worker): a load put on
|
|
533
570
|
// ONE worker — its per-prefix counters grow, and it reports the level given to the
|
|
534
571
|
// coordinator as a real minute would. What a local script uses to force a split.
|
|
535
|
-
injectWorkerTestLoad : (InjectTestLoadArgs) -> (
|
|
572
|
+
injectWorkerTestLoad : (InjectTestLoadArgs) -> (Result_11);
|
|
536
573
|
// Installs the core wasm on the core: a core without code, or — outside prod — a core
|
|
537
574
|
// that has code (handed over at the install, or a reset). A fresh state, the same canister.
|
|
538
575
|
installCore : () -> (Result_3);
|
|
@@ -550,11 +587,11 @@ service : (InitArgs) -> {
|
|
|
550
587
|
// reaches the areas of several workers (WO-12).
|
|
551
588
|
locateGeohashes : (GeohashesArgs) -> (vec opt principal) query;
|
|
552
589
|
// A superadmin reads the query load of every installed worker now.
|
|
553
|
-
readQueryLoads : () -> (
|
|
590
|
+
readQueryLoads : () -> (Result_12);
|
|
554
591
|
// What the management canister says of the core: its balance and its module.
|
|
555
|
-
refreshCore : () -> (
|
|
592
|
+
refreshCore : () -> (Result_13);
|
|
556
593
|
// What a worker says of itself now. The coordinator keeps the memory and the cycles.
|
|
557
|
-
refreshWorker : (CanisterArgs) -> (
|
|
594
|
+
refreshWorker : (CanisterArgs) -> (Result_14);
|
|
558
595
|
removeCoreAdmin : (PrincipalArgs) -> (Result);
|
|
559
596
|
removeDeployAdmin : (PrincipalArgs) -> (Result_1);
|
|
560
597
|
// KO-10, C-11: the core's balance is below `lowCyclesBelow`: it gets `cyclesPerWorker`,
|
|
@@ -582,28 +619,28 @@ service : (InitArgs) -> {
|
|
|
582
619
|
// installed again from scratch — the same ids, the same cycles, no create fee — and the
|
|
583
620
|
// map starts again: the first worker holds the world. One canister at a time; refused
|
|
584
621
|
// while a split, a drain or an upgrade runs.
|
|
585
|
-
resetGroup : () -> (
|
|
622
|
+
resetGroup : () -> (Result_15);
|
|
586
623
|
// Changes what a superadmin may: `spread`, the cycles of a worker, the own reserve,
|
|
587
624
|
// `maxWorkers`, the query thresholds. Only the fields given are changed.
|
|
588
|
-
setConfig : (SetConfigArgs) -> (
|
|
589
|
-
setCoreLoggingEnabled : (CoreLoggingArgs) -> (
|
|
625
|
+
setConfig : (SetConfigArgs) -> (Result_16);
|
|
626
|
+
setCoreLoggingEnabled : (CoreLoggingArgs) -> (Result_11);
|
|
590
627
|
// The config of the workers of the group: the load thresholds, logging. Only the fields
|
|
591
628
|
// given are changed. The result is stored, given to every worker that has its code, and
|
|
592
629
|
// to every worker created later.
|
|
593
|
-
setWorkerConfig : (WorkerConfigArgs) -> (
|
|
630
|
+
setWorkerConfig : (WorkerConfigArgs) -> (Result_17);
|
|
594
631
|
// Opens a worker to the prefixes of a split again, or closes it without giving anything
|
|
595
632
|
// away.
|
|
596
|
-
setWorkerOpen : (SetWorkerOpenArgs) -> (
|
|
633
|
+
setWorkerOpen : (SetWorkerOpenArgs) -> (Result_18);
|
|
597
634
|
// A superadmin splits a worker now, whatever its load and `spread` (KO-17): a fresh worker
|
|
598
635
|
// takes about half of its prefixes. Answers with the new worker and the prefixes it got.
|
|
599
|
-
splitWorker : (CanisterArgs) -> (
|
|
636
|
+
splitWorker : (CanisterArgs) -> (Result_19);
|
|
600
637
|
// A worker of the group sends its cycles here before it is deleted (`giveBackCycles`).
|
|
601
638
|
// The workers only: somebody else's cycles are refused (they go back to the sender).
|
|
602
639
|
takeCycles : () -> (nat);
|
|
603
640
|
// Cycles for the core, by hand: `cyclesPerWorker`, like a worker's top-up.
|
|
604
|
-
topUpCore : () -> (
|
|
641
|
+
topUpCore : () -> (Result_20);
|
|
605
642
|
// Cycles for a worker, by hand.
|
|
606
|
-
topUpWorker : (CanisterArgs) -> (
|
|
643
|
+
topUpWorker : (CanisterArgs) -> (Result_20);
|
|
607
644
|
// KO-11: a new build of the core: stop → upgrade → start; its state stays (C-12).
|
|
608
645
|
upgradeCore : () -> (Result_3);
|
|
609
646
|
// KO-11: a new worker build on a worker that runs: stop → upgrade → start. Its state
|
|
@@ -611,10 +648,10 @@ service : (InitArgs) -> {
|
|
|
611
648
|
// a split or a drain holds the worker.
|
|
612
649
|
upgradeWorker : (CanisterArgs) -> (Result_3);
|
|
613
650
|
// The core wasm, in chunks like the worker's.
|
|
614
|
-
uploadCoreWasmChunk : (WasmChunkArgs) -> (
|
|
651
|
+
uploadCoreWasmChunk : (WasmChunkArgs) -> (Result_21);
|
|
615
652
|
// One chunk of a NEW worker wasm. The first chunk (index 0) drops what was uploaded
|
|
616
653
|
// before; the module counts only after `commitWorkerWasm`.
|
|
617
|
-
uploadWorkerWasmChunk : (WasmChunkArgs) -> (
|
|
654
|
+
uploadWorkerWasmChunk : (WasmChunkArgs) -> (Result_21);
|
|
618
655
|
// KO-1, KO-2: the worker of the area a geohash lies in — the longest prefix of the map
|
|
619
656
|
// wins. None = no installed worker serves the area (no worker yet, or its worker is being
|
|
620
657
|
// installed). Uncertified: the package checks the answer against `listWorkers`, and a
|
|
@@ -2,8 +2,34 @@ import type { Principal } from '@icp-sdk/core/principal';
|
|
|
2
2
|
import type { ActorMethod } from '@icp-sdk/core/agent';
|
|
3
3
|
import type { IDL } from '@icp-sdk/core/candid';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* WHERE the accounts of a principal are (rule `sharding.md`, "A WHERE answer is a place"):
|
|
7
|
+
* a canister to ask, or a referral to another coordinator to ask the same question (after
|
|
8
|
+
* the core budded into a peer group). The client follows at most 2 referrals.
|
|
9
|
+
*/
|
|
10
|
+
export type AccountsPlace = {
|
|
11
|
+
/**
|
|
12
|
+
* Ask this canister `isUser` (today: the core of the group).
|
|
13
|
+
*/
|
|
14
|
+
'canister' : Principal
|
|
15
|
+
} |
|
|
16
|
+
{
|
|
17
|
+
/**
|
|
18
|
+
* Ask this coordinator `accountsCanisterFor` again.
|
|
19
|
+
*/
|
|
20
|
+
'coordinator' : Principal
|
|
21
|
+
};
|
|
5
22
|
export interface AssignPrefixArgs { 'prefix' : string, 'worker' : Principal }
|
|
6
23
|
export interface CanisterArgs { 'canister' : Principal }
|
|
24
|
+
/**
|
|
25
|
+
* The chat group's admin methods this coordinator calls for its core (rule `sharding.md`,
|
|
26
|
+
* "Between two groups": the coordinator calls for its group). A fixed list: the core
|
|
27
|
+
* composes the arguments and keeps the logic, the coordinator only forwards. A new
|
|
28
|
+
* method of the chat group is a new case here, never a free method name.
|
|
29
|
+
*/
|
|
30
|
+
export type ChatAdminMethod = { 'updateRoom' : null } |
|
|
31
|
+
{ 'createRoom' : null } |
|
|
32
|
+
{ 'deleteRoom' : null };
|
|
7
33
|
export interface CommitWasmArgs {
|
|
8
34
|
/**
|
|
9
35
|
* Of the whole module. The coordinator refuses a module that does not match.
|
|
@@ -201,6 +227,22 @@ export interface Event {
|
|
|
201
227
|
'kind' : string,
|
|
202
228
|
'text' : string,
|
|
203
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* The arguments of the method are the core's, Candid-encoded (`to_candid` in Motoko) —
|
|
232
|
+
* the coordinator does not read them and keeps no copy of the chat group's types.
|
|
233
|
+
*/
|
|
234
|
+
export interface ForwardChatAdminArgs {
|
|
235
|
+
'method' : ChatAdminMethod,
|
|
236
|
+
/**
|
|
237
|
+
* The one argument of the method, Candid-encoded.
|
|
238
|
+
*/
|
|
239
|
+
'args' : Uint8Array | number[],
|
|
240
|
+
/**
|
|
241
|
+
* The chat group's COORDINATOR (the core's chat config) — the group's address. The
|
|
242
|
+
* coordinator asks it where the chat core is.
|
|
243
|
+
*/
|
|
244
|
+
'chatCoordinator' : Principal,
|
|
245
|
+
}
|
|
204
246
|
export interface GeohashesArgs { 'geohashes' : Array<string> }
|
|
205
247
|
/**
|
|
206
248
|
* DEPLOYED: fresh from the deploy, the deploy admins rule, no worker exists or is created.
|
|
@@ -464,30 +506,32 @@ export type Result = { 'Ok' : Array<Principal> } |
|
|
|
464
506
|
{ 'Err' : CoordinatorError };
|
|
465
507
|
export type Result_1 = { 'Ok' : Roles } |
|
|
466
508
|
{ 'Err' : CoordinatorError };
|
|
467
|
-
export type Result_10 = { 'Ok' :
|
|
509
|
+
export type Result_10 = { 'Ok' : Array<WorkerLive> } |
|
|
468
510
|
{ 'Err' : CoordinatorError };
|
|
469
|
-
export type Result_11 = { 'Ok' :
|
|
511
|
+
export type Result_11 = { 'Ok' : boolean } |
|
|
470
512
|
{ 'Err' : CoordinatorError };
|
|
471
|
-
export type Result_12 = { 'Ok' :
|
|
513
|
+
export type Result_12 = { 'Ok' : Array<WorkerRecord> } |
|
|
472
514
|
{ 'Err' : CoordinatorError };
|
|
473
|
-
export type Result_13 = { 'Ok' :
|
|
515
|
+
export type Result_13 = { 'Ok' : CoreRecord } |
|
|
474
516
|
{ 'Err' : CoordinatorError };
|
|
475
|
-
export type Result_14 = { 'Ok' :
|
|
517
|
+
export type Result_14 = { 'Ok' : WorkerStatus } |
|
|
476
518
|
{ 'Err' : CoordinatorError };
|
|
477
|
-
export type Result_15 = { 'Ok' :
|
|
519
|
+
export type Result_15 = { 'Ok' : Dependents } |
|
|
478
520
|
{ 'Err' : CoordinatorError };
|
|
479
|
-
export type Result_16 = { 'Ok' :
|
|
521
|
+
export type Result_16 = { 'Ok' : Config } |
|
|
480
522
|
{ 'Err' : CoordinatorError };
|
|
481
|
-
export type Result_17 = { 'Ok' :
|
|
523
|
+
export type Result_17 = { 'Ok' : SetWorkerConfigResult } |
|
|
482
524
|
{ 'Err' : CoordinatorError };
|
|
483
|
-
export type Result_18 = { 'Ok' :
|
|
525
|
+
export type Result_18 = { 'Ok' : WorkerView } |
|
|
484
526
|
{ 'Err' : CoordinatorError };
|
|
485
|
-
export type Result_19 = { 'Ok' :
|
|
527
|
+
export type Result_19 = { 'Ok' : SplitResult } |
|
|
486
528
|
{ 'Err' : CoordinatorError };
|
|
487
529
|
export type Result_2 = { 'Ok' : Array<PrefixEntry> } |
|
|
488
530
|
{ 'Err' : CoordinatorError };
|
|
489
531
|
export type Result_20 = { 'Ok' : bigint } |
|
|
490
532
|
{ 'Err' : CoordinatorError };
|
|
533
|
+
export type Result_21 = { 'Ok' : bigint } |
|
|
534
|
+
{ 'Err' : CoordinatorError };
|
|
491
535
|
export type Result_3 = { 'Ok' : WasmInfo } |
|
|
492
536
|
{ 'Err' : CoordinatorError };
|
|
493
537
|
export type Result_4 = { 'Ok' : Principal } |
|
|
@@ -496,11 +540,11 @@ export type Result_5 = { 'Ok' : DeletedWorker } |
|
|
|
496
540
|
{ 'Err' : CoordinatorError };
|
|
497
541
|
export type Result_6 = { 'Ok' : Array<string> } |
|
|
498
542
|
{ 'Err' : CoordinatorError };
|
|
499
|
-
export type Result_7 = { 'Ok' :
|
|
543
|
+
export type Result_7 = { 'Ok' : Uint8Array | number[] } |
|
|
500
544
|
{ 'Err' : CoordinatorError };
|
|
501
|
-
export type Result_8 = { 'Ok' :
|
|
545
|
+
export type Result_8 = { 'Ok' : CoreLive } |
|
|
502
546
|
{ 'Err' : CoordinatorError };
|
|
503
|
-
export type Result_9 = { 'Ok' :
|
|
547
|
+
export type Result_9 = { 'Ok' : Status } |
|
|
504
548
|
{ 'Err' : CoordinatorError };
|
|
505
549
|
/**
|
|
506
550
|
* Somebody asked for the superadmin role.
|
|
@@ -711,6 +755,13 @@ export interface WorkerView {
|
|
|
711
755
|
'record' : WorkerRecord,
|
|
712
756
|
}
|
|
713
757
|
export interface _SERVICE {
|
|
758
|
+
/**
|
|
759
|
+
* KO-16: WHERE the accounts of a principal are — a place: `canister` (ask it `isUser`) or
|
|
760
|
+
* `coordinator` (a referral: ask that coordinator again). Asked by the chat core for a
|
|
761
|
+
* customer of the project whose accounts field names this coordinator. Today `canister` =
|
|
762
|
+
* the core of the group for every principal (null = no core yet). Never the answer itself.
|
|
763
|
+
*/
|
|
764
|
+
'accountsCanisterFor' : ActorMethod<[Principal], [] | [AccountsPlace]>,
|
|
714
765
|
/**
|
|
715
766
|
* An admin of the core, added by a superadmin through the coordinator.
|
|
716
767
|
*/
|
|
@@ -760,10 +811,19 @@ export interface _SERVICE {
|
|
|
760
811
|
* emptied worker stays until a superadmin deletes it or opens it again.
|
|
761
812
|
*/
|
|
762
813
|
'drainWorker' : ActorMethod<[DrainWorkerArgs], Result_6>,
|
|
814
|
+
/**
|
|
815
|
+
* KO-16: the core only — one admin call on the chat group, made by this coordinator, the
|
|
816
|
+
* admin of the project there. The core composes the argument (`to_candid`) and reads the
|
|
817
|
+
* answer (`from_candid`); the coordinator checks the method against its fixed list, finds
|
|
818
|
+
* the chat core through the chat coordinator, and answers with the chat core's reply as it
|
|
819
|
+
* came (`Ok`), whatever it says. `Err` = the chat group could not be reached: a rejected
|
|
820
|
+
* call forgets the chat core, asks the chat coordinator again and tries once more.
|
|
821
|
+
*/
|
|
822
|
+
'forwardChatAdmin' : ActorMethod<[ForwardChatAdminArgs], Result_7>,
|
|
763
823
|
/**
|
|
764
824
|
* What the core says of itself right now — one composite query for the front.
|
|
765
825
|
*/
|
|
766
|
-
'getCoreStatus' : ActorMethod<[],
|
|
826
|
+
'getCoreStatus' : ActorMethod<[], Result_8>,
|
|
767
827
|
/**
|
|
768
828
|
* The core of the group.
|
|
769
829
|
*/
|
|
@@ -780,12 +840,12 @@ export interface _SERVICE {
|
|
|
780
840
|
/**
|
|
781
841
|
* Everything the superadmin front shows.
|
|
782
842
|
*/
|
|
783
|
-
'getStatus' : ActorMethod<[],
|
|
843
|
+
'getStatus' : ActorMethod<[], Result_9>,
|
|
784
844
|
/**
|
|
785
845
|
* What every worker says of itself right now — one composite query, the workers' own
|
|
786
846
|
* `getStatus` queries inside it. A worker that cannot be asked carries the reason instead.
|
|
787
847
|
*/
|
|
788
|
-
'getWorkersStatus' : ActorMethod<[],
|
|
848
|
+
'getWorkersStatus' : ActorMethod<[], Result_10>,
|
|
789
849
|
/**
|
|
790
850
|
* The superadmin hands the role over to the one who asked.
|
|
791
851
|
*/
|
|
@@ -806,7 +866,7 @@ export interface _SERVICE {
|
|
|
806
866
|
* ONE worker — its per-prefix counters grow, and it reports the level given to the
|
|
807
867
|
* coordinator as a real minute would. What a local script uses to force a split.
|
|
808
868
|
*/
|
|
809
|
-
'injectWorkerTestLoad' : ActorMethod<[InjectTestLoadArgs],
|
|
869
|
+
'injectWorkerTestLoad' : ActorMethod<[InjectTestLoadArgs], Result_11>,
|
|
810
870
|
/**
|
|
811
871
|
* Installs the core wasm on the core: a core without code, or — outside prod — a core
|
|
812
872
|
* that has code (handed over at the install, or a reset). A fresh state, the same canister.
|
|
@@ -838,15 +898,15 @@ export interface _SERVICE {
|
|
|
838
898
|
/**
|
|
839
899
|
* A superadmin reads the query load of every installed worker now.
|
|
840
900
|
*/
|
|
841
|
-
'readQueryLoads' : ActorMethod<[],
|
|
901
|
+
'readQueryLoads' : ActorMethod<[], Result_12>,
|
|
842
902
|
/**
|
|
843
903
|
* What the management canister says of the core: its balance and its module.
|
|
844
904
|
*/
|
|
845
|
-
'refreshCore' : ActorMethod<[],
|
|
905
|
+
'refreshCore' : ActorMethod<[], Result_13>,
|
|
846
906
|
/**
|
|
847
907
|
* What a worker says of itself now. The coordinator keeps the memory and the cycles.
|
|
848
908
|
*/
|
|
849
|
-
'refreshWorker' : ActorMethod<[CanisterArgs],
|
|
909
|
+
'refreshWorker' : ActorMethod<[CanisterArgs], Result_14>,
|
|
850
910
|
'removeCoreAdmin' : ActorMethod<[PrincipalArgs], Result>,
|
|
851
911
|
'removeDeployAdmin' : ActorMethod<[PrincipalArgs], Result_1>,
|
|
852
912
|
/**
|
|
@@ -888,29 +948,29 @@ export interface _SERVICE {
|
|
|
888
948
|
* map starts again: the first worker holds the world. One canister at a time; refused
|
|
889
949
|
* while a split, a drain or an upgrade runs.
|
|
890
950
|
*/
|
|
891
|
-
'resetGroup' : ActorMethod<[],
|
|
951
|
+
'resetGroup' : ActorMethod<[], Result_15>,
|
|
892
952
|
/**
|
|
893
953
|
* Changes what a superadmin may: `spread`, the cycles of a worker, the own reserve,
|
|
894
954
|
* `maxWorkers`, the query thresholds. Only the fields given are changed.
|
|
895
955
|
*/
|
|
896
|
-
'setConfig' : ActorMethod<[SetConfigArgs],
|
|
897
|
-
'setCoreLoggingEnabled' : ActorMethod<[CoreLoggingArgs],
|
|
956
|
+
'setConfig' : ActorMethod<[SetConfigArgs], Result_16>,
|
|
957
|
+
'setCoreLoggingEnabled' : ActorMethod<[CoreLoggingArgs], Result_11>,
|
|
898
958
|
/**
|
|
899
959
|
* The config of the workers of the group: the load thresholds, logging. Only the fields
|
|
900
960
|
* given are changed. The result is stored, given to every worker that has its code, and
|
|
901
961
|
* to every worker created later.
|
|
902
962
|
*/
|
|
903
|
-
'setWorkerConfig' : ActorMethod<[WorkerConfigArgs],
|
|
963
|
+
'setWorkerConfig' : ActorMethod<[WorkerConfigArgs], Result_17>,
|
|
904
964
|
/**
|
|
905
965
|
* Opens a worker to the prefixes of a split again, or closes it without giving anything
|
|
906
966
|
* away.
|
|
907
967
|
*/
|
|
908
|
-
'setWorkerOpen' : ActorMethod<[SetWorkerOpenArgs],
|
|
968
|
+
'setWorkerOpen' : ActorMethod<[SetWorkerOpenArgs], Result_18>,
|
|
909
969
|
/**
|
|
910
970
|
* A superadmin splits a worker now, whatever its load and `spread` (KO-17): a fresh worker
|
|
911
971
|
* takes about half of its prefixes. Answers with the new worker and the prefixes it got.
|
|
912
972
|
*/
|
|
913
|
-
'splitWorker' : ActorMethod<[CanisterArgs],
|
|
973
|
+
'splitWorker' : ActorMethod<[CanisterArgs], Result_19>,
|
|
914
974
|
/**
|
|
915
975
|
* A worker of the group sends its cycles here before it is deleted (`giveBackCycles`).
|
|
916
976
|
* The workers only: somebody else's cycles are refused (they go back to the sender).
|
|
@@ -919,11 +979,11 @@ export interface _SERVICE {
|
|
|
919
979
|
/**
|
|
920
980
|
* Cycles for the core, by hand: `cyclesPerWorker`, like a worker's top-up.
|
|
921
981
|
*/
|
|
922
|
-
'topUpCore' : ActorMethod<[],
|
|
982
|
+
'topUpCore' : ActorMethod<[], Result_20>,
|
|
923
983
|
/**
|
|
924
984
|
* Cycles for a worker, by hand.
|
|
925
985
|
*/
|
|
926
|
-
'topUpWorker' : ActorMethod<[CanisterArgs],
|
|
986
|
+
'topUpWorker' : ActorMethod<[CanisterArgs], Result_20>,
|
|
927
987
|
/**
|
|
928
988
|
* KO-11: a new build of the core: stop → upgrade → start; its state stays (C-12).
|
|
929
989
|
*/
|
|
@@ -937,12 +997,12 @@ export interface _SERVICE {
|
|
|
937
997
|
/**
|
|
938
998
|
* The core wasm, in chunks like the worker's.
|
|
939
999
|
*/
|
|
940
|
-
'uploadCoreWasmChunk' : ActorMethod<[WasmChunkArgs],
|
|
1000
|
+
'uploadCoreWasmChunk' : ActorMethod<[WasmChunkArgs], Result_21>,
|
|
941
1001
|
/**
|
|
942
1002
|
* One chunk of a NEW worker wasm. The first chunk (index 0) drops what was uploaded
|
|
943
1003
|
* before; the module counts only after `commitWorkerWasm`.
|
|
944
1004
|
*/
|
|
945
|
-
'uploadWorkerWasmChunk' : ActorMethod<[WasmChunkArgs],
|
|
1005
|
+
'uploadWorkerWasmChunk' : ActorMethod<[WasmChunkArgs], Result_21>,
|
|
946
1006
|
/**
|
|
947
1007
|
* KO-1, KO-2: the worker of the area a geohash lies in — the longest prefix of the map
|
|
948
1008
|
* wins. None = no installed worker serves the area (no worker yet, or its worker is being
|