@temporalio/core-bridge 1.4.4 → 1.5.1
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/Cargo.lock +327 -419
- package/Cargo.toml +1 -1
- package/index.js +25 -2
- package/lib/errors.d.ts +22 -0
- package/lib/errors.js +65 -0
- package/lib/errors.js.map +1 -0
- package/lib/index.d.ts +440 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/package.json +11 -5
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/sdk-core/.buildkite/docker/Dockerfile +1 -1
- package/sdk-core/.buildkite/docker/docker-compose.yaml +2 -2
- package/sdk-core/bridge-ffi/Cargo.toml +1 -1
- package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -25
- package/sdk-core/bridge-ffi/src/lib.rs +29 -108
- package/sdk-core/bridge-ffi/src/wrappers.rs +35 -25
- package/sdk-core/client/Cargo.toml +1 -1
- package/sdk-core/client/src/lib.rs +12 -20
- package/sdk-core/client/src/raw.rs +9 -8
- package/sdk-core/client/src/retry.rs +100 -23
- package/sdk-core/core/Cargo.toml +5 -5
- package/sdk-core/core/benches/workflow_replay.rs +13 -10
- package/sdk-core/core/src/abstractions.rs +22 -22
- package/sdk-core/core/src/core_tests/activity_tasks.rs +1 -1
- package/sdk-core/core/src/core_tests/local_activities.rs +228 -6
- package/sdk-core/core/src/core_tests/queries.rs +247 -89
- package/sdk-core/core/src/core_tests/workers.rs +2 -2
- package/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +46 -27
- package/sdk-core/core/src/lib.rs +139 -32
- package/sdk-core/core/src/replay/mod.rs +185 -41
- package/sdk-core/core/src/telemetry/log_export.rs +190 -0
- package/sdk-core/core/src/telemetry/metrics.rs +184 -139
- package/sdk-core/core/src/telemetry/mod.rs +296 -318
- package/sdk-core/core/src/telemetry/prometheus_server.rs +4 -3
- package/sdk-core/core/src/test_help/mod.rs +9 -7
- package/sdk-core/core/src/worker/activities/local_activities.rs +2 -1
- package/sdk-core/core/src/worker/activities.rs +40 -23
- package/sdk-core/core/src/worker/client/mocks.rs +1 -1
- package/sdk-core/core/src/worker/client.rs +30 -4
- package/sdk-core/core/src/worker/mod.rs +22 -18
- package/sdk-core/core/src/worker/workflow/driven_workflow.rs +10 -19
- package/sdk-core/core/src/worker/workflow/history_update.rs +99 -25
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +2 -6
- package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +18 -21
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +12 -38
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +178 -0
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +8 -2
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +232 -216
- package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +1 -6
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +4 -4
- package/sdk-core/core/src/worker/workflow/managed_run.rs +13 -5
- package/sdk-core/core/src/worker/workflow/mod.rs +61 -9
- package/sdk-core/core/src/worker/workflow/wft_poller.rs +2 -2
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +56 -11
- package/sdk-core/core-api/Cargo.toml +4 -3
- package/sdk-core/core-api/src/lib.rs +1 -43
- package/sdk-core/core-api/src/telemetry.rs +147 -0
- package/sdk-core/core-api/src/worker.rs +13 -0
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
- package/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
- package/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
- package/sdk-core/protos/api_upstream/.github/CODEOWNERS +1 -1
- package/sdk-core/protos/api_upstream/buf.yaml +0 -3
- package/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +3 -7
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +8 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +1 -2
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +2 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +13 -0
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +19 -59
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -19
- package/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +108 -29
- package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -2
- package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +47 -8
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +15 -1
- package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
- package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +8 -1
- package/sdk-core/sdk/src/interceptors.rs +36 -3
- package/sdk-core/sdk/src/lib.rs +7 -4
- package/sdk-core/sdk/src/workflow_context.rs +13 -2
- package/sdk-core/sdk-core-protos/src/history_builder.rs +47 -1
- package/sdk-core/sdk-core-protos/src/history_info.rs +22 -22
- package/sdk-core/sdk-core-protos/src/lib.rs +49 -27
- package/sdk-core/test-utils/Cargo.toml +1 -0
- package/sdk-core/test-utils/src/lib.rs +81 -29
- package/sdk-core/tests/integ_tests/metrics_tests.rs +37 -0
- package/sdk-core/tests/integ_tests/polling_tests.rs +0 -13
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +145 -4
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +53 -0
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +106 -20
- package/sdk-core/tests/integ_tests/workflow_tests.rs +18 -8
- package/sdk-core/tests/main.rs +6 -4
- package/src/conversions.rs +52 -47
- package/src/errors.rs +28 -86
- package/src/helpers.rs +3 -4
- package/src/lib.rs +2 -2
- package/src/runtime.rs +132 -61
- package/src/testing.rs +7 -4
- package/src/worker.rs +67 -50
- package/ts/errors.ts +55 -0
- package/{index.d.ts → ts/index.ts} +121 -15
- package/sdk-core/core/src/log_export.rs +0 -62
- package/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +0 -127
- package/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +0 -71
- package/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +0 -83
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/cluster.proto +0 -40
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { SpanContext } from '@opentelemetry/api';
|
|
2
|
-
import { TLSConfig } from '@temporalio/common/lib/internal-non-workflow';
|
|
2
|
+
import type { TLSConfig } from '@temporalio/common/lib/internal-non-workflow';
|
|
3
3
|
|
|
4
4
|
export { TLSConfig };
|
|
5
5
|
|
|
6
|
+
type Shadow<Base, New> = Base extends object
|
|
7
|
+
? New extends object
|
|
8
|
+
? {
|
|
9
|
+
[K in keyof Base | keyof New]: K extends keyof Base
|
|
10
|
+
? K extends keyof New
|
|
11
|
+
? Shadow<Base[K], New[K]>
|
|
12
|
+
: Base[K]
|
|
13
|
+
: K extends keyof New
|
|
14
|
+
? New[K]
|
|
15
|
+
: never;
|
|
16
|
+
}
|
|
17
|
+
: New
|
|
18
|
+
: New;
|
|
19
|
+
|
|
6
20
|
export interface RetryOptions {
|
|
7
21
|
/** Initial wait time before the first retry. */
|
|
8
22
|
initialInterval: number;
|
|
@@ -53,32 +67,40 @@ export interface ClientOptions {
|
|
|
53
67
|
|
|
54
68
|
/**
|
|
55
69
|
* Log directly to console
|
|
70
|
+
*
|
|
71
|
+
* @experimental
|
|
56
72
|
*/
|
|
57
73
|
export interface ConsoleLogger {
|
|
58
|
-
console: {};
|
|
74
|
+
console: {}; // eslint-disable-line @typescript-eslint/ban-types
|
|
59
75
|
}
|
|
60
76
|
|
|
61
77
|
/**
|
|
62
78
|
* Forward logs to {@link Runtime} logger
|
|
79
|
+
*
|
|
80
|
+
* @experimental
|
|
63
81
|
*/
|
|
64
82
|
export interface ForwardLogger {
|
|
65
83
|
forward: {
|
|
66
84
|
/**
|
|
67
85
|
* What level, if any, logs should be forwarded from core at
|
|
68
86
|
*
|
|
87
|
+
* @deprecated Use {@link TelemetryOptions.logging.filter} instead
|
|
69
88
|
*/
|
|
70
|
-
|
|
71
|
-
level: LogLevel;
|
|
89
|
+
level?: LogLevel;
|
|
72
90
|
};
|
|
73
91
|
}
|
|
74
92
|
|
|
75
93
|
/**
|
|
76
94
|
* Logger types supported by Core
|
|
95
|
+
*
|
|
96
|
+
* @experimental
|
|
77
97
|
*/
|
|
78
98
|
export type Logger = ConsoleLogger | ForwardLogger;
|
|
79
99
|
|
|
80
100
|
/**
|
|
81
101
|
* OpenTelemetry Collector options for exporting metrics or traces
|
|
102
|
+
*
|
|
103
|
+
* @experimental
|
|
82
104
|
*/
|
|
83
105
|
export interface OtelCollectorExporter {
|
|
84
106
|
otel: {
|
|
@@ -90,11 +112,26 @@ export interface OtelCollectorExporter {
|
|
|
90
112
|
* Optional set of HTTP request headers to send to Collector (e.g. for authentication)
|
|
91
113
|
*/
|
|
92
114
|
headers?: Record<string, string>;
|
|
115
|
+
/**
|
|
116
|
+
* Specify how frequently in metrics should be exported.
|
|
117
|
+
*
|
|
118
|
+
* @format number of milliseconds or {@link https://www.npmjs.com/package/ms | ms-formatted string}
|
|
119
|
+
* @defaults 1 second
|
|
120
|
+
*/
|
|
121
|
+
metricsExportInterval?: string | number;
|
|
93
122
|
};
|
|
94
123
|
}
|
|
95
124
|
|
|
125
|
+
/** @experimental */
|
|
126
|
+
export type CompiledOtelTraceExporter = Shadow<OtelCollectorExporter, { otel: { metricsExportInterval?: never } }>;
|
|
127
|
+
|
|
128
|
+
/** @experimental */
|
|
129
|
+
export type CompiledOtelMetricsExporter = Shadow<OtelCollectorExporter, { otel: { metricsExportInterval: number } }>;
|
|
130
|
+
|
|
96
131
|
/**
|
|
97
132
|
* Prometheus metrics exporter options
|
|
133
|
+
*
|
|
134
|
+
* @experimental
|
|
98
135
|
*/
|
|
99
136
|
export interface PrometheusMetricsExporter {
|
|
100
137
|
prometheus: {
|
|
@@ -114,6 +151,8 @@ export interface PrometheusMetricsExporter {
|
|
|
114
151
|
* `temporality` is the type of aggregation temporality for metric export. Applies to both Prometheus and OpenTelemetry exporters.
|
|
115
152
|
*
|
|
116
153
|
* See the [OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/ce50e4634efcba8da445cc23523243cb893905cb/specification/metrics/datamodel.md#temporality) for more information.
|
|
154
|
+
*
|
|
155
|
+
* @experimental
|
|
117
156
|
*/
|
|
118
157
|
export type MetricsExporter = {
|
|
119
158
|
temporality?: 'cumulative' | 'delta';
|
|
@@ -121,17 +160,20 @@ export type MetricsExporter = {
|
|
|
121
160
|
|
|
122
161
|
/**
|
|
123
162
|
* Trace exporters supported by Core
|
|
163
|
+
*
|
|
164
|
+
* @experimental
|
|
124
165
|
*/
|
|
125
166
|
export type TraceExporter = OtelCollectorExporter;
|
|
126
167
|
|
|
168
|
+
/** @experimental */
|
|
127
169
|
export interface TelemetryOptions {
|
|
128
170
|
/**
|
|
129
171
|
* A string in the env filter format specified here:
|
|
130
172
|
* https://docs.rs/tracing-subscriber/0.2.20/tracing_subscriber/struct.EnvFilter.html
|
|
131
173
|
*
|
|
132
|
-
* Which determines what tracing data is collected in the Core SDK
|
|
174
|
+
* Which determines what tracing data is collected in the Core SDK.
|
|
133
175
|
*
|
|
134
|
-
* @
|
|
176
|
+
* @deprecated Use either `logging.filter` or `tracing.filter` instead
|
|
135
177
|
*/
|
|
136
178
|
tracingFilter?: string;
|
|
137
179
|
|
|
@@ -145,17 +187,50 @@ export interface TelemetryOptions {
|
|
|
145
187
|
|
|
146
188
|
/**
|
|
147
189
|
* Control where to send Rust Core logs
|
|
148
|
-
*
|
|
149
|
-
* @default log to console
|
|
150
190
|
*/
|
|
151
|
-
logging?:
|
|
191
|
+
logging?: {
|
|
192
|
+
/**
|
|
193
|
+
* A string in (env filter format)[https://docs.rs/tracing-subscriber/0.2.20/tracing_subscriber/struct.EnvFilter.html]
|
|
194
|
+
* which determines the verboseness of logging output.
|
|
195
|
+
*
|
|
196
|
+
* You can use {@link Runtime.makeTelemetryFilterString()} to easily build a correctly formatted filter
|
|
197
|
+
* string based on desired log level for Core SDK and other native packages.
|
|
198
|
+
*
|
|
199
|
+
* **BACKWARD COMPATIBILITY**
|
|
200
|
+
*
|
|
201
|
+
* If `logging.filter` is missing, the following legacy values (if present) will be used instead (in the given order):
|
|
202
|
+
* - {@link ForwardLogger.forward.level} => `makeTelemetryFilterString({ core: level, other: level })`
|
|
203
|
+
* - {@link TelemetryOptions.tracingFilter}
|
|
204
|
+
* - Default value of `makeTelemetryFilterString({ core: 'INFO', other: 'INFO'})`
|
|
205
|
+
*
|
|
206
|
+
* @default `makeTelemetryFilterString({ core: 'INFO', other: 'INFO'})` (with some exceptions, as described in backward compatibility note above)
|
|
207
|
+
*/
|
|
208
|
+
filter?: string;
|
|
209
|
+
} & Partial<Logger>;
|
|
152
210
|
|
|
153
211
|
/**
|
|
154
212
|
* Control where to send traces generated by Rust Core, optional and turned off by default.
|
|
155
213
|
*
|
|
156
214
|
* This is typically used for profiling SDK internals.
|
|
157
215
|
*/
|
|
158
|
-
tracing?:
|
|
216
|
+
tracing?: {
|
|
217
|
+
/**
|
|
218
|
+
* A string in (env filter format)[https://docs.rs/tracing-subscriber/0.2.20/tracing_subscriber/struct.EnvFilter.html]
|
|
219
|
+
* which determines what tracing data is collected in the Core SDK.
|
|
220
|
+
*
|
|
221
|
+
* You can use {@link Runtime.makeTelemetryFilterString()} to easily build a correctly formatted filter
|
|
222
|
+
* string based on desired log level for Core SDK and other native packages.
|
|
223
|
+
*
|
|
224
|
+
* **BACKWARD COMPATIBILITY**
|
|
225
|
+
*
|
|
226
|
+
* If `tracing.filter` is missing, the following legacy values (if present) will be used instead (in the given order):
|
|
227
|
+
* - {@link TelemetryOptions.tracingFilter}
|
|
228
|
+
* - Default value of `makeTelemetryFilterString({ core: 'INFO', other: 'INFO'})`
|
|
229
|
+
*
|
|
230
|
+
* @default `makeTelemetryFilterString({ core: 'INFO', other: 'INFO'})` (with some exceptions, as described in backward compatibility note above)
|
|
231
|
+
*/
|
|
232
|
+
filter?: string;
|
|
233
|
+
} & Partial<TraceExporter>;
|
|
159
234
|
|
|
160
235
|
/**
|
|
161
236
|
* Control exporting {@link NativeConnection} and {@link Worker} metrics.
|
|
@@ -165,6 +240,23 @@ export interface TelemetryOptions {
|
|
|
165
240
|
metrics?: MetricsExporter;
|
|
166
241
|
}
|
|
167
242
|
|
|
243
|
+
/** @experimental */
|
|
244
|
+
export type CompiledTelemetryOptions = {
|
|
245
|
+
noTemporalPrefixForMetrics?: boolean;
|
|
246
|
+
logging: {
|
|
247
|
+
filter: string;
|
|
248
|
+
} & (
|
|
249
|
+
| { console: {} /* eslint-disable-line @typescript-eslint/ban-types */ }
|
|
250
|
+
| { forward: {} /* eslint-disable-line @typescript-eslint/ban-types */ }
|
|
251
|
+
);
|
|
252
|
+
tracing?: {
|
|
253
|
+
filter: string;
|
|
254
|
+
} & CompiledOtelTraceExporter;
|
|
255
|
+
metrics?: {
|
|
256
|
+
temporality?: 'cumulative' | 'delta';
|
|
257
|
+
} & (PrometheusMetricsExporter | CompiledOtelMetricsExporter);
|
|
258
|
+
};
|
|
259
|
+
|
|
168
260
|
export interface WorkerOptions {
|
|
169
261
|
/**
|
|
170
262
|
* A human-readable string that can identify your worker
|
|
@@ -348,26 +440,38 @@ export interface Client {
|
|
|
348
440
|
export interface EphemeralServer {
|
|
349
441
|
type: 'EphemeralServer';
|
|
350
442
|
}
|
|
443
|
+
export interface HistoryPusher {
|
|
444
|
+
type: 'HistoryPusher';
|
|
445
|
+
}
|
|
446
|
+
export interface ReplayWorker {
|
|
447
|
+
type: 'ReplayWorker';
|
|
448
|
+
worker: Worker;
|
|
449
|
+
pusher: HistoryPusher;
|
|
450
|
+
}
|
|
351
451
|
|
|
352
452
|
export declare type Callback<T> = (err: Error, result: T) => void;
|
|
353
453
|
export declare type PollCallback = (err: Error, result: ArrayBuffer) => void;
|
|
354
454
|
export declare type WorkerCallback = (err: Error, result: Worker) => void;
|
|
455
|
+
export declare type ReplayWorkerCallback = (err: Error, worker: ReplayWorker) => void;
|
|
355
456
|
export declare type ClientCallback = (err: Error, result: Client) => void;
|
|
356
457
|
export declare type VoidCallback = (err: Error, result: void) => void;
|
|
357
458
|
export declare type LogsCallback = (err: Error, result: LogEntry[]) => void;
|
|
358
459
|
|
|
359
|
-
|
|
360
|
-
export declare function registerErrors(errors: Record<string, any>): void;
|
|
361
|
-
export declare function initTelemetry(telemOptions: TelemetryOptions): void;
|
|
362
|
-
export declare function newRuntime(): Runtime;
|
|
460
|
+
export declare function newRuntime(telemOptions: CompiledTelemetryOptions): Runtime;
|
|
363
461
|
export declare function newClient(runtime: Runtime, clientOptions: ClientOptions, callback: ClientCallback): void;
|
|
364
462
|
export declare function newWorker(client: Client, workerOptions: WorkerOptions, callback: WorkerCallback): void;
|
|
365
463
|
export declare function newReplayWorker(
|
|
366
464
|
runtime: Runtime,
|
|
367
465
|
workerOptions: WorkerOptions,
|
|
466
|
+
callback: ReplayWorkerCallback
|
|
467
|
+
): void;
|
|
468
|
+
export declare function pushHistory(
|
|
469
|
+
pusher: HistoryPusher,
|
|
470
|
+
workflowId: string,
|
|
368
471
|
history: ArrayBuffer,
|
|
369
|
-
callback:
|
|
472
|
+
callback: VoidCallback
|
|
370
473
|
): void;
|
|
474
|
+
export declare function closeHistoryStream(pusher: HistoryPusher): void;
|
|
371
475
|
export declare function workerInitiateShutdown(worker: Worker, callback: VoidCallback): void;
|
|
372
476
|
export declare function workerFinalizeShutdown(worker: Worker): void;
|
|
373
477
|
export declare function clientUpdateHeaders(
|
|
@@ -406,3 +510,5 @@ export declare function startEphemeralServer(
|
|
|
406
510
|
): void;
|
|
407
511
|
export declare function shutdownEphemeralServer(server: EphemeralServer, callback: Callback<EphemeralServer>): void;
|
|
408
512
|
export declare function getEphemeralServerTarget(server: EphemeralServer): string;
|
|
513
|
+
|
|
514
|
+
export { ShutdownError, TransportError, UnexpectedError } from './errors';
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
use log::{LevelFilter, Log, Metadata, Record};
|
|
2
|
-
use ringbuf::{Consumer, Producer, RingBuffer};
|
|
3
|
-
use std::{sync::Mutex, time::SystemTime};
|
|
4
|
-
use temporal_sdk_core_api::CoreLog;
|
|
5
|
-
|
|
6
|
-
pub(crate) struct CoreExportLogger {
|
|
7
|
-
logs_in: Mutex<Producer<CoreLog>>,
|
|
8
|
-
logs_out: Mutex<Consumer<CoreLog>>,
|
|
9
|
-
level_filter: LevelFilter,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
impl CoreExportLogger {
|
|
13
|
-
pub(crate) fn new(level: LevelFilter) -> Self {
|
|
14
|
-
let (lin, lout) = RingBuffer::new(2048).split();
|
|
15
|
-
Self {
|
|
16
|
-
logs_in: Mutex::new(lin),
|
|
17
|
-
logs_out: Mutex::new(lout),
|
|
18
|
-
level_filter: level,
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
pub(crate) fn drain(&self) -> Vec<CoreLog> {
|
|
23
|
-
let mut lout = self
|
|
24
|
-
.logs_out
|
|
25
|
-
.lock()
|
|
26
|
-
.expect("Logging output mutex must be acquired");
|
|
27
|
-
let mut retme = Vec::with_capacity(lout.len());
|
|
28
|
-
lout.pop_each(
|
|
29
|
-
|el| {
|
|
30
|
-
retme.push(el);
|
|
31
|
-
true
|
|
32
|
-
},
|
|
33
|
-
None,
|
|
34
|
-
);
|
|
35
|
-
retme
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
impl Log for CoreExportLogger {
|
|
40
|
-
fn enabled(&self, metadata: &Metadata) -> bool {
|
|
41
|
-
// Never forward logging from other crates
|
|
42
|
-
if !metadata.target().contains("temporal_sdk_core") {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
metadata.level() <= self.level_filter
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
fn log(&self, record: &Record) {
|
|
49
|
-
let clog = CoreLog {
|
|
50
|
-
message: format!("[{}] {}", record.target(), record.args()),
|
|
51
|
-
timestamp: SystemTime::now(),
|
|
52
|
-
level: record.level(),
|
|
53
|
-
};
|
|
54
|
-
let _ = self
|
|
55
|
-
.logs_in
|
|
56
|
-
.lock()
|
|
57
|
-
.expect("Logging mutex must be acquired")
|
|
58
|
-
.push(clog);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
fn flush(&self) {}
|
|
62
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
use rustfsm::{fsm, TransitionResult};
|
|
2
|
-
|
|
3
|
-
fsm! {
|
|
4
|
-
pub(super) name MutableSideEffectMachine; command MutableSideEffectCommand; error MutableSideEffectMachineError;
|
|
5
|
-
|
|
6
|
-
Created --(CheckExecutionState, on_check_execution_state) --> Replaying;
|
|
7
|
-
Created --(CheckExecutionState, on_check_execution_state) --> Executing;
|
|
8
|
-
|
|
9
|
-
Executing --(Schedule, on_schedule) --> MarkerCommandCreated;
|
|
10
|
-
Executing --(Schedule, on_schedule) --> Skipped;
|
|
11
|
-
|
|
12
|
-
MarkerCommandCreated --(CommandRecordMarker, on_command_record_marker) --> ResultNotified;
|
|
13
|
-
|
|
14
|
-
MarkerCommandCreatedReplaying --(CommandRecordMarker) --> ResultNotifiedReplaying;
|
|
15
|
-
|
|
16
|
-
Replaying --(Schedule, on_schedule) --> MarkerCommandCreatedReplaying;
|
|
17
|
-
|
|
18
|
-
ResultNotified --(MarkerRecorded, on_marker_recorded) --> MarkerCommandRecorded;
|
|
19
|
-
|
|
20
|
-
ResultNotifiedReplaying --(NonMatchingEvent, on_non_matching_event) --> SkippedNotified;
|
|
21
|
-
ResultNotifiedReplaying --(MarkerRecorded, on_marker_recorded) --> MarkerCommandRecorded;
|
|
22
|
-
ResultNotifiedReplaying --(MarkerRecorded, on_marker_recorded) --> SkippedNotified;
|
|
23
|
-
|
|
24
|
-
Skipped --(CommandRecordMarker, on_command_record_marker) --> SkippedNotified;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
#[derive(thiserror::Error, Debug)]
|
|
28
|
-
pub(super) enum MutableSideEffectMachineError {}
|
|
29
|
-
|
|
30
|
-
pub(super) enum MutableSideEffectCommand {}
|
|
31
|
-
|
|
32
|
-
#[derive(Default, Clone)]
|
|
33
|
-
pub(super) struct Created {}
|
|
34
|
-
|
|
35
|
-
impl Created {
|
|
36
|
-
pub(super) fn on_check_execution_state(
|
|
37
|
-
self,
|
|
38
|
-
) -> MutableSideEffectMachineTransition<ReplayingOrExecuting> {
|
|
39
|
-
unimplemented!()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
#[derive(Default, Clone)]
|
|
44
|
-
pub(super) struct Executing {}
|
|
45
|
-
|
|
46
|
-
impl Executing {
|
|
47
|
-
pub(super) fn on_schedule(
|
|
48
|
-
self,
|
|
49
|
-
) -> MutableSideEffectMachineTransition<MarkerCommandCreatedOrSkipped> {
|
|
50
|
-
unimplemented!()
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
#[derive(Default, Clone)]
|
|
55
|
-
pub(super) struct MarkerCommandCreated {}
|
|
56
|
-
|
|
57
|
-
impl MarkerCommandCreated {
|
|
58
|
-
pub(super) fn on_command_record_marker(
|
|
59
|
-
self,
|
|
60
|
-
) -> MutableSideEffectMachineTransition<ResultNotified> {
|
|
61
|
-
unimplemented!()
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
#[derive(Default, Clone)]
|
|
66
|
-
pub(super) struct MarkerCommandCreatedReplaying {}
|
|
67
|
-
|
|
68
|
-
#[derive(Default, Clone)]
|
|
69
|
-
pub(super) struct MarkerCommandRecorded {}
|
|
70
|
-
|
|
71
|
-
#[derive(Default, Clone)]
|
|
72
|
-
pub(super) struct Replaying {}
|
|
73
|
-
|
|
74
|
-
impl Replaying {
|
|
75
|
-
pub(super) fn on_schedule(
|
|
76
|
-
self,
|
|
77
|
-
) -> MutableSideEffectMachineTransition<MarkerCommandCreatedReplaying> {
|
|
78
|
-
unimplemented!()
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
#[derive(Default, Clone)]
|
|
83
|
-
pub(super) struct ResultNotified {}
|
|
84
|
-
|
|
85
|
-
impl ResultNotified {
|
|
86
|
-
pub(super) fn on_marker_recorded(
|
|
87
|
-
self,
|
|
88
|
-
) -> MutableSideEffectMachineTransition<MarkerCommandRecorded> {
|
|
89
|
-
unimplemented!()
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
#[derive(Default, Clone)]
|
|
94
|
-
pub(super) struct ResultNotifiedReplaying {}
|
|
95
|
-
|
|
96
|
-
impl ResultNotifiedReplaying {
|
|
97
|
-
pub(super) fn on_non_matching_event(
|
|
98
|
-
self,
|
|
99
|
-
) -> MutableSideEffectMachineTransition<SkippedNotified> {
|
|
100
|
-
unimplemented!()
|
|
101
|
-
}
|
|
102
|
-
pub(super) fn on_marker_recorded(
|
|
103
|
-
self,
|
|
104
|
-
) -> MutableSideEffectMachineTransition<MarkerCommandRecordedOrSkippedNotified> {
|
|
105
|
-
unimplemented!()
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
impl From<MarkerCommandCreatedReplaying> for ResultNotifiedReplaying {
|
|
110
|
-
fn from(_: MarkerCommandCreatedReplaying) -> Self {
|
|
111
|
-
Self::default()
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
#[derive(Default, Clone)]
|
|
116
|
-
pub(super) struct Skipped {}
|
|
117
|
-
|
|
118
|
-
impl Skipped {
|
|
119
|
-
pub(super) fn on_command_record_marker(
|
|
120
|
-
self,
|
|
121
|
-
) -> MutableSideEffectMachineTransition<SkippedNotified> {
|
|
122
|
-
unimplemented!()
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
#[derive(Default, Clone)]
|
|
127
|
-
pub(super) struct SkippedNotified {}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
use rustfsm::{fsm, TransitionResult};
|
|
2
|
-
|
|
3
|
-
fsm! {
|
|
4
|
-
pub(super) name SideEffectMachine; command SideEffectCommand; error SideEffectMachineError;
|
|
5
|
-
|
|
6
|
-
Created --(Schedule, on_schedule) --> MarkerCommandCreated;
|
|
7
|
-
Created --(Schedule, on_schedule) --> MarkerCommandCreatedReplaying;
|
|
8
|
-
|
|
9
|
-
MarkerCommandCreated --(CommandRecordMarker, on_command_record_marker) --> ResultNotified;
|
|
10
|
-
|
|
11
|
-
MarkerCommandCreatedReplaying --(CommandRecordMarker) --> ResultNotifiedReplaying;
|
|
12
|
-
|
|
13
|
-
ResultNotified --(MarkerRecorded, on_marker_recorded) --> MarkerCommandRecorded;
|
|
14
|
-
|
|
15
|
-
ResultNotifiedReplaying --(MarkerRecorded, on_marker_recorded) --> MarkerCommandRecorded;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#[derive(thiserror::Error, Debug)]
|
|
19
|
-
pub(super) enum SideEffectMachineError {}
|
|
20
|
-
|
|
21
|
-
pub(super) enum SideEffectCommand {}
|
|
22
|
-
|
|
23
|
-
#[derive(Default, Clone)]
|
|
24
|
-
pub(super) struct Created {}
|
|
25
|
-
|
|
26
|
-
impl Created {
|
|
27
|
-
pub(super) fn on_schedule(
|
|
28
|
-
self,
|
|
29
|
-
) -> SideEffectMachineTransition<MarkerCommandCreatedOrMarkerCommandCreatedReplaying> {
|
|
30
|
-
unimplemented!()
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
#[derive(Default, Clone)]
|
|
35
|
-
pub(super) struct MarkerCommandCreated {}
|
|
36
|
-
|
|
37
|
-
impl MarkerCommandCreated {
|
|
38
|
-
pub(super) fn on_command_record_marker(self) -> SideEffectMachineTransition<ResultNotified> {
|
|
39
|
-
unimplemented!()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
#[derive(Default, Clone)]
|
|
44
|
-
pub(super) struct MarkerCommandCreatedReplaying {}
|
|
45
|
-
|
|
46
|
-
#[derive(Default, Clone)]
|
|
47
|
-
pub(super) struct MarkerCommandRecorded {}
|
|
48
|
-
|
|
49
|
-
#[derive(Default, Clone)]
|
|
50
|
-
pub(super) struct ResultNotified {}
|
|
51
|
-
|
|
52
|
-
impl ResultNotified {
|
|
53
|
-
pub(super) fn on_marker_recorded(self) -> SideEffectMachineTransition<MarkerCommandRecorded> {
|
|
54
|
-
unimplemented!()
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
#[derive(Default, Clone)]
|
|
59
|
-
pub(super) struct ResultNotifiedReplaying {}
|
|
60
|
-
|
|
61
|
-
impl ResultNotifiedReplaying {
|
|
62
|
-
pub(super) fn on_marker_recorded(self) -> SideEffectMachineTransition<MarkerCommandRecorded> {
|
|
63
|
-
unimplemented!()
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
impl From<MarkerCommandCreatedReplaying> for ResultNotifiedReplaying {
|
|
68
|
-
fn from(_: MarkerCommandCreatedReplaying) -> Self {
|
|
69
|
-
Self::default()
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// The MIT License
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2022 Temporal Technologies Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
// furnished to do so, subject to the following conditions:
|
|
11
|
-
//
|
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
|
13
|
-
// all copies or substantial portions of the Software.
|
|
14
|
-
//
|
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
// THE SOFTWARE.
|
|
22
|
-
|
|
23
|
-
syntax = "proto3";
|
|
24
|
-
|
|
25
|
-
package temporal.api.cluster.v1;
|
|
26
|
-
|
|
27
|
-
option go_package = "go.temporal.io/api/cluster/v1;cluster";
|
|
28
|
-
option java_package = "io.temporal.api.cluster.v1";
|
|
29
|
-
option java_multiple_files = true;
|
|
30
|
-
option java_outer_classname = "MessageProto";
|
|
31
|
-
option ruby_package = "Temporal::Api::Cluster::V1";
|
|
32
|
-
option csharp_namespace = "Temporal.Api.Cluster.V1";
|
|
33
|
-
|
|
34
|
-
import "dependencies/gogoproto/gogo.proto";
|
|
35
|
-
import "google/protobuf/timestamp.proto";
|
|
36
|
-
|
|
37
|
-
import "temporal/api/enums/v1/cluster.proto";
|
|
38
|
-
import "temporal/api/enums/v1/common.proto";
|
|
39
|
-
import "temporal/api/version/v1/message.proto";
|
|
40
|
-
|
|
41
|
-
// data column
|
|
42
|
-
message ClusterMetadata {
|
|
43
|
-
string cluster = 1;
|
|
44
|
-
int32 history_shard_count = 2;
|
|
45
|
-
string cluster_id = 3;
|
|
46
|
-
temporal.api.version.v1.VersionInfo version_info = 4;
|
|
47
|
-
map<string,IndexSearchAttributes> index_search_attributes = 5;
|
|
48
|
-
string cluster_address = 6;
|
|
49
|
-
int64 failover_version_increment = 7;
|
|
50
|
-
int64 initial_failover_version = 8;
|
|
51
|
-
bool is_global_namespace_enabled = 9;
|
|
52
|
-
bool is_connection_enabled = 10;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
message IndexSearchAttributes{
|
|
56
|
-
map<string,temporal.api.enums.v1.IndexedValueType> custom_search_attributes = 1;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
message HostInfo {
|
|
60
|
-
string identity = 1;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
message RingInfo {
|
|
64
|
-
string role = 1;
|
|
65
|
-
int32 member_count = 2;
|
|
66
|
-
repeated HostInfo members = 3;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
message MembershipInfo {
|
|
70
|
-
HostInfo current_host = 1;
|
|
71
|
-
repeated string reachable_members = 2;
|
|
72
|
-
repeated RingInfo rings = 3;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
message ClusterMember {
|
|
76
|
-
temporal.api.enums.v1.ClusterMemberRole role = 1;
|
|
77
|
-
string host_id = 2;
|
|
78
|
-
string rpc_address = 3;
|
|
79
|
-
int32 rpc_port = 4;
|
|
80
|
-
google.protobuf.Timestamp session_start_time = 5 [(gogoproto.stdtime) = true];
|
|
81
|
-
google.protobuf.Timestamp last_heartbit_time = 6 [(gogoproto.stdtime) = true];
|
|
82
|
-
google.protobuf.Timestamp record_expiry_time = 7 [(gogoproto.stdtime) = true];
|
|
83
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// The MIT License
|
|
2
|
-
//
|
|
3
|
-
// Copyright (c) 2022 Temporal Technologies Inc. All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
// furnished to do so, subject to the following conditions:
|
|
11
|
-
//
|
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
|
13
|
-
// all copies or substantial portions of the Software.
|
|
14
|
-
//
|
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
// THE SOFTWARE.
|
|
22
|
-
|
|
23
|
-
syntax = "proto3";
|
|
24
|
-
|
|
25
|
-
package temporal.api.enums.v1;
|
|
26
|
-
|
|
27
|
-
option go_package = "go.temporal.io/api/enums/v1;enums";
|
|
28
|
-
option java_package = "io.temporal.api.enums.v1";
|
|
29
|
-
option java_multiple_files = true;
|
|
30
|
-
option java_outer_classname = "ClusterProto";
|
|
31
|
-
option ruby_package = "Temporal::Api::Enums::V1";
|
|
32
|
-
option csharp_namespace = "Temporal.Api.Enums.V1";
|
|
33
|
-
|
|
34
|
-
enum ClusterMemberRole {
|
|
35
|
-
CLUSTER_MEMBER_ROLE_UNSPECIFIED = 0;
|
|
36
|
-
CLUSTER_MEMBER_ROLE_FRONTEND = 1;
|
|
37
|
-
CLUSTER_MEMBER_ROLE_HISTORY = 2;
|
|
38
|
-
CLUSTER_MEMBER_ROLE_MATCHING = 3;
|
|
39
|
-
CLUSTER_MEMBER_ROLE_WORKER = 4;
|
|
40
|
-
}
|