@restatedev/restate-sdk 0.7.0 → 0.7.2-worker
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/dist/cloudflare_bundle.js +26133 -0
- package/dist/io/encoder.d.ts +2 -1
- package/dist/io/encoder.d.ts.map +1 -1
- package/package.json +6 -3
- package/dist/connection/buffered_connection.js +0 -44
- package/dist/connection/buffered_connection.js.map +0 -1
- package/dist/connection/connection.js +0 -13
- package/dist/connection/connection.js.map +0 -1
- package/dist/connection/embedded_connection.js +0 -59
- package/dist/connection/embedded_connection.js.map +0 -1
- package/dist/connection/http_connection.js +0 -203
- package/dist/connection/http_connection.js.map +0 -1
- package/dist/connection/lambda_connection.js +0 -58
- package/dist/connection/lambda_connection.js.map +0 -1
- package/dist/embedded/api.js +0 -35
- package/dist/embedded/api.js.map +0 -1
- package/dist/embedded/handler.js +0 -28
- package/dist/embedded/handler.js.map +0 -1
- package/dist/embedded/http2_remote.js +0 -91
- package/dist/embedded/http2_remote.js.map +0 -1
- package/dist/embedded/invocation.js +0 -94
- package/dist/embedded/invocation.js.map +0 -1
- package/dist/generated/dev/restate/events.js +0 -371
- package/dist/generated/dev/restate/events.js.map +0 -1
- package/dist/generated/dev/restate/ext.js +0 -215
- package/dist/generated/dev/restate/ext.js.map +0 -1
- package/dist/generated/google/protobuf/descriptor.js +0 -6676
- package/dist/generated/google/protobuf/descriptor.js.map +0 -1
- package/dist/generated/google/protobuf/empty.js +0 -107
- package/dist/generated/google/protobuf/empty.js.map +0 -1
- package/dist/generated/google/protobuf/struct.js +0 -754
- package/dist/generated/google/protobuf/struct.js.map +0 -1
- package/dist/generated/proto/discovery.js +0 -364
- package/dist/generated/proto/discovery.js.map +0 -1
- package/dist/generated/proto/dynrpc.js +0 -668
- package/dist/generated/proto/dynrpc.js.map +0 -1
- package/dist/generated/proto/javascript.js +0 -297
- package/dist/generated/proto/javascript.js.map +0 -1
- package/dist/generated/proto/protocol.js +0 -2398
- package/dist/generated/proto/protocol.js.map +0 -1
- package/dist/generated/proto/services.js +0 -1535
- package/dist/generated/proto/services.js.map +0 -1
- package/dist/generated/proto/test.js +0 -321
- package/dist/generated/proto/test.js.map +0 -1
- package/dist/invocation.js +0 -154
- package/dist/invocation.js.map +0 -1
- package/dist/io/decoder.js +0 -133
- package/dist/io/decoder.js.map +0 -1
- package/dist/io/encoder.js +0 -68
- package/dist/io/encoder.js.map +0 -1
- package/dist/journal.js +0 -372
- package/dist/journal.js.map +0 -1
- package/dist/local_state_store.js +0 -72
- package/dist/local_state_store.js.map +0 -1
- package/dist/public_api.js +0 -58
- package/dist/public_api.js.map +0 -1
- package/dist/restate_context.js +0 -46
- package/dist/restate_context.js.map +0 -1
- package/dist/restate_context_impl.js +0 -375
- package/dist/restate_context_impl.js.map +0 -1
- package/dist/server/base_restate_server.js +0 -364
- package/dist/server/base_restate_server.js.map +0 -1
- package/dist/server/restate_lambda_handler.js +0 -247
- package/dist/server/restate_lambda_handler.js.map +0 -1
- package/dist/server/restate_server.js +0 -186
- package/dist/server/restate_server.js.map +0 -1
- package/dist/state_machine.js +0 -403
- package/dist/state_machine.js.map +0 -1
- package/dist/types/errors.js +0 -267
- package/dist/types/errors.js.map +0 -1
- package/dist/types/grpc.js +0 -68
- package/dist/types/grpc.js.map +0 -1
- package/dist/types/protocol.js +0 -125
- package/dist/types/protocol.js.map +0 -1
- package/dist/types/router.js +0 -36
- package/dist/types/router.js.map +0 -1
- package/dist/types/types.js +0 -126
- package/dist/types/types.js.map +0 -1
- package/dist/utils/assumpsions.js +0 -101
- package/dist/utils/assumpsions.js.map +0 -1
- package/dist/utils/logger.js +0 -102
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/public_utils.js +0 -49
- package/dist/utils/public_utils.js.map +0 -1
- package/dist/utils/rand.js +0 -114
- package/dist/utils/rand.js.map +0 -1
- package/dist/utils/utils.js +0 -144
- package/dist/utils/utils.js.map +0 -1
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
|
|
4
|
-
*
|
|
5
|
-
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
6
|
-
* which is released under the MIT license.
|
|
7
|
-
*
|
|
8
|
-
* You can find a copy of the license in file LICENSE in the root
|
|
9
|
-
* directory of this repository or package, or at
|
|
10
|
-
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
11
|
-
*/
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.createServer = void 0;
|
|
17
|
-
const stream_1 = __importDefault(require("stream"));
|
|
18
|
-
const promises_1 = require("stream/promises");
|
|
19
|
-
const http2_1 = __importDefault(require("http2"));
|
|
20
|
-
const url_1 = require("url");
|
|
21
|
-
const discovery_1 = require("../generated/proto/discovery");
|
|
22
|
-
const base_restate_server_1 = require("./base_restate_server");
|
|
23
|
-
const logger_1 = require("../utils/logger");
|
|
24
|
-
const http_connection_1 = require("../connection/http_connection");
|
|
25
|
-
const errors_1 = require("../types/errors");
|
|
26
|
-
const invocation_1 = require("../invocation");
|
|
27
|
-
const state_machine_1 = require("../state_machine");
|
|
28
|
-
/**
|
|
29
|
-
* Creates a Restate entrypoint based on a HTTP2 server. The entrypoint will listen
|
|
30
|
-
* for requests to the services at a specified port.
|
|
31
|
-
*
|
|
32
|
-
* This is the entrypoint to be used in most scenarios (standalone, Docker, Kubernetes, ...);
|
|
33
|
-
* any deployments that forwards requests to a network endpoint. The prominent exception is
|
|
34
|
-
* AWS Lambda, which uses the {@link restate_lambda_handler#lambdaApiGatewayHandler}
|
|
35
|
-
* function to create an entry point.
|
|
36
|
-
*
|
|
37
|
-
* After creating this endpoint, register services on this entrypoint via {@link RestateServer.bindService }
|
|
38
|
-
* and start it via {@link RestateServer.listen }.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* A typical entry point would look like this:
|
|
42
|
-
* ```
|
|
43
|
-
* import * as restate from "@restatedev/restate-sdk";
|
|
44
|
-
*
|
|
45
|
-
* export const handler = restate
|
|
46
|
-
* .createServer()
|
|
47
|
-
* .bindService({
|
|
48
|
-
* service: "MyService",
|
|
49
|
-
* instance: new myService.MyServiceImpl(),
|
|
50
|
-
* descriptor: myService.protoMetadata,
|
|
51
|
-
* })
|
|
52
|
-
* .listen(8000);
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
function createServer() {
|
|
56
|
-
// See https://stackoverflow.com/questions/16508435/implementing-typescript-interface-with-bare-function-signature-plus-other-fields/16508581#16508581
|
|
57
|
-
// for more details on how we implement the RestateServer interface.
|
|
58
|
-
const restateServerImpl = new RestateServerImpl();
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
-
const instance = (request, response) => {
|
|
61
|
-
restateServerImpl.acceptConnection(request, response);
|
|
62
|
-
};
|
|
63
|
-
instance.bindKeyedRouter = (path, router) => {
|
|
64
|
-
restateServerImpl.bindKeyedRouter(path, router);
|
|
65
|
-
return instance;
|
|
66
|
-
};
|
|
67
|
-
instance.bindRouter = (path, router) => {
|
|
68
|
-
restateServerImpl.bindRouter(path, router);
|
|
69
|
-
return instance;
|
|
70
|
-
};
|
|
71
|
-
instance.bindService = (serviceOpts) => {
|
|
72
|
-
restateServerImpl.bindService(serviceOpts);
|
|
73
|
-
return instance;
|
|
74
|
-
};
|
|
75
|
-
instance.listen = (port) => {
|
|
76
|
-
const actualPort = port ?? parseInt(process.env.PORT ?? "9080");
|
|
77
|
-
logger_1.rlog.info(`Listening on ${actualPort}...`);
|
|
78
|
-
const server = http2_1.default.createServer(instance);
|
|
79
|
-
server.listen(actualPort);
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
81
|
-
return new Promise(() => { });
|
|
82
|
-
};
|
|
83
|
-
return instance;
|
|
84
|
-
}
|
|
85
|
-
exports.createServer = createServer;
|
|
86
|
-
class RestateServerImpl extends base_restate_server_1.BaseRestateServer {
|
|
87
|
-
constructor() {
|
|
88
|
-
super(discovery_1.ProtocolMode.BIDI_STREAM);
|
|
89
|
-
}
|
|
90
|
-
bindKeyedRouter(path, router) {
|
|
91
|
-
// Implementation note: This override if here mainly to change the return type to the more
|
|
92
|
-
// concrete type RestateServer (from BaseRestateServer).
|
|
93
|
-
super.bindRpcService(path, router, true);
|
|
94
|
-
}
|
|
95
|
-
bindRouter(path, router) {
|
|
96
|
-
// Implementation note: This override if here mainly to change the return type to the more
|
|
97
|
-
// concrete type RestateServer (from BaseRestateServer).
|
|
98
|
-
super.bindRpcService(path, router, false);
|
|
99
|
-
}
|
|
100
|
-
bindService(serviceOpts) {
|
|
101
|
-
// Implementation note: This override if here mainly to change the return type to the more
|
|
102
|
-
// concrete type RestateServer (from BaseRestateServer).
|
|
103
|
-
super.bindService(serviceOpts);
|
|
104
|
-
}
|
|
105
|
-
acceptConnection(request,
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
107
|
-
_response) {
|
|
108
|
-
const stream = request.stream;
|
|
109
|
-
const url = (0, url_1.parse)(request.url ?? "/");
|
|
110
|
-
this.handleConnection(url, stream).catch((e) => {
|
|
111
|
-
const error = (0, errors_1.ensureError)(e);
|
|
112
|
-
logger_1.rlog.error("Error while handling connection: " + (error.stack ?? error.message));
|
|
113
|
-
stream.end();
|
|
114
|
-
stream.destroy();
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
async handleConnection(url, stream) {
|
|
118
|
-
const method = this.methodByUrl(url.path);
|
|
119
|
-
if (method !== undefined) {
|
|
120
|
-
// valid connection, let's dispatch the invocation
|
|
121
|
-
stream.respond({
|
|
122
|
-
"content-type": "application/restate",
|
|
123
|
-
":status": 200,
|
|
124
|
-
});
|
|
125
|
-
const restateStream = http_connection_1.RestateHttp2Connection.from(stream);
|
|
126
|
-
await handleInvocation(method, restateStream);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
// no method under that name. might be a discovery request
|
|
130
|
-
if (url.path == "/discover") {
|
|
131
|
-
logger_1.rlog.info("Answering discovery request. Announcing services: " +
|
|
132
|
-
JSON.stringify(this.discovery.services));
|
|
133
|
-
await respondDiscovery(this.discovery, stream);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
// no discovery, so unknown method: 404
|
|
137
|
-
logger_1.rlog.error(`No service and function found for URL ${url.path}`);
|
|
138
|
-
await respondNotFound(stream);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
async function respondDiscovery(response, http2Stream) {
|
|
142
|
-
const responseData = discovery_1.ServiceDiscoveryResponse.encode(response).finish();
|
|
143
|
-
http2Stream.respond({
|
|
144
|
-
":status": 200,
|
|
145
|
-
"content-type": "application/proto",
|
|
146
|
-
});
|
|
147
|
-
await (0, promises_1.pipeline)(stream_1.default.Readable.from(responseData), http2Stream, {
|
|
148
|
-
end: true,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
async function respondNotFound(stream) {
|
|
152
|
-
stream.respond({
|
|
153
|
-
"content-type": "application/restate",
|
|
154
|
-
":status": 404,
|
|
155
|
-
});
|
|
156
|
-
stream.end();
|
|
157
|
-
await (0, promises_1.finished)(stream);
|
|
158
|
-
}
|
|
159
|
-
async function handleInvocation(func, connection) {
|
|
160
|
-
// step 1: collect all journal events
|
|
161
|
-
const journalBuilder = new invocation_1.InvocationBuilder(func);
|
|
162
|
-
connection.pipeToConsumer(journalBuilder);
|
|
163
|
-
try {
|
|
164
|
-
await journalBuilder.completion();
|
|
165
|
-
}
|
|
166
|
-
finally {
|
|
167
|
-
// ensure GC friendliness, also in case of errors
|
|
168
|
-
connection.removeCurrentConsumer();
|
|
169
|
-
}
|
|
170
|
-
// step 2: create the state machine
|
|
171
|
-
const stateMachine = new state_machine_1.StateMachine(connection, journalBuilder.build(), discovery_1.ProtocolMode.BIDI_STREAM);
|
|
172
|
-
connection.pipeToConsumer(stateMachine);
|
|
173
|
-
// step 3: invoke the function
|
|
174
|
-
// This call would propagate errors in the state machine logic, but not errors
|
|
175
|
-
// in the application function code. Ending a function with an error as well
|
|
176
|
-
// as failign an invocation and being retried are perfectly valid actions from the
|
|
177
|
-
// SDK's perspective.
|
|
178
|
-
try {
|
|
179
|
-
await stateMachine.invoke();
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
// ensure GC friendliness, also in case of errors
|
|
183
|
-
connection.removeCurrentConsumer();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
//# sourceMappingURL=restate_server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"restate_server.js","sourceRoot":"","sources":["../../src/server/restate_server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AAEH,oDAA4B;AAC5B,8CAAqD;AACrD,kDAAuE;AACvE,6BAA6C;AAC7C,4DAGsC;AACtC,+DAAuE;AACvE,4CAAuC;AACvC,mEAAuE;AAEvE,4CAA8C;AAC9C,8CAAkD;AAClD,oDAAgD;AAyEhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,YAAY;IAC1B,sJAAsJ;IACtJ,oEAAoE;IAEpE,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAClD,8DAA8D;IAC9D,MAAM,QAAQ,GAAQ,CACpB,OAA2B,EAC3B,QAA6B,EAC7B,EAAE;QACF,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC;IACF,QAAQ,CAAC,eAAe,GAAG,CAAI,IAAY,EAAE,MAAwB,EAAE,EAAE;QACvE,iBAAiB,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IACF,QAAQ,CAA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,IAAI,4BAAY,CACnC,UAAU,EACV,cAAc,CAAC,KAAK,EAAE,EACtB,wBAAY,CAAC,WAAW,CACzB,CAAC;IACF,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IAExC,8BAA8B;IAE9B,8EAA8E;IAC9E,4EAA4E;IAC5E,kFAAkF;IAClF,qBAAqB;IACrB,IAAI;QACF,MAAM,YAAY,CAAC,MAAM,EAAE,CAAC;KAC7B;YAAS;QACR,iDAAiD;QACjD,UAAU,CAAC,qBAAqB,EAAE,CAAC;KACpC;AACH,CAAC"}
|
package/dist/state_machine.js
DELETED
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023 - Restate Software, Inc., Restate GmbH
|
|
4
|
-
*
|
|
5
|
-
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
6
|
-
* which is released under the MIT license.
|
|
7
|
-
*
|
|
8
|
-
* You can find a copy of the license in file LICENSE in the root
|
|
9
|
-
* directory of this repository or package, or at
|
|
10
|
-
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
11
|
-
*/
|
|
12
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(o, k2, desc);
|
|
19
|
-
}) : (function(o, m, k, k2) {
|
|
20
|
-
if (k2 === undefined) k2 = k;
|
|
21
|
-
o[k2] = m[k];
|
|
22
|
-
}));
|
|
23
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
-
}) : function(o, v) {
|
|
26
|
-
o["default"] = v;
|
|
27
|
-
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.StateMachine = void 0;
|
|
37
|
-
const p = __importStar(require("./types/protocol"));
|
|
38
|
-
const restate_context_impl_1 = require("./restate_context_impl");
|
|
39
|
-
const discovery_1 = require("./generated/proto/discovery");
|
|
40
|
-
const types_1 = require("./types/types");
|
|
41
|
-
const utils_1 = require("./utils/utils");
|
|
42
|
-
const logger_1 = require("./utils/logger");
|
|
43
|
-
const timers_1 = require("timers");
|
|
44
|
-
const protocol_1 = require("./types/protocol");
|
|
45
|
-
const journal_1 = require("./journal");
|
|
46
|
-
const errors_1 = require("./types/errors");
|
|
47
|
-
class StateMachine {
|
|
48
|
-
connection;
|
|
49
|
-
invocation;
|
|
50
|
-
protocolMode;
|
|
51
|
-
suspensionMillis;
|
|
52
|
-
journal;
|
|
53
|
-
restateContext;
|
|
54
|
-
invocationComplete = new utils_1.CompletablePromise();
|
|
55
|
-
// when this flag is true, no more work will (and may) happen
|
|
56
|
-
// this is set to true in case of
|
|
57
|
-
// - a completed invocation
|
|
58
|
-
// - a suspension
|
|
59
|
-
// - an error in the state machine
|
|
60
|
-
stateMachineClosed = false;
|
|
61
|
-
localStateStore;
|
|
62
|
-
// Whether the input channel (runtime -> service) is closed
|
|
63
|
-
// If it is closed, then we suspend immediately upon the next suspension point
|
|
64
|
-
// If it is open, then we suspend later because we might still get completions
|
|
65
|
-
inputChannelClosed = false;
|
|
66
|
-
// Suspension timeout that gets set and cleared based on completion messages;
|
|
67
|
-
suspensionTimeout;
|
|
68
|
-
constructor(connection, invocation, protocolMode, suspensionMillis = 30_000) {
|
|
69
|
-
this.connection = connection;
|
|
70
|
-
this.invocation = invocation;
|
|
71
|
-
this.protocolMode = protocolMode;
|
|
72
|
-
this.suspensionMillis = suspensionMillis;
|
|
73
|
-
this.localStateStore = invocation.localStateStore;
|
|
74
|
-
this.restateContext = new restate_context_impl_1.RestateGrpcContextImpl(this.invocation.id, this.invocation.method.service, this);
|
|
75
|
-
this.journal = new journal_1.Journal(this.invocation);
|
|
76
|
-
}
|
|
77
|
-
handleMessage(m) {
|
|
78
|
-
if (this.stateMachineClosed) {
|
|
79
|
-
// ignore this message
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
if (m.messageType === protocol_1.COMPLETION_MESSAGE_TYPE) {
|
|
83
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Received completion message from Restate, adding to journal.", m.messageType, m.message);
|
|
84
|
-
this.journal.handleRuntimeCompletionMessage(m.message);
|
|
85
|
-
}
|
|
86
|
-
else if (m.messageType === protocol_1.ENTRY_ACK_MESSAGE_TYPE) {
|
|
87
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Received entry ack message from Restate, adding to journal.", m.messageType, m.message);
|
|
88
|
-
this.journal.handleEntryAckMessage(m.message);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
throw errors_1.RetryableError.protocolViolation(`Received message of type ${m.messageType}. Can only accept completion or acks messages after replay has finished.`);
|
|
92
|
-
}
|
|
93
|
-
// Remove lingering suspension timeouts, if we are not waiting for completions anymore
|
|
94
|
-
if (this.suspensionTimeout !== undefined &&
|
|
95
|
-
this.journal.getCompletableIndices().length === 0) {
|
|
96
|
-
(0, timers_1.clearTimeout)(this.suspensionTimeout);
|
|
97
|
-
this.suspensionTimeout = undefined;
|
|
98
|
-
}
|
|
99
|
-
return false; // we are never complete
|
|
100
|
-
}
|
|
101
|
-
handleUserCodeMessage(messageType, message, completedFlag, protocolVersion, requiresAckFlag) {
|
|
102
|
-
// if the state machine is already closed, return a promise that never
|
|
103
|
-
// completes, so that the user code does not resume
|
|
104
|
-
if (this.stateMachineClosed) {
|
|
105
|
-
return wrapDeeply(new utils_1.CompletablePromise().promise);
|
|
106
|
-
}
|
|
107
|
-
const promise = this.journal.handleUserSideMessage(messageType, message);
|
|
108
|
-
const journalIndex = this.journal.getUserCodeJournalIndex();
|
|
109
|
-
// Only send the message to restate if we are not in replaying mode
|
|
110
|
-
if (this.journal.isProcessing()) {
|
|
111
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Adding message to journal and sending to Restate", messageType, message);
|
|
112
|
-
this.send(new types_1.Message(messageType, message, completedFlag, protocolVersion, requiresAckFlag));
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Matched and replayed message from journal", messageType, message);
|
|
116
|
-
}
|
|
117
|
-
return wrapDeeply(promise, () => {
|
|
118
|
-
if (!p.SUSPENSION_TRIGGERS.includes(messageType)) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (this.journal.isUnResolved(journalIndex)) {
|
|
122
|
-
this.scheduleSuspension();
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Invokes the RPC function and returns a promise that completes when the state machine
|
|
128
|
-
* stops processing the invocation, meaning when:
|
|
129
|
-
* - The function completes with a result or an exception
|
|
130
|
-
* - The execution suspends
|
|
131
|
-
* - An error is raised in the state machine (network, API violation, ...)
|
|
132
|
-
*
|
|
133
|
-
* The returned promise resolves successfully for all the cases above, because the are (from
|
|
134
|
-
* the perspective of the state machine) expected outcomes in which it send out corresponding
|
|
135
|
-
* result messages and cleanly closed the connection.
|
|
136
|
-
*
|
|
137
|
-
* The returned promise is rejected when an unhandled error arises and the caller would be
|
|
138
|
-
* expected to ensure that resources are properly cleaned up.
|
|
139
|
-
*/
|
|
140
|
-
invoke() {
|
|
141
|
-
// --------------------------------------------------------------------------------------------
|
|
142
|
-
// Implementation note:
|
|
143
|
-
//
|
|
144
|
-
// This method is not async, because we don't want to actually await anything
|
|
145
|
-
// in there. We cannot await the completion of the actual invocation, because for long-running
|
|
146
|
-
// code (that suspends), the function invocation never completes. Instead, the state machine
|
|
147
|
-
// triggers a suspension.
|
|
148
|
-
// We need to do a bit of promise chaining for the rpc function promise, and return a different
|
|
149
|
-
// promise that completes in also in suspension and error cases.
|
|
150
|
-
// --------------------------------------------------------------------------------------------
|
|
151
|
-
// it is unexpected for the state machine to be closed here, so we raise an error in
|
|
152
|
-
// that case, unlike in other places, where we simply ignore things
|
|
153
|
-
if (this.stateMachineClosed) {
|
|
154
|
-
return Promise.reject(new Error("state machine is already closed"));
|
|
155
|
-
}
|
|
156
|
-
if (this.journal.nextEntryWillBeReplayed()) {
|
|
157
|
-
logger_1.rlog.debugInvokeMessage(this.invocation.logPrefix, "Resuming (replaying) function.");
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
logger_1.rlog.debugInvokeMessage(this.invocation.logPrefix, "Invoking function.");
|
|
161
|
-
}
|
|
162
|
-
let resultBytes;
|
|
163
|
-
switch (this.invocation.invocationValue.kind) {
|
|
164
|
-
case "value":
|
|
165
|
-
resultBytes = this.invocation.method.invoke(this.restateContext, this.invocation.invocationValue.value);
|
|
166
|
-
break;
|
|
167
|
-
case "failure":
|
|
168
|
-
resultBytes = Promise.reject((0, errors_1.failureToTerminalError)(this.invocation.invocationValue.failure));
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
resultBytes
|
|
172
|
-
.then((bytes) => {
|
|
173
|
-
// invocation successfully returned with a result value
|
|
174
|
-
try {
|
|
175
|
-
// the state machine might be closed here in some cases like when there was an error (like
|
|
176
|
-
// API violation) or a suspension, but the function code still completed
|
|
177
|
-
if (this.stateMachineClosed) {
|
|
178
|
-
logger_1.rlog.warn("Unexpected successful completion of the function after the state machine closed. " +
|
|
179
|
-
"This may indicate that: \n" +
|
|
180
|
-
"- the function code does not properly await some Restate calls " +
|
|
181
|
-
"and did not notice an error \n" +
|
|
182
|
-
"- the function code was delayed for longer than the suspension timeout \n" +
|
|
183
|
-
"- the function code contained a try-catch block around a side effect which throws retryable errors. " +
|
|
184
|
-
"This try-catch block should be placed inside the side effect.");
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const value = Buffer.from(bytes);
|
|
188
|
-
// handle the result value
|
|
189
|
-
const msg = new types_1.Message(protocol_1.OUTPUT_STREAM_ENTRY_MESSAGE_TYPE, protocol_1.OutputStreamEntryMessage.create({
|
|
190
|
-
value,
|
|
191
|
-
}));
|
|
192
|
-
this.journal.handleUserSideMessage(msg.messageType, msg.message);
|
|
193
|
-
if (!this.journal.outputMsgWasReplayed()) {
|
|
194
|
-
this.send(msg);
|
|
195
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Journaled and sent output message", msg.messageType, msg.message);
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Replayed and matched output message from journal", msg.messageType, msg.message);
|
|
199
|
-
}
|
|
200
|
-
logger_1.rlog.debugInvokeMessage(this.invocation.logPrefix, "Function completed successfully.");
|
|
201
|
-
// Mark the end of the invocation
|
|
202
|
-
this.send(new types_1.Message(protocol_1.END_MESSAGE_TYPE, protocol_1.EndMessage.create()));
|
|
203
|
-
this.finish(value);
|
|
204
|
-
}
|
|
205
|
-
catch (e) {
|
|
206
|
-
this.unhandledError((0, errors_1.ensureError)(e));
|
|
207
|
-
}
|
|
208
|
-
})
|
|
209
|
-
.catch((e) => {
|
|
210
|
-
// because of how we try/catch in the promise handler above, this here exclusively handles
|
|
211
|
-
// errors coming from the rpc function
|
|
212
|
-
try {
|
|
213
|
-
// Sometimes the function code fails as a consequence of the state machine encountering
|
|
214
|
-
// an error before (possibly Restate closed the connection).
|
|
215
|
-
if (this.stateMachineClosed) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const error = (0, errors_1.ensureError)(e);
|
|
219
|
-
logger_1.rlog.trace(this.invocation.logPrefix, "Function completed with an error: " + error.message, e);
|
|
220
|
-
this.sendErrorAndFinish(error);
|
|
221
|
-
}
|
|
222
|
-
catch (ee) {
|
|
223
|
-
this.unhandledError((0, errors_1.ensureError)(ee));
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
// this promise here completes under any completion, including the cases where the
|
|
227
|
-
// rpc function does not end (error, suspension, ...)
|
|
228
|
-
return this.invocationComplete.promise;
|
|
229
|
-
}
|
|
230
|
-
async sendErrorAndFinish(e) {
|
|
231
|
-
if (e instanceof errors_1.TerminalError) {
|
|
232
|
-
this.sendTerminalError(e);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
this.sendRetryableError(e);
|
|
236
|
-
}
|
|
237
|
-
await this.finish();
|
|
238
|
-
}
|
|
239
|
-
sendRetryableError(e) {
|
|
240
|
-
const msg = new types_1.Message(protocol_1.ERROR_MESSAGE_TYPE, (0, errors_1.errorToErrorMessage)(e));
|
|
241
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Invocation ended with retryable error.", msg.messageType, msg.message);
|
|
242
|
-
this.send(msg);
|
|
243
|
-
}
|
|
244
|
-
sendTerminalError(e) {
|
|
245
|
-
const msg = new types_1.Message(protocol_1.OUTPUT_STREAM_ENTRY_MESSAGE_TYPE, protocol_1.OutputStreamEntryMessage.create({
|
|
246
|
-
failure: e.toFailure(),
|
|
247
|
-
}));
|
|
248
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Invocation ended with failure message.", msg.messageType, msg.message);
|
|
249
|
-
this.journal.handleUserSideMessage(msg.messageType, msg.message);
|
|
250
|
-
if (!this.journal.outputMsgWasReplayed()) {
|
|
251
|
-
this.send(msg);
|
|
252
|
-
}
|
|
253
|
-
// Mark the end of the invocation
|
|
254
|
-
this.send(new types_1.Message(protocol_1.END_MESSAGE_TYPE, protocol_1.EndMessage.create()));
|
|
255
|
-
}
|
|
256
|
-
send(message) {
|
|
257
|
-
this.connection.send(message).catch((err) => {
|
|
258
|
-
this.handleStreamError(err);
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Closes the state machine, flushes all output, and resolves the invocation promise.
|
|
263
|
-
*/
|
|
264
|
-
async finish(value) {
|
|
265
|
-
try {
|
|
266
|
-
this.stateMachineClosed = true;
|
|
267
|
-
this.journal.close();
|
|
268
|
-
this.clearSuspensionTimeout();
|
|
269
|
-
await this.connection.end();
|
|
270
|
-
this.invocationComplete.resolve(value);
|
|
271
|
-
}
|
|
272
|
-
catch (e) {
|
|
273
|
-
this.invocationComplete.reject((0, errors_1.ensureError)(e));
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* This function propagates errors up to the completion promise, to be handled
|
|
278
|
-
* on the connection layer.
|
|
279
|
-
*/
|
|
280
|
-
unhandledError(e) {
|
|
281
|
-
this.invocationComplete.reject(e);
|
|
282
|
-
this.stateMachineClosed = true;
|
|
283
|
-
this.journal.close();
|
|
284
|
-
this.clearSuspensionTimeout();
|
|
285
|
-
}
|
|
286
|
-
scheduleSuspension() {
|
|
287
|
-
// If there was already a timeout set, we want to reset the time to postpone suspension as long as we make progress.
|
|
288
|
-
// So we first clear the old timeout, and then we set a new one.
|
|
289
|
-
if (this.suspensionTimeout !== undefined) {
|
|
290
|
-
(0, timers_1.clearTimeout)(this.suspensionTimeout);
|
|
291
|
-
this.suspensionTimeout = undefined;
|
|
292
|
-
}
|
|
293
|
-
const delay = this.getSuspensionMillis();
|
|
294
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Scheduling suspension in " + delay + " ms");
|
|
295
|
-
if (delay >= 0) {
|
|
296
|
-
// Set a new suspension with a new timeout
|
|
297
|
-
// The suspension will only be sent if the timeout is not canceled due to a completion.
|
|
298
|
-
// In case the delay is 0 we still schedule a timeout in order to process the suspension on the next process tick,
|
|
299
|
-
// without interrupting the current work.
|
|
300
|
-
this.suspensionTimeout = setTimeout(() => {
|
|
301
|
-
this.suspend();
|
|
302
|
-
}, delay);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
// Suspension timeouts:
|
|
306
|
-
// Lambda case: suspend immediately when control is back in the user code
|
|
307
|
-
// Bidi streaming case:
|
|
308
|
-
// - suspend after 1 seconds if input channel is still open (can still get completions)
|
|
309
|
-
// - suspend immediately if input channel is closed (cannot get completions)
|
|
310
|
-
getSuspensionMillis() {
|
|
311
|
-
return this.protocolMode === discovery_1.ProtocolMode.REQUEST_RESPONSE ||
|
|
312
|
-
this.inputChannelClosed
|
|
313
|
-
? 0
|
|
314
|
-
: this.suspensionMillis;
|
|
315
|
-
}
|
|
316
|
-
async suspend() {
|
|
317
|
-
const indices = this.journal.getCompletableIndices();
|
|
318
|
-
// If the state is closed then we either already send a suspension
|
|
319
|
-
// or something else bad happened...
|
|
320
|
-
if (this.journal.isClosed() || indices.length === 0) {
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
// There need to be journal entries to complete, otherwise this timeout should have been removed.
|
|
324
|
-
// A suspension message is the end of the invocation.
|
|
325
|
-
// Resolve the root call with the suspension message
|
|
326
|
-
// This will lead to a onCallSuccess call where this msg will be sent.
|
|
327
|
-
const msg = new types_1.Message(protocol_1.SUSPENSION_MESSAGE_TYPE, protocol_1.SuspensionMessage.create({
|
|
328
|
-
entryIndexes: indices,
|
|
329
|
-
}));
|
|
330
|
-
logger_1.rlog.debugJournalMessage(this.invocation.logPrefix, "Writing suspension message to journal.", msg.messageType, msg.message);
|
|
331
|
-
this.journal.handleUserSideMessage(msg.messageType, msg.message);
|
|
332
|
-
if (!this.journal.outputMsgWasReplayed()) {
|
|
333
|
-
this.send(msg);
|
|
334
|
-
}
|
|
335
|
-
logger_1.rlog.debugInvokeMessage(this.invocation.logPrefix, "Suspending function.");
|
|
336
|
-
await this.finish();
|
|
337
|
-
}
|
|
338
|
-
async notifyHandlerExecutionError(e) {
|
|
339
|
-
await this.sendErrorAndFinish(e);
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* WARNING: make sure you use this at the right point in the code
|
|
343
|
-
* After the index has been incremented...
|
|
344
|
-
* This is error-prone... Would be good to have a better solution for this.
|
|
345
|
-
*/
|
|
346
|
-
getUserCodeJournalIndex() {
|
|
347
|
-
return this.journal.getUserCodeJournalIndex();
|
|
348
|
-
}
|
|
349
|
-
getFullServiceName() {
|
|
350
|
-
return (0, utils_1.makeFqServiceName)(this.invocation.method.packge, this.invocation.method.service);
|
|
351
|
-
}
|
|
352
|
-
handleInputClosed() {
|
|
353
|
-
if (this.journal.isClosed() ||
|
|
354
|
-
this.stateMachineClosed ||
|
|
355
|
-
this.inputChannelClosed) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
this.inputChannelClosed = true;
|
|
359
|
-
logger_1.rlog.debug(this.invocation.logPrefix +
|
|
360
|
-
" : Restate closed connection to trigger suspension.");
|
|
361
|
-
// If there is a timeout planned, reset the timout to execute immediately when the work is done.
|
|
362
|
-
if (this.suspensionTimeout !== undefined) {
|
|
363
|
-
this.scheduleSuspension();
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
handleStreamError(e) {
|
|
367
|
-
logger_1.rlog.info("Aborting function execution and closing state machine due to connection error: " +
|
|
368
|
-
e.message);
|
|
369
|
-
this.unhandledError(e);
|
|
370
|
-
}
|
|
371
|
-
nextEntryWillBeReplayed() {
|
|
372
|
-
return this.journal.nextEntryWillBeReplayed();
|
|
373
|
-
}
|
|
374
|
-
clearSuspensionTimeout() {
|
|
375
|
-
if (this.suspensionTimeout !== undefined) {
|
|
376
|
-
(0, timers_1.clearTimeout)(this.suspensionTimeout);
|
|
377
|
-
this.suspensionTimeout = undefined;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
exports.StateMachine = StateMachine;
|
|
382
|
-
const wrapDeeply = (promise, cb) => {
|
|
383
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
384
|
-
return {
|
|
385
|
-
transform: function (onfulfilled, onrejected) {
|
|
386
|
-
return wrapDeeply(promise.then(onfulfilled, onrejected), cb);
|
|
387
|
-
},
|
|
388
|
-
then: function (onfulfilled, onrejected) {
|
|
389
|
-
if (cb !== undefined) {
|
|
390
|
-
cb();
|
|
391
|
-
}
|
|
392
|
-
return promise.then(onfulfilled, onrejected);
|
|
393
|
-
},
|
|
394
|
-
catch: function (onrejected) {
|
|
395
|
-
return wrapDeeply(promise.catch(onrejected), cb);
|
|
396
|
-
},
|
|
397
|
-
finally: function (onfinally) {
|
|
398
|
-
return wrapDeeply(promise.finally(onfinally), cb);
|
|
399
|
-
},
|
|
400
|
-
[Symbol.toStringTag]: "",
|
|
401
|
-
};
|
|
402
|
-
};
|
|
403
|
-
//# sourceMappingURL=state_machine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state_machine.js","sourceRoot":"","sources":["../src/state_machine.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AACtC,iEAAgE;AAEhE,2DAA2D;AAC3D,yCAAwC;AACxC,yCAAsE;AACtE,2CAAsC;AACtC,mCAAsC;AACtC,+CAU0B;AAC1B,uCAAoC;AAEpC,2CAMwB;AAGxB,MAAa,YAAY;IAwBJ;IACA;IACA;IACA;IA1BX,OAAO,CAAgB;IACvB,cAAc,CAAyB;IAE9B,kBAAkB,GAAG,IAAI,0BAAkB,EAAiB,CAAC;IAE9E,6DAA6D;IAC7D,iCAAiC;IACjC,4BAA4B;IAC5B,kBAAkB;IAClB,mCAAmC;IAC3B,kBAAkB,GAAG,KAAK,CAAC;IAEnB,eAAe,CAAkB;IAEjD,2DAA2D;IAC3D,8EAA8E;IAC9E,8EAA8E;IACtE,kBAAkB,GAAG,KAAK,CAAC;IAEnC,6EAA6E;IACr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