Skip to content

Commit c3a94f1

Browse files
Service Protocol V4 (#477)
1 parent 57a595a commit c3a94f1

16 files changed

+2423
-3480
lines changed
Lines changed: 35 additions & 216 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
/* tslint:disable */
22
/* eslint-disable */
33
/**
4-
* Setups the WASM module
5-
*/
4+
* Setups the WASM module
5+
*/
66
export function start(): void;
77
/**
8-
* This will set the log level of the overall log subscriber.
9-
* @param {LogLevel} level
10-
*/
8+
* This will set the log level of the overall log subscriber.
9+
*/
1110
export function set_log_level(level: LogLevel): void;
12-
/**
13-
*/
11+
export function cancel_handle(): number;
1412
export enum LogLevel {
1513
TRACE = 0,
1614
DEBUG = 1,
@@ -23,8 +21,6 @@ export interface WasmFailure {
2321
message: string;
2422
}
2523

26-
export type WasmSendHandle = number;
27-
2824
export interface WasmExponentialRetryConfig {
2925
initial_interval: number | undefined;
3026
factor: number;
@@ -38,256 +34,79 @@ export interface WasmAwakeable {
3834
handle: number;
3935
}
4036

41-
export type WasmAsyncResultValue = "NotReady" | "Empty" | { Success: Uint8Array } | { Failure: WasmFailure } | { StateKeys: string[] } | { InvocationId: string } | { CombinatorResult: WasmAsyncResultHandle[] };
37+
export type WasmAsyncResultValue = "NotReady" | "Empty" | { Success: Uint8Array } | { Failure: WasmFailure } | { StateKeys: string[] } | { InvocationId: string };
4238

43-
export type WasmRunEnterResult = { ExecutedWithSuccess: Uint8Array } | { ExecutedWithFailure: WasmFailure } | "NotExecuted";
39+
export type WasmDoProgressResult = "AnyCompleted" | "ReadFromInput" | "WaitingPendingRun" | { ExecuteRun: number } | "CancelSignalReceived";
40+
41+
export interface WasmCallHandle {
42+
invocation_id_completion_id: number;
43+
call_completion_id: number;
44+
}
45+
46+
export interface WasmSendHandle {
47+
invocation_id_completion_id: number;
48+
}
4449

45-
/**
46-
*/
4750
export class WasmHeader {
4851
free(): void;
49-
/**
50-
* @param {string} key
51-
* @param {string} value
52-
*/
5352
constructor(key: string, value: string);
54-
/**
55-
*/
5653
readonly key: string;
57-
/**
58-
*/
5954
readonly value: string;
6055
}
61-
/**
62-
*/
6356
export class WasmIdentityVerifier {
6457
free(): void;
65-
/**
66-
* @param {(string)[]} keys
67-
*/
68-
constructor(keys: (string)[]);
69-
/**
70-
* @param {string} path
71-
* @param {(WasmHeader)[]} headers
72-
*/
73-
verify_identity(path: string, headers: (WasmHeader)[]): void;
58+
constructor(keys: string[]);
59+
verify_identity(path: string, headers: WasmHeader[]): void;
7460
}
75-
/**
76-
*/
7761
export class WasmInput {
62+
private constructor();
7863
free(): void;
79-
/**
80-
*/
81-
readonly headers: (WasmHeader)[];
82-
/**
83-
*/
84-
readonly input: Uint8Array;
85-
/**
86-
*/
8764
readonly invocation_id: string;
88-
/**
89-
*/
9065
readonly key: string;
66+
readonly headers: WasmHeader[];
67+
readonly input: Uint8Array;
9168
}
92-
/**
93-
*/
9469
export class WasmResponseHead {
70+
private constructor();
9571
free(): void;
96-
/**
97-
*/
98-
readonly headers: (WasmHeader)[];
99-
/**
100-
*/
10172
readonly status_code: number;
73+
readonly headers: WasmHeader[];
10274
}
103-
/**
104-
*/
10575
export class WasmVM {
10676
free(): void;
107-
/**
108-
* @param {(WasmHeader)[]} headers
109-
* @param {LogLevel} log_level
110-
* @param {number} logger_id
111-
*/
112-
constructor(headers: (WasmHeader)[], log_level: LogLevel, logger_id: number);
113-
/**
114-
* @returns {WasmResponseHead}
115-
*/
77+
constructor(headers: WasmHeader[], log_level: LogLevel, logger_id: number);
11678
get_response_head(): WasmResponseHead;
117-
/**
118-
* @param {Uint8Array} buffer
119-
*/
12079
notify_input(buffer: Uint8Array): void;
121-
/**
122-
*/
12380
notify_input_closed(): void;
124-
/**
125-
* @param {string} error_message
126-
* @param {string | undefined} [error_description]
127-
*/
128-
notify_error(error_message: string, error_description?: string): void;
129-
/**
130-
* @returns {any}
131-
*/
81+
notify_error(error_message: string, stacktrace?: string | null): void;
13282
take_output(): any;
133-
/**
134-
* @returns {boolean}
135-
*/
13683
is_ready_to_execute(): boolean;
137-
/**
138-
* @param {number} handle
139-
*/
140-
notify_await_point(handle: number): void;
141-
/**
142-
* @param {number} handle
143-
* @returns {WasmAsyncResultValue}
144-
*/
145-
take_async_result(handle: number): WasmAsyncResultValue;
146-
/**
147-
* @returns {WasmInput}
148-
*/
84+
is_completed(handle: number): boolean;
85+
do_progress(handles: Uint32Array): WasmDoProgressResult;
86+
take_notification(handle: number): WasmAsyncResultValue;
14987
sys_input(): WasmInput;
150-
/**
151-
* @param {string} key
152-
* @returns {number}
153-
*/
15488
sys_get_state(key: string): number;
155-
/**
156-
* @returns {number}
157-
*/
15889
sys_get_state_keys(): number;
159-
/**
160-
* @param {string} key
161-
* @param {Uint8Array} buffer
162-
*/
16390
sys_set_state(key: string, buffer: Uint8Array): void;
164-
/**
165-
* @param {string} key
166-
*/
16791
sys_clear_state(key: string): void;
168-
/**
169-
*/
17092
sys_clear_all_state(): void;
171-
/**
172-
* @param {bigint} millis
173-
* @returns {number}
174-
*/
17593
sys_sleep(millis: bigint): number;
176-
/**
177-
* @param {string} service
178-
* @param {string} handler
179-
* @param {Uint8Array} buffer
180-
* @param {string | undefined} key
181-
* @param {(WasmHeader)[]} headers
182-
* @returns {number}
183-
*/
184-
sys_call(service: string, handler: string, buffer: Uint8Array, key: string | undefined, headers: (WasmHeader)[]): number;
185-
/**
186-
* @param {string} service
187-
* @param {string} handler
188-
* @param {Uint8Array} buffer
189-
* @param {string | undefined} key
190-
* @param {(WasmHeader)[]} headers
191-
* @param {bigint | undefined} [delay]
192-
* @returns {WasmSendHandle}
193-
*/
194-
sys_send(service: string, handler: string, buffer: Uint8Array, key: string | undefined, headers: (WasmHeader)[], delay?: bigint): WasmSendHandle;
195-
/**
196-
* @returns {WasmAwakeable}
197-
*/
94+
sys_call(service: string, handler: string, buffer: Uint8Array, key: string | null | undefined, headers: WasmHeader[]): WasmCallHandle;
95+
sys_send(service: string, handler: string, buffer: Uint8Array, key: string | null | undefined, headers: WasmHeader[], delay?: bigint | null): WasmSendHandle;
19896
sys_awakeable(): WasmAwakeable;
199-
/**
200-
* @param {string} id
201-
* @param {Uint8Array} buffer
202-
*/
20397
sys_complete_awakeable_success(id: string, buffer: Uint8Array): void;
204-
/**
205-
* @param {string} id
206-
* @param {WasmFailure} value
207-
*/
20898
sys_complete_awakeable_failure(id: string, value: WasmFailure): void;
209-
/**
210-
* @param {string} key
211-
* @returns {number}
212-
*/
21399
sys_get_promise(key: string): number;
214-
/**
215-
* @param {string} key
216-
* @returns {number}
217-
*/
218100
sys_peek_promise(key: string): number;
219-
/**
220-
* @param {string} key
221-
* @param {Uint8Array} buffer
222-
* @returns {number}
223-
*/
224101
sys_complete_promise_success(key: string, buffer: Uint8Array): number;
225-
/**
226-
* @param {string} key
227-
* @param {WasmFailure} value
228-
* @returns {number}
229-
*/
230102
sys_complete_promise_failure(key: string, value: WasmFailure): number;
231-
/**
232-
* @param {string} name
233-
* @returns {WasmRunEnterResult}
234-
*/
235-
sys_run_enter(name: string): WasmRunEnterResult;
236-
/**
237-
* @param {Uint8Array} buffer
238-
* @returns {number}
239-
*/
240-
sys_run_exit_success(buffer: Uint8Array): number;
241-
/**
242-
* @param {WasmFailure} value
243-
* @returns {number}
244-
*/
245-
sys_run_exit_failure(value: WasmFailure): number;
246-
/**
247-
* @param {string} error_message
248-
* @param {string | undefined} error_description
249-
* @param {bigint} attempt_duration
250-
* @param {WasmExponentialRetryConfig} config
251-
* @returns {number}
252-
*/
253-
sys_run_exit_failure_transient(error_message: string, error_description: string | undefined, attempt_duration: bigint, config: WasmExponentialRetryConfig): number;
254-
/**
255-
* @param {Uint8Array} buffer
256-
*/
103+
sys_run(name: string): number;
104+
propose_run_completion_success(handle: number, buffer: Uint8Array): void;
105+
propose_run_completion_failure(handle: number, value: WasmFailure): void;
106+
propose_run_completion_failure_transient(handle: number, error_message: string, error_stacktrace: string | null | undefined, attempt_duration: bigint, config: WasmExponentialRetryConfig): void;
107+
sys_cancel_invocation(target_invocation_id: string): void;
257108
sys_write_output_success(buffer: Uint8Array): void;
258-
/**
259-
* @param {WasmFailure} value
260-
*/
261109
sys_write_output_failure(value: WasmFailure): void;
262-
/**
263-
*/
264110
sys_end(): void;
265-
/**
266-
* @returns {boolean}
267-
*/
268111
is_processing(): boolean;
269-
/**
270-
* @returns {boolean}
271-
*/
272-
is_inside_run(): boolean;
273-
/**
274-
* @param {Uint32Array} handles
275-
* @returns {number | undefined}
276-
*/
277-
sys_try_complete_all_combinator(handles: Uint32Array): number | undefined;
278-
/**
279-
* @param {Uint32Array} handles
280-
* @returns {number | undefined}
281-
*/
282-
sys_try_complete_any_combinator(handles: Uint32Array): number | undefined;
283-
/**
284-
* @param {Uint32Array} handles
285-
* @returns {number | undefined}
286-
*/
287-
sys_try_complete_all_settled_combinator(handles: Uint32Array): number | undefined;
288-
/**
289-
* @param {Uint32Array} handles
290-
* @returns {number | undefined}
291-
*/
292-
sys_try_complete_race_combinator(handles: Uint32Array): number | undefined;
293112
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
21
import * as wasm from "./sdk_shared_core_wasm_bindings_bg.wasm";
2+
export * from "./sdk_shared_core_wasm_bindings_bg.js";
33
import { __wbg_set_wasm } from "./sdk_shared_core_wasm_bindings_bg.js";
44
__wbg_set_wasm(wasm);
5-
export * from "./sdk_shared_core_wasm_bindings_bg.js";
6-
75
wasm.__wbindgen_start();

0 commit comments

Comments
 (0)