@temporalio/core-bridge 0.23.0 → 1.0.0-rc.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.
Files changed (134) hide show
  1. package/Cargo.lock +118 -15
  2. package/Cargo.toml +2 -1
  3. package/README.md +1 -1
  4. package/index.d.ts +47 -18
  5. package/package.json +3 -3
  6. package/releases/aarch64-apple-darwin/index.node +0 -0
  7. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  8. package/releases/x86_64-apple-darwin/index.node +0 -0
  9. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  10. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  11. package/sdk-core/.buildkite/docker/docker-compose.yaml +4 -2
  12. package/sdk-core/ARCHITECTURE.md +9 -7
  13. package/sdk-core/README.md +5 -1
  14. package/sdk-core/arch_docs/diagrams/workflow_internals.svg +1 -0
  15. package/sdk-core/bridge-ffi/src/wrappers.rs +0 -3
  16. package/sdk-core/client/src/lib.rs +26 -8
  17. package/sdk-core/client/src/raw.rs +166 -54
  18. package/sdk-core/client/src/retry.rs +9 -4
  19. package/sdk-core/client/src/workflow_handle/mod.rs +4 -2
  20. package/sdk-core/core/Cargo.toml +2 -0
  21. package/sdk-core/core/src/abstractions.rs +137 -16
  22. package/sdk-core/core/src/core_tests/activity_tasks.rs +258 -63
  23. package/sdk-core/core/src/core_tests/child_workflows.rs +1 -2
  24. package/sdk-core/core/src/core_tests/determinism.rs +2 -2
  25. package/sdk-core/core/src/core_tests/local_activities.rs +8 -7
  26. package/sdk-core/core/src/core_tests/queries.rs +146 -60
  27. package/sdk-core/core/src/core_tests/replay_flag.rs +1 -1
  28. package/sdk-core/core/src/core_tests/workers.rs +39 -23
  29. package/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
  30. package/sdk-core/core/src/core_tests/workflow_tasks.rs +387 -280
  31. package/sdk-core/core/src/lib.rs +6 -4
  32. package/sdk-core/core/src/pollers/poll_buffer.rs +16 -10
  33. package/sdk-core/core/src/protosext/mod.rs +6 -6
  34. package/sdk-core/core/src/retry_logic.rs +1 -1
  35. package/sdk-core/core/src/telemetry/metrics.rs +21 -7
  36. package/sdk-core/core/src/telemetry/mod.rs +18 -4
  37. package/sdk-core/core/src/test_help/mod.rs +341 -109
  38. package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +18 -9
  39. package/sdk-core/core/src/worker/activities/local_activities.rs +19 -16
  40. package/sdk-core/core/src/worker/activities.rs +156 -29
  41. package/sdk-core/core/src/worker/client.rs +1 -0
  42. package/sdk-core/core/src/worker/mod.rs +132 -659
  43. package/sdk-core/core/src/{workflow → worker/workflow}/bridge.rs +1 -1
  44. package/sdk-core/core/src/{workflow → worker/workflow}/driven_workflow.rs +1 -1
  45. package/sdk-core/core/src/{workflow → worker/workflow}/history_update.rs +16 -2
  46. package/sdk-core/core/src/{workflow → worker/workflow}/machines/activity_state_machine.rs +39 -4
  47. package/sdk-core/core/src/{workflow → worker/workflow}/machines/cancel_external_state_machine.rs +5 -2
  48. package/sdk-core/core/src/{workflow → worker/workflow}/machines/cancel_workflow_state_machine.rs +1 -1
  49. package/sdk-core/core/src/{workflow → worker/workflow}/machines/child_workflow_state_machine.rs +2 -4
  50. package/sdk-core/core/src/{workflow → worker/workflow}/machines/complete_workflow_state_machine.rs +0 -0
  51. package/sdk-core/core/src/{workflow → worker/workflow}/machines/continue_as_new_workflow_state_machine.rs +1 -1
  52. package/sdk-core/core/src/{workflow → worker/workflow}/machines/fail_workflow_state_machine.rs +0 -0
  53. package/sdk-core/core/src/{workflow → worker/workflow}/machines/local_activity_state_machine.rs +2 -5
  54. package/sdk-core/core/src/{workflow → worker/workflow}/machines/mod.rs +1 -1
  55. package/sdk-core/core/src/{workflow → worker/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
  56. package/sdk-core/core/src/{workflow → worker/workflow}/machines/patch_state_machine.rs +1 -1
  57. package/sdk-core/core/src/{workflow → worker/workflow}/machines/side_effect_state_machine.rs +0 -0
  58. package/sdk-core/core/src/{workflow → worker/workflow}/machines/signal_external_state_machine.rs +4 -2
  59. package/sdk-core/core/src/{workflow → worker/workflow}/machines/timer_state_machine.rs +1 -2
  60. package/sdk-core/core/src/{workflow → worker/workflow}/machines/transition_coverage.rs +1 -1
  61. package/sdk-core/core/src/{workflow → worker/workflow}/machines/upsert_search_attributes_state_machine.rs +5 -7
  62. package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_machines/local_acts.rs +2 -2
  63. package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_machines.rs +29 -16
  64. package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_task_state_machine.rs +0 -0
  65. package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +198 -0
  66. package/sdk-core/core/src/worker/workflow/managed_run.rs +627 -0
  67. package/sdk-core/core/src/worker/workflow/mod.rs +1115 -0
  68. package/sdk-core/core/src/worker/workflow/run_cache.rs +143 -0
  69. package/sdk-core/core/src/worker/workflow/wft_poller.rs +88 -0
  70. package/sdk-core/core/src/worker/workflow/workflow_stream.rs +936 -0
  71. package/sdk-core/core-api/src/errors.rs +3 -10
  72. package/sdk-core/core-api/src/lib.rs +2 -1
  73. package/sdk-core/core-api/src/worker.rs +26 -2
  74. package/sdk-core/etc/dynamic-config.yaml +2 -0
  75. package/sdk-core/integ-with-otel.sh +1 -1
  76. package/sdk-core/protos/api_upstream/Makefile +4 -4
  77. package/sdk-core/protos/api_upstream/api-linter.yaml +2 -0
  78. package/sdk-core/protos/api_upstream/buf.yaml +8 -9
  79. package/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +83 -0
  80. package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +7 -1
  81. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/cluster.proto +40 -0
  82. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +3 -0
  83. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +3 -1
  84. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +60 -0
  85. package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +3 -0
  86. package/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +32 -4
  87. package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +69 -19
  88. package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +13 -0
  89. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +163 -0
  90. package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +97 -0
  91. package/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +300 -0
  92. package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +25 -0
  93. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +180 -3
  94. package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +53 -3
  95. package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +2 -2
  96. package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +6 -5
  97. package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -1
  98. package/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +2 -1
  99. package/sdk-core/protos/local/temporal/sdk/core/common/common.proto +0 -64
  100. package/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +2 -1
  101. package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +11 -8
  102. package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +30 -25
  103. package/sdk-core/sdk/src/activity_context.rs +12 -5
  104. package/sdk-core/sdk/src/app_data.rs +37 -0
  105. package/sdk-core/sdk/src/lib.rs +76 -43
  106. package/sdk-core/sdk/src/workflow_context/options.rs +8 -6
  107. package/sdk-core/sdk/src/workflow_context.rs +14 -19
  108. package/sdk-core/sdk/src/workflow_future.rs +9 -3
  109. package/sdk-core/sdk-core-protos/src/history_builder.rs +19 -5
  110. package/sdk-core/sdk-core-protos/src/history_info.rs +11 -6
  111. package/sdk-core/sdk-core-protos/src/lib.rs +74 -176
  112. package/sdk-core/test-utils/src/lib.rs +85 -72
  113. package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -9
  114. package/sdk-core/tests/integ_tests/polling_tests.rs +12 -0
  115. package/sdk-core/tests/integ_tests/queries_tests.rs +39 -22
  116. package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +49 -4
  117. package/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +61 -0
  118. package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
  119. package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +22 -13
  120. package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +19 -0
  121. package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
  122. package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -3
  123. package/sdk-core/tests/integ_tests/workflow_tests.rs +10 -23
  124. package/sdk-core/tests/load_tests.rs +8 -3
  125. package/sdk-core/tests/main.rs +2 -1
  126. package/src/conversions.rs +47 -39
  127. package/src/errors.rs +10 -21
  128. package/src/lib.rs +342 -325
  129. package/sdk-core/core/src/pending_activations.rs +0 -173
  130. package/sdk-core/core/src/worker/wft_delivery.rs +0 -81
  131. package/sdk-core/core/src/workflow/mod.rs +0 -478
  132. package/sdk-core/core/src/workflow/workflow_tasks/cache_manager.rs +0 -194
  133. package/sdk-core/core/src/workflow/workflow_tasks/concurrency_manager.rs +0 -418
  134. package/sdk-core/core/src/workflow/workflow_tasks/mod.rs +0 -989
package/Cargo.lock CHANGED
@@ -43,6 +43,17 @@ version = "1.5.0"
43
43
  source = "registry+https://github.com/rust-lang/crates.io-index"
44
44
  checksum = "c5d78ce20460b82d3fa150275ed9d55e21064fc7951177baacf86a145c4a4b1f"
45
45
 
46
+ [[package]]
47
+ name = "async-channel"
48
+ version = "1.6.1"
49
+ source = "registry+https://github.com/rust-lang/crates.io-index"
50
+ checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
51
+ dependencies = [
52
+ "concurrent-queue",
53
+ "event-listener",
54
+ "futures-core",
55
+ ]
56
+
46
57
  [[package]]
47
58
  name = "async-stream"
48
59
  version = "0.3.3"
@@ -134,6 +145,15 @@ version = "1.0.0"
134
145
  source = "registry+https://github.com/rust-lang/crates.io-index"
135
146
  checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
136
147
 
148
+ [[package]]
149
+ name = "concurrent-queue"
150
+ version = "1.2.2"
151
+ source = "registry+https://github.com/rust-lang/crates.io-index"
152
+ checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
153
+ dependencies = [
154
+ "cache-padded",
155
+ ]
156
+
137
157
  [[package]]
138
158
  name = "convert_case"
139
159
  version = "0.4.0"
@@ -225,12 +245,6 @@ dependencies = [
225
245
  "lazy_static",
226
246
  ]
227
247
 
228
- [[package]]
229
- name = "cslice"
230
- version = "0.2.0"
231
- source = "registry+https://github.com/rust-lang/crates.io-index"
232
- checksum = "697c714f50560202b1f4e2e09cd50a421881c83e9025db75d15f276616f04f40"
233
-
234
248
  [[package]]
235
249
  name = "darling"
236
250
  version = "0.14.0"
@@ -361,6 +375,12 @@ dependencies = [
361
375
  "syn",
362
376
  ]
363
377
 
378
+ [[package]]
379
+ name = "event-listener"
380
+ version = "2.5.2"
381
+ source = "registry+https://github.com/rust-lang/crates.io-index"
382
+ checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
383
+
364
384
  [[package]]
365
385
  name = "fastrand"
366
386
  version = "1.7.0"
@@ -489,6 +509,12 @@ version = "0.3.21"
489
509
  source = "registry+https://github.com/rust-lang/crates.io-index"
490
510
  checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a"
491
511
 
512
+ [[package]]
513
+ name = "futures-timer"
514
+ version = "3.0.2"
515
+ source = "registry+https://github.com/rust-lang/crates.io-index"
516
+ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
517
+
492
518
  [[package]]
493
519
  name = "futures-util"
494
520
  version = "0.3.21"
@@ -518,6 +544,23 @@ dependencies = [
518
544
  "wasi 0.10.2+wasi-snapshot-preview1",
519
545
  ]
520
546
 
547
+ [[package]]
548
+ name = "governor"
549
+ version = "0.4.2"
550
+ source = "registry+https://github.com/rust-lang/crates.io-index"
551
+ checksum = "19775995ee20209163239355bc3ad2f33f83da35d9ef72dea26e5af753552c87"
552
+ dependencies = [
553
+ "dashmap 5.2.0",
554
+ "futures",
555
+ "futures-timer",
556
+ "no-std-compat",
557
+ "nonzero_ext",
558
+ "parking_lot 0.12.0",
559
+ "quanta",
560
+ "rand",
561
+ "smallvec",
562
+ ]
563
+
521
564
  [[package]]
522
565
  name = "h2"
523
566
  version = "0.3.13"
@@ -744,6 +787,15 @@ dependencies = [
744
787
  "hashbrown",
745
788
  ]
746
789
 
790
+ [[package]]
791
+ name = "mach"
792
+ version = "0.3.2"
793
+ source = "registry+https://github.com/rust-lang/crates.io-index"
794
+ checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
795
+ dependencies = [
796
+ "libc",
797
+ ]
798
+
747
799
  [[package]]
748
800
  name = "matchers"
749
801
  version = "0.1.0"
@@ -832,11 +884,10 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
832
884
 
833
885
  [[package]]
834
886
  name = "neon"
835
- version = "0.8.3"
887
+ version = "0.10.1"
836
888
  source = "registry+https://github.com/rust-lang/crates.io-index"
837
- checksum = "05c562b89fa7f9707f02056abe25a37ec290ca4a4f1596edbd7aa1aa7b87af1d"
889
+ checksum = "28e15415261d880aed48122e917a45e87bb82cf0260bb6db48bbab44b7464373"
838
890
  dependencies = [
839
- "cslice",
840
891
  "neon-build",
841
892
  "neon-macros",
842
893
  "neon-runtime",
@@ -846,31 +897,44 @@ dependencies = [
846
897
 
847
898
  [[package]]
848
899
  name = "neon-build"
849
- version = "0.8.3"
900
+ version = "0.10.1"
850
901
  source = "registry+https://github.com/rust-lang/crates.io-index"
851
- checksum = "f9c55f6d310757b9fe6cd96a376609548a252da31828f935a7f59106533a89e9"
902
+ checksum = "8bac98a702e71804af3dacfde41edde4a16076a7bbe889ae61e56e18c5b1c811"
852
903
 
853
904
  [[package]]
854
905
  name = "neon-macros"
855
- version = "0.8.3"
906
+ version = "0.10.1"
856
907
  source = "registry+https://github.com/rust-lang/crates.io-index"
857
- checksum = "47065bc93b16f41fcfe29cad7d4d2a3e299b4389a3c9b429ba7a55f69a057fff"
908
+ checksum = "b7288eac8b54af7913c60e0eb0e2a7683020dffa342ab3fd15e28f035ba897cf"
858
909
  dependencies = [
859
910
  "quote",
860
911
  "syn",
912
+ "syn-mid",
861
913
  ]
862
914
 
863
915
  [[package]]
864
916
  name = "neon-runtime"
865
- version = "0.8.3"
917
+ version = "0.10.1"
866
918
  source = "registry+https://github.com/rust-lang/crates.io-index"
867
- checksum = "be313e6cf11f469653ee1b137b9203f5d604f2b496d423e96c5e251b51eead03"
919
+ checksum = "4676720fa8bb32c64c3d9f49c47a47289239ec46b4bdb66d0913cc512cb0daca"
868
920
  dependencies = [
869
921
  "cfg-if",
870
922
  "libloading",
871
923
  "smallvec",
872
924
  ]
873
925
 
926
+ [[package]]
927
+ name = "no-std-compat"
928
+ version = "0.4.1"
929
+ source = "registry+https://github.com/rust-lang/crates.io-index"
930
+ checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c"
931
+
932
+ [[package]]
933
+ name = "nonzero_ext"
934
+ version = "0.3.0"
935
+ source = "registry+https://github.com/rust-lang/crates.io-index"
936
+ checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21"
937
+
874
938
  [[package]]
875
939
  name = "normalize-line-endings"
876
940
  version = "0.3.0"
@@ -1201,6 +1265,22 @@ version = "2.27.1"
1201
1265
  source = "registry+https://github.com/rust-lang/crates.io-index"
1202
1266
  checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96"
1203
1267
 
1268
+ [[package]]
1269
+ name = "quanta"
1270
+ version = "0.9.3"
1271
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1272
+ checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8"
1273
+ dependencies = [
1274
+ "crossbeam-utils",
1275
+ "libc",
1276
+ "mach",
1277
+ "once_cell",
1278
+ "raw-cpuid",
1279
+ "wasi 0.10.2+wasi-snapshot-preview1",
1280
+ "web-sys",
1281
+ "winapi",
1282
+ ]
1283
+
1204
1284
  [[package]]
1205
1285
  name = "quote"
1206
1286
  version = "1.0.18"
@@ -1240,6 +1320,15 @@ dependencies = [
1240
1320
  "getrandom",
1241
1321
  ]
1242
1322
 
1323
+ [[package]]
1324
+ name = "raw-cpuid"
1325
+ version = "10.3.0"
1326
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1327
+ checksum = "738bc47119e3eeccc7e94c4a506901aea5e7b4944ecd0829cbebf4af04ceda12"
1328
+ dependencies = [
1329
+ "bitflags",
1330
+ ]
1331
+
1243
1332
  [[package]]
1244
1333
  name = "redox_syscall"
1245
1334
  version = "0.2.13"
@@ -1550,6 +1639,17 @@ dependencies = [
1550
1639
  "unicode-xid",
1551
1640
  ]
1552
1641
 
1642
+ [[package]]
1643
+ name = "syn-mid"
1644
+ version = "0.5.3"
1645
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1646
+ checksum = "baa8e7560a164edb1621a55d18a0c59abf49d360f47aa7b821061dd7eea7fac9"
1647
+ dependencies = [
1648
+ "proc-macro2",
1649
+ "quote",
1650
+ "syn",
1651
+ ]
1652
+
1553
1653
  [[package]]
1554
1654
  name = "tempfile"
1555
1655
  version = "3.3.0"
@@ -1595,6 +1695,7 @@ version = "0.1.0"
1595
1695
  dependencies = [
1596
1696
  "anyhow",
1597
1697
  "arc-swap",
1698
+ "async-channel",
1598
1699
  "async-trait",
1599
1700
  "base64",
1600
1701
  "crossbeam",
@@ -1603,6 +1704,7 @@ dependencies = [
1603
1704
  "derive_more",
1604
1705
  "enum_dispatch",
1605
1706
  "futures",
1707
+ "governor",
1606
1708
  "http",
1607
1709
  "hyper",
1608
1710
  "itertools",
@@ -1690,6 +1792,7 @@ dependencies = [
1690
1792
  "temporal-client",
1691
1793
  "temporal-sdk-core",
1692
1794
  "tokio",
1795
+ "tokio-stream",
1693
1796
  ]
1694
1797
 
1695
1798
  [[package]]
package/Cargo.toml CHANGED
@@ -19,7 +19,7 @@ incremental = false
19
19
  [dependencies]
20
20
  futures = { version = "0.3", features = ["executor"] }
21
21
  log = "0.4"
22
- neon = { version = "0.8", default-features = false, features = ["napi-6", "event-queue-api"] }
22
+ neon = { version = "0.10", default-features = false, features = ["napi-6", "event-queue-api"] }
23
23
  opentelemetry = "0.16"
24
24
  parking_lot = "0.12"
25
25
  prost = "0.9"
@@ -28,3 +28,4 @@ tokio = "1.13"
28
28
  once_cell = "1.7.2"
29
29
  temporal-sdk-core = { version = "*", path = "./sdk-core/core" }
30
30
  temporal-client = { version = "*", path = "./sdk-core/client" }
31
+ tokio-stream = "0.1"
package/README.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/@temporalio/core-bridge?style=for-the-badge)](https://www.npmjs.com/package/@temporalio/core-bridge)
4
4
 
5
- Part of [Temporal](https://temporal.io)'s [TypeScript SDK](https://docs.temporal.io/docs/typescript/introduction/).
5
+ Part of [Temporal](https://temporal.io)'s [TypeScript SDK](https://docs.temporal.io/typescript/introduction/).
package/index.d.ts CHANGED
@@ -27,15 +27,6 @@ export interface ClientOptions {
27
27
  */
28
28
  url: string;
29
29
 
30
- /**
31
- * A human-readable string that can identify your worker
32
- */
33
- identity: string;
34
- /**
35
- * A string that should be unique to the exact worker code/binary being executed
36
- */
37
- workerBinaryId: string;
38
-
39
30
  /** Version string for the whole node SDK. Should never be set by user */
40
31
  sdkVersion: string;
41
32
 
@@ -51,6 +42,13 @@ export interface ClientOptions {
51
42
  * Optional retry options for server requests.
52
43
  */
53
44
  retry?: RetryOptions;
45
+
46
+ /**
47
+ * Optional mapping of gRPC metadata (HTTP headers) to send with each request to the server.
48
+ *
49
+ * Set statically at connection time, can be replaced later using {@link clientUpdateHeaders}.
50
+ */
51
+ metadata?: Record<string, string>;
54
52
  }
55
53
 
56
54
  /**
@@ -131,6 +129,14 @@ export interface TelemetryOptions {
131
129
  */
132
130
  tracingFilter?: string;
133
131
 
132
+ /**
133
+ * If set true, do not prefix metrics with `temporal_`. Will be removed eventually as
134
+ * the prefix is consistent with other SDKs.
135
+ *
136
+ * @default `false`
137
+ */
138
+ noTemporalPrefixForMetrics?: boolean;
139
+
134
140
  /**
135
141
  * Control where to send Rust Core logs
136
142
  *
@@ -154,6 +160,15 @@ export interface TelemetryOptions {
154
160
  }
155
161
 
156
162
  export interface WorkerOptions {
163
+ /**
164
+ * A human-readable string that can identify your worker
165
+ */
166
+ identity: string;
167
+ /**
168
+ * A string that should be unique to the exact worker code/binary being executed
169
+ */
170
+ buildId: string;
171
+
157
172
  /**
158
173
  * The task queue the worker will pull from
159
174
  */
@@ -161,16 +176,14 @@ export interface WorkerOptions {
161
176
 
162
177
  maxConcurrentActivityTaskExecutions: number;
163
178
  maxConcurrentWorkflowTaskExecutions: number;
164
- maxConcurrentWorkflowTaskPolls: number;
165
- maxConcurrentActivityTaskPolls: number;
179
+ maxConcurrentLocalActivityExecutions: number;
180
+
166
181
  /**
167
- * `maxConcurrentWorkflowTaskPolls` * this number = the number of max pollers that will
168
- * be allowed for the nonsticky queue when sticky tasks are enabled. If both defaults are used,
169
- * the sticky queue will allow 4 max pollers while the nonsticky queue will allow one. The
170
- * minimum for either poller is 1, so if `max_concurrent_wft_polls` is 1 and sticky queues are
171
- * enabled, there will be 2 concurrent polls.
182
+ * If set to `false` this worker will only handle workflow tasks and local activities, it will not
183
+ * poll for activity tasks.
172
184
  */
173
- nonStickyToStickyPollRatio: number;
185
+ enableNonLocalActivities: boolean;
186
+
174
187
  /**
175
188
  * How long a workflow task is allowed to sit on the sticky queue before it is timed out
176
189
  * and moved to the non-sticky queue where it may be picked up by any worker.
@@ -195,6 +208,21 @@ export interface WorkerOptions {
195
208
  * @default 30 seconds
196
209
  */
197
210
  defaultHeartbeatThrottleIntervalMs: number;
211
+
212
+ /**
213
+ * Sets the maximum number of activities per second the task queue will dispatch, controlled
214
+ * server-side. Note that this only takes effect upon an activity poll request. If multiple
215
+ * workers on the same queue have different values set, they will thrash with the last poller
216
+ * winning.
217
+ */
218
+ maxTaskQueueActivitiesPerSecond?: number;
219
+
220
+ /**
221
+ * Limits the number of activities per second that this worker will process. The worker will
222
+ * not poll for new activities if by doing so it might receive and execute an activity which
223
+ * would cause it to exceed this limit. Must be a positive floating point number.
224
+ */
225
+ maxActivitiesPerSecond?: number;
198
226
  }
199
227
 
200
228
  /** Log level - must match rust log level names */
@@ -235,7 +263,8 @@ export declare function newReplayWorker(
235
263
  history: ArrayBuffer,
236
264
  callback: WorkerCallback
237
265
  ): void;
238
- export declare function workerShutdown(worker: Worker, callback: VoidCallback): void;
266
+ export declare function workerInitiateShutdown(worker: Worker, callback: VoidCallback): void;
267
+ export declare function workerFinalizeShutdown(worker: Worker): void;
239
268
  export declare function clientUpdateHeaders(
240
269
  client: Client,
241
270
  headers: Record<string, string>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temporalio/core-bridge",
3
- "version": "0.23.0",
3
+ "version": "1.0.0-rc.0",
4
4
  "description": "Temporal.io SDK Core<>Node bridge",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,7 +20,7 @@
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
22
  "@opentelemetry/api": "^1.0.3",
23
- "@temporalio/internal-non-workflow-common": "^0.23.0",
23
+ "@temporalio/internal-non-workflow-common": "^1.0.0-rc.0",
24
24
  "arg": "^5.0.1",
25
25
  "cargo-cp-artifact": "^0.1.4",
26
26
  "which": "^2.0.2"
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "81ee3fd09c2fd866b31b1dbfabce7ef221e338ea"
46
+ "gitHead": "c25e91309b980f2118df4048d760306982019871"
47
47
  }
@@ -9,7 +9,7 @@ services:
9
9
  # - '9042:9042'
10
10
 
11
11
  temporal:
12
- image: temporalio/auto-setup:1.16.0
12
+ image: temporalio/auto-setup:1.16.2
13
13
  ports:
14
14
  - "7233:7233"
15
15
  - "7234:7234"
@@ -21,7 +21,9 @@ services:
21
21
  # - "6939:6939"
22
22
  environment:
23
23
  - "CASSANDRA_SEEDS=cassandra"
24
- - "DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development.yaml"
24
+ - "DYNAMIC_CONFIG_FILE_PATH=/etc/dynamic-config.yaml"
25
+ volumes:
26
+ - ../../etc/dynamic-config.yaml:/etc/dynamic-config.yaml
25
27
  depends_on:
26
28
  - cassandra
27
29
 
@@ -20,10 +20,9 @@ There are many concepts involved in the chain of communication from server->core
20
20
  * `HistoryEvent` (often referred to simply as an `Event`): These events come from the server and represent the history of the workflow. They are defined in the protobuf definitions for the Temporal service itself.
21
21
  * `Command`: These are the commands defined in the temporal service protobufs that are returned by clients upon completing a `WorkflowTask`. For example, starting a timer or an activity.
22
22
  * `WorkflowTask`: These are how the server represents the need to run user workflow code (or the result of it executing). See the `HistoryEvent` proto definition for more.
23
- * `WfActivation` (said "WorkflowActivation"): These are produced by the Core SDK when the lang sdk needs to "activate" the user's workflow code, either running it from the beginning or resuming a cached workflow.
24
- * `WfActivationJob` (shorthand: `Job`s): These are included in `WfActivation`s and represent the actual things that have happened since the last time the workflow was activated (if ever). EX: Firing a timer, proceeding with the result of an activity, etc. They are all ultimately derived from `HistoryEvent`s.
25
- * `Task`: Returned from calls to `Core::poll_task`, these tasks represent work for the lang SDK to perform, which includes both workflow activations, and instructions to run activities (`ActivityTask`).
26
- * `TaskCompletion`: Provided by the lang side when calling `Core::complete_task`. Can be the result of a `WfActivation` or an `ActivityTask`. In the case of workflow activations, the (successful) completion contains one or more `Command`s, which may be literal `Command`s as defined in the Temporal service protobufs, or may be `CoreCommand`s, which support things like query responses.
23
+ * `WorkflowActivation`: These are produced by the Core SDK when the lang sdk needs to "activate" the user's workflow code, either running it from the beginning or resuming a cached workflow.
24
+ * `WorkflowActivationJob` (shorthand: `Job`s): These are included in `WorkflowActivation`s and represent the actual things that have happened since the last time the workflow was activated (if ever). EX: Firing a timer, proceeding with the result of an activity, etc. They are typically derived from `HistoryEvent`s, but also include things like evicting a run from the cache.
25
+ * `WorkflowActivationCompletion`: Provided by the lang side when completing an activation. The (successful) completion contains one or more `WorkflowCommand`s, which are often translated into `Command`s as defined in the Temporal service protobufs, but also include things like query responses.
27
26
 
28
27
  Additional clarifications that are internal to Core:
29
28
  * `StateMachine`s also handle events and produce commands, which often map directly to the above `HistoryEvent`s and `Command`s, but are distinct types. The state machine library is Temporal agnostic - but all interactions with the machines pass through a `TemporalStateMachine` trait, which accepts `HistoryEvent`s, and produces `WorkflowTrigger`s.
@@ -33,7 +32,7 @@ Additional clarifications that are internal to Core:
33
32
  ### Core SDK Responsibilities
34
33
 
35
34
  - Communication with Temporal service using a generated gRPC client, which is wrapped with somewhat more ergonomic traits.
36
- - Provide interface for language-specific SDK to drive event loop and handle returned commands. The lang sdk will continuously call/poll the core SDK to receive new `Task`s, which are either represent workflows being started or awoken (`WFActivation`) or activities to execute (`ActivityTask`). It will then call it's workflow/activity functions with the provided information as appropriate, and will then push completed tasks back into the core SDK.
35
+ - Provide interface for language-specific SDK to drive event loop and handle returned commands. The lang sdk will continuously call/poll the core SDK to receive new tasks, which either represent workflows being started or awoken (`WorkflowActivation`) or activities to execute (`ActivityTask`). It will then call its workflow/activity functions with the provided information as appropriate, and will then push completed tasks back into the core SDK.
37
36
  - Advance state machines and report back to the temporal server as appropriate when handling events and commands
38
37
 
39
38
  ### Language Specific SDK Responsibilities
@@ -61,7 +60,7 @@ async fn hello_activity(name: &str) -> String {
61
60
  }
62
61
  ```
63
62
 
64
- [![](https://mermaid.ink/img/eyJjb2RlIjoic2VxdWVuY2VEaWFncmFtXG4gICAgcGFydGljaXBhbnQgUyBhcyBUZW1wb3JhbCBTZXJ2aWNlXG4gICAgcGFydGljaXBhbnQgQyBhcyBDb3JlIFNES1xuICAgIHBhcnRpY2lwYW50IEwgYXMgTGFuZyBTREtcblxuICAgIEwgLT4-IEM6IEluaXRpYWxpemUgd29ya2VyXG4gICAgTCAtPj4gUzogZ3JwYzogU3RhcnRXb3JrZmxvd0V4ZWN1dGlvblxuXG4gICAgbG9vcCB3b3JrZmxvdyB0YXNrIHByb2Nlc3NpbmdcbiAgICBDIC0-PiBTOiBncnBjOiBQb2xsV29ya2Zsb3dUYXNrUXVldWVcbiAgICBTIC0tPj4gQzogVGFza3MgJiBoaXN0b3J5ICAgXG4gICAgQyAtPj4gQzogQXBwbHkgaGlzdG9yeSB0byBzdGF0ZSBtYWNoaW5lc1xuICAgIFxuICAgIGxvb3AgZXZlbnQgbG9vcFxuICAgIEwgLT4-IEM6IFBvbGwgZm9yIHNkayBldmVudHNcbiAgICBMIC0-PiBMOiBSdW4gd29ya2Zsb3csIHByb2R1Y2VzIGNvbW1hbmRzXG4gICAgTCAtLT4-IEM6IFdvcmtmbG93IEFjdGl2YXRpb24gZG9uZSB3LyBjb21tYW5kc1xuICAgIEMgLT4-IEM6IEFkdmFuY2Ugc3RhdGUgbWFjaGluZXNcbiAgICBlbmRcblxuICAgIEMgLT4-IFM6IGdycGM6IFJlc3BvbmRXb3JrZmxvd1Rhc2tDb21wbGV0ZWRcbiAgICBlbmRcblxuICAgIEwgLT4-IEM6IFNodXRkb3duXG4iLCJtZX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
66
65
  ## API Definition
67
66
 
@@ -71,4 +70,7 @@ See the latest API definition [here](https://github.com/temporalio/sdk-core/blob
71
70
 
72
71
 
73
72
  ## Other topics
74
- - [Sticky task queues](arch_docs/sticky_queues.md)
73
+ - [Sticky task queues](arch_docs/sticky_queues.md)
74
+
75
+ ## Workflow Processing Internals
76
+ ![Workflow Internals](arch_docs/diagrams/workflow_internals.svg)
@@ -61,6 +61,7 @@ The passed in options to initialization can be customized to export to an OTel c
61
61
 
62
62
  To run integ tests with OTel collection on, you can use `integ-with-otel.sh`. You will want to make
63
63
  sure you are running the collector via docker, which can be done like so:
64
+
64
65
  `docker-compose -f .buildkite/docker/docker-compose.yaml -f .buildkite/docker/docker-compose-telem.yaml up`
65
66
 
66
67
  If you are working on a language SDK, you are expected to initialize tracing early in your `main`
@@ -70,7 +71,10 @@ equivalent.
70
71
 
71
72
  This repo uses a subtree for upstream protobuf files. The path `protos/api_upstream` is a
72
73
  subtree. To update it, use:
73
- `git subtree pull --prefix protos/api_upstream/ git://github.com/temporalio/api.git master --squash`
74
+
75
+ `git pull --squash -s subtree ssh://git@github.com/temporalio/api.git master --allow-unrelated-histories`
76
+
77
+ Do not question why this git command is the way it is. It is not our place to interpret git's ways.
74
78
 
75
79
  ## Fetching Histories
76
80
  Tests which would like to replay stored histories rely on that history being made available in