@rivetkit/engine 1.0.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 (1392) hide show
  1. package/LICENSE +203 -0
  2. package/artifacts/errors/actor.destroyed_during_creation.json +5 -0
  3. package/artifacts/errors/actor.destroyed_while_waiting_for_ready.json +5 -0
  4. package/artifacts/errors/actor.duplicate_key.json +5 -0
  5. package/artifacts/errors/actor.empty_key.json +5 -0
  6. package/artifacts/errors/actor.input_too_large.json +5 -0
  7. package/artifacts/errors/actor.key_reserved_in_different_datacenter.json +5 -0
  8. package/artifacts/errors/actor.key_too_large.json +5 -0
  9. package/artifacts/errors/actor.kv_key_not_found.json +5 -0
  10. package/artifacts/errors/actor.namespace_not_found.json +5 -0
  11. package/artifacts/errors/actor.no_runners_available.json +5 -0
  12. package/artifacts/errors/actor.not_found.json +5 -0
  13. package/artifacts/errors/api.bad_request.json +5 -0
  14. package/artifacts/errors/api.forbidden.json +5 -0
  15. package/artifacts/errors/api.internal_error.json +5 -0
  16. package/artifacts/errors/api.not_found.json +5 -0
  17. package/artifacts/errors/api.rate_limited.json +5 -0
  18. package/artifacts/errors/api.unauthorized.json +5 -0
  19. package/artifacts/errors/datacenter.not_found.json +5 -0
  20. package/artifacts/errors/guard.actor_destroyed.json +5 -0
  21. package/artifacts/errors/guard.actor_not_found.json +5 -0
  22. package/artifacts/errors/guard.actor_ready_timeout.json +5 -0
  23. package/artifacts/errors/guard.connection_error.json +5 -0
  24. package/artifacts/errors/guard.http_request_build_failed.json +5 -0
  25. package/artifacts/errors/guard.missing_header.json +5 -0
  26. package/artifacts/errors/guard.must_use_regional_host.json +5 -0
  27. package/artifacts/errors/guard.no_route.json +5 -0
  28. package/artifacts/errors/guard.no_route_targets.json +5 -0
  29. package/artifacts/errors/guard.rate_limit.json +5 -0
  30. package/artifacts/errors/guard.request_build_error.json +5 -0
  31. package/artifacts/errors/guard.request_timeout.json +5 -0
  32. package/artifacts/errors/guard.retry_attempts_exceeded.json +5 -0
  33. package/artifacts/errors/guard.service_unavailable.json +5 -0
  34. package/artifacts/errors/guard.target_changed.json +5 -0
  35. package/artifacts/errors/guard.upstream_error.json +5 -0
  36. package/artifacts/errors/guard.uri_parse_error.json +5 -0
  37. package/artifacts/errors/guard.websocket_pending_limit_reached.json +5 -0
  38. package/artifacts/errors/guard.websocket_service_hibernate.json +5 -0
  39. package/artifacts/errors/guard.websocket_service_timeout.json +5 -0
  40. package/artifacts/errors/guard.websocket_service_unavailable.json +5 -0
  41. package/artifacts/errors/guard.wrong_addr_protocol.json +5 -0
  42. package/artifacts/errors/kv.leader_forwarding_failed.json +5 -0
  43. package/artifacts/errors/kv.no_leader_elected.json +5 -0
  44. package/artifacts/errors/kv.not_leader.json +5 -0
  45. package/artifacts/errors/kv.response_channel_closed.json +5 -0
  46. package/artifacts/errors/namespace.failed_to_create.json +5 -0
  47. package/artifacts/errors/namespace.invalid_name.json +5 -0
  48. package/artifacts/errors/namespace.invalid_update.json +5 -0
  49. package/artifacts/errors/namespace.name_not_unique.json +5 -0
  50. package/artifacts/errors/namespace.not_found.json +5 -0
  51. package/artifacts/errors/namespace.not_leader.json +5 -0
  52. package/artifacts/errors/runner.not_found.json +5 -0
  53. package/artifacts/errors/runner_config.invalid.json +5 -0
  54. package/artifacts/errors/runner_config.not_found.json +5 -0
  55. package/artifacts/errors/test.input_too_large.json +5 -0
  56. package/artifacts/errors/test.key_too_large.json +5 -0
  57. package/artifacts/errors/test.meta_error.json +5 -0
  58. package/artifacts/errors/test.not_found.json +5 -0
  59. package/artifacts/errors/test.simple_error.json +5 -0
  60. package/artifacts/errors/test.test_error.json +5 -0
  61. package/artifacts/errors/ups.publish_failed.json +5 -0
  62. package/artifacts/errors/ups.request_timeout.json +5 -0
  63. package/artifacts/errors/validation.invalid_input.json +5 -0
  64. package/artifacts/errors/validation.no_keys.json +5 -0
  65. package/artifacts/errors/validation.race_condition.json +5 -0
  66. package/artifacts/errors/validation.too_many_actor_ids.json +5 -0
  67. package/artifacts/errors/ws.connection_closed.json +5 -0
  68. package/artifacts/errors/ws.eviction.json +5 -0
  69. package/artifacts/errors/ws.invalid_initial_packet.json +5 -0
  70. package/artifacts/errors/ws.invalid_packet.json +5 -0
  71. package/artifacts/errors/ws.invalid_url.json +5 -0
  72. package/artifacts/errors/ws.timed_out_waiting_for_init.json +5 -0
  73. package/artifacts/openapi.json +1833 -0
  74. package/contrib-docs/ACTOR_KEY_RESERVATION.md +101 -0
  75. package/contrib-docs/API.md +11 -0
  76. package/contrib-docs/DOCKER.md +5 -0
  77. package/contrib-docs/ERRORS.md +13 -0
  78. package/contrib-docs/GUARD.md +76 -0
  79. package/contrib-docs/PEGBOARD_TUNNEL_RETRIES.md +83 -0
  80. package/contrib-docs/RUNNER_LIFECYCLE.md +172 -0
  81. package/contrib-docs/SDKS.md +9 -0
  82. package/contrib-docs/TEST_DEPENDENCIES.md +43 -0
  83. package/contrib-docs/design-choicse/EMBEDDED_KV.md +80 -0
  84. package/contrib-docs/operate/TRACING_RECONFIGURE.md +78 -0
  85. package/docker/dev/.gitattributes +1 -0
  86. package/docker/dev/README.md +74 -0
  87. package/docker/dev/clickhouse/client-config.xml +5 -0
  88. package/docker/dev/clickhouse/config.xml +52 -0
  89. package/docker/dev/clickhouse/init/01-create-otel-table.sql +107 -0
  90. package/docker/dev/clickhouse/users.xml +35 -0
  91. package/docker/dev/docker-compose.yml +217 -0
  92. package/docker/dev/grafana/dashboards/api.json +1240 -0
  93. package/docker/dev/grafana/dashboards/cache.json +1075 -0
  94. package/docker/dev/grafana/dashboards/futures.json +230 -0
  95. package/docker/dev/grafana/dashboards/gasoline.json +2477 -0
  96. package/docker/dev/grafana/dashboards/guard.json +1274 -0
  97. package/docker/dev/grafana/dashboards/tokio.json +1005 -0
  98. package/docker/dev/grafana/dashboards/traces.json +957 -0
  99. package/docker/dev/grafana/grafana.ini +14 -0
  100. package/docker/dev/grafana/provisioning/dashboards/dashboards.yaml +10 -0
  101. package/docker/dev/grafana/provisioning/datasources/datasources.yaml +30 -0
  102. package/docker/dev/otel-collector-client/config.yaml +39 -0
  103. package/docker/dev/otel-collector-server/config.yaml +72 -0
  104. package/docker/dev/postgres/init-db.sh +6 -0
  105. package/docker/dev/rivet-engine/config.jsonc +48 -0
  106. package/docker/dev/vector-client/vector.yaml +31 -0
  107. package/docker/dev/vector-server/vector.yaml +61 -0
  108. package/docker/dev-host/.gitattributes +1 -0
  109. package/docker/dev-host/README.md +74 -0
  110. package/docker/dev-host/clickhouse/client-config.xml +5 -0
  111. package/docker/dev-host/clickhouse/config.xml +52 -0
  112. package/docker/dev-host/clickhouse/init/01-create-otel-table.sql +107 -0
  113. package/docker/dev-host/clickhouse/users.xml +35 -0
  114. package/docker/dev-host/docker-compose.yml +190 -0
  115. package/docker/dev-host/grafana/dashboards/api.json +1240 -0
  116. package/docker/dev-host/grafana/dashboards/cache.json +1075 -0
  117. package/docker/dev-host/grafana/dashboards/futures.json +230 -0
  118. package/docker/dev-host/grafana/dashboards/gasoline.json +2477 -0
  119. package/docker/dev-host/grafana/dashboards/guard.json +1274 -0
  120. package/docker/dev-host/grafana/dashboards/tokio.json +1005 -0
  121. package/docker/dev-host/grafana/dashboards/traces.json +957 -0
  122. package/docker/dev-host/grafana/grafana.ini +14 -0
  123. package/docker/dev-host/grafana/provisioning/dashboards/dashboards.yaml +10 -0
  124. package/docker/dev-host/grafana/provisioning/datasources/datasources.yaml +30 -0
  125. package/docker/dev-host/otel-collector-client/config.yaml +39 -0
  126. package/docker/dev-host/otel-collector-server/config.yaml +72 -0
  127. package/docker/dev-host/postgres/init-db.sh +6 -0
  128. package/docker/dev-host/rivet-engine/config.jsonc +48 -0
  129. package/docker/dev-host/vector-client/vector.yaml +31 -0
  130. package/docker/dev-host/vector-server/vector.yaml +61 -0
  131. package/docker/dev-multidc/.gitattributes +1 -0
  132. package/docker/dev-multidc/README.md +86 -0
  133. package/docker/dev-multidc/core/clickhouse/client-config.xml +5 -0
  134. package/docker/dev-multidc/core/clickhouse/config.xml +52 -0
  135. package/docker/dev-multidc/core/clickhouse/init/01-create-otel-table.sql +107 -0
  136. package/docker/dev-multidc/core/clickhouse/users.xml +35 -0
  137. package/docker/dev-multidc/core/grafana/dashboards/api.json +1240 -0
  138. package/docker/dev-multidc/core/grafana/dashboards/cache.json +1075 -0
  139. package/docker/dev-multidc/core/grafana/dashboards/futures.json +230 -0
  140. package/docker/dev-multidc/core/grafana/dashboards/gasoline.json +2477 -0
  141. package/docker/dev-multidc/core/grafana/dashboards/guard.json +1274 -0
  142. package/docker/dev-multidc/core/grafana/dashboards/tokio.json +1005 -0
  143. package/docker/dev-multidc/core/grafana/dashboards/traces.json +957 -0
  144. package/docker/dev-multidc/core/grafana/grafana.ini +14 -0
  145. package/docker/dev-multidc/core/grafana/provisioning/dashboards/dashboards.yaml +10 -0
  146. package/docker/dev-multidc/core/grafana/provisioning/datasources/datasources.yaml +30 -0
  147. package/docker/dev-multidc/datacenters/dc-a/otel-collector-client/config.yaml +39 -0
  148. package/docker/dev-multidc/datacenters/dc-a/otel-collector-server/config.yaml +72 -0
  149. package/docker/dev-multidc/datacenters/dc-a/postgres/init-db.sh +6 -0
  150. package/docker/dev-multidc/datacenters/dc-a/rivet-engine/config.jsonc +62 -0
  151. package/docker/dev-multidc/datacenters/dc-a/vector-client/vector.yaml +31 -0
  152. package/docker/dev-multidc/datacenters/dc-a/vector-server/vector.yaml +61 -0
  153. package/docker/dev-multidc/datacenters/dc-b/otel-collector-client/config.yaml +39 -0
  154. package/docker/dev-multidc/datacenters/dc-b/otel-collector-server/config.yaml +72 -0
  155. package/docker/dev-multidc/datacenters/dc-b/postgres/init-db.sh +6 -0
  156. package/docker/dev-multidc/datacenters/dc-b/rivet-engine/config.jsonc +62 -0
  157. package/docker/dev-multidc/datacenters/dc-b/vector-client/vector.yaml +31 -0
  158. package/docker/dev-multidc/datacenters/dc-b/vector-server/vector.yaml +61 -0
  159. package/docker/dev-multidc/datacenters/dc-c/otel-collector-client/config.yaml +39 -0
  160. package/docker/dev-multidc/datacenters/dc-c/otel-collector-server/config.yaml +72 -0
  161. package/docker/dev-multidc/datacenters/dc-c/postgres/init-db.sh +6 -0
  162. package/docker/dev-multidc/datacenters/dc-c/rivet-engine/config.jsonc +62 -0
  163. package/docker/dev-multidc/datacenters/dc-c/vector-client/vector.yaml +31 -0
  164. package/docker/dev-multidc/datacenters/dc-c/vector-server/vector.yaml +61 -0
  165. package/docker/dev-multidc/docker-compose.yml +546 -0
  166. package/docker/dev-multidc-multinode/.gitattributes +1 -0
  167. package/docker/dev-multidc-multinode/README.md +86 -0
  168. package/docker/dev-multidc-multinode/core/clickhouse/client-config.xml +5 -0
  169. package/docker/dev-multidc-multinode/core/clickhouse/config.xml +52 -0
  170. package/docker/dev-multidc-multinode/core/clickhouse/init/01-create-otel-table.sql +107 -0
  171. package/docker/dev-multidc-multinode/core/clickhouse/users.xml +35 -0
  172. package/docker/dev-multidc-multinode/core/grafana/dashboards/api.json +1240 -0
  173. package/docker/dev-multidc-multinode/core/grafana/dashboards/cache.json +1075 -0
  174. package/docker/dev-multidc-multinode/core/grafana/dashboards/futures.json +230 -0
  175. package/docker/dev-multidc-multinode/core/grafana/dashboards/gasoline.json +2477 -0
  176. package/docker/dev-multidc-multinode/core/grafana/dashboards/guard.json +1274 -0
  177. package/docker/dev-multidc-multinode/core/grafana/dashboards/tokio.json +1005 -0
  178. package/docker/dev-multidc-multinode/core/grafana/dashboards/traces.json +957 -0
  179. package/docker/dev-multidc-multinode/core/grafana/grafana.ini +14 -0
  180. package/docker/dev-multidc-multinode/core/grafana/provisioning/dashboards/dashboards.yaml +10 -0
  181. package/docker/dev-multidc-multinode/core/grafana/provisioning/datasources/datasources.yaml +30 -0
  182. package/docker/dev-multidc-multinode/datacenters/dc-a/otel-collector-client/config.yaml +39 -0
  183. package/docker/dev-multidc-multinode/datacenters/dc-a/otel-collector-server/config.yaml +72 -0
  184. package/docker/dev-multidc-multinode/datacenters/dc-a/postgres/init-db.sh +6 -0
  185. package/docker/dev-multidc-multinode/datacenters/dc-a/rivet-engine/0/config.jsonc +62 -0
  186. package/docker/dev-multidc-multinode/datacenters/dc-a/rivet-engine/1/config.jsonc +62 -0
  187. package/docker/dev-multidc-multinode/datacenters/dc-a/rivet-engine/2/config.jsonc +62 -0
  188. package/docker/dev-multidc-multinode/datacenters/dc-a/vector-client/vector.yaml +31 -0
  189. package/docker/dev-multidc-multinode/datacenters/dc-a/vector-server/vector.yaml +61 -0
  190. package/docker/dev-multidc-multinode/datacenters/dc-b/otel-collector-client/config.yaml +39 -0
  191. package/docker/dev-multidc-multinode/datacenters/dc-b/otel-collector-server/config.yaml +72 -0
  192. package/docker/dev-multidc-multinode/datacenters/dc-b/postgres/init-db.sh +6 -0
  193. package/docker/dev-multidc-multinode/datacenters/dc-b/rivet-engine/0/config.jsonc +62 -0
  194. package/docker/dev-multidc-multinode/datacenters/dc-b/rivet-engine/1/config.jsonc +62 -0
  195. package/docker/dev-multidc-multinode/datacenters/dc-b/rivet-engine/2/config.jsonc +62 -0
  196. package/docker/dev-multidc-multinode/datacenters/dc-b/vector-client/vector.yaml +31 -0
  197. package/docker/dev-multidc-multinode/datacenters/dc-b/vector-server/vector.yaml +61 -0
  198. package/docker/dev-multidc-multinode/datacenters/dc-c/otel-collector-client/config.yaml +39 -0
  199. package/docker/dev-multidc-multinode/datacenters/dc-c/otel-collector-server/config.yaml +72 -0
  200. package/docker/dev-multidc-multinode/datacenters/dc-c/postgres/init-db.sh +6 -0
  201. package/docker/dev-multidc-multinode/datacenters/dc-c/rivet-engine/0/config.jsonc +62 -0
  202. package/docker/dev-multidc-multinode/datacenters/dc-c/rivet-engine/1/config.jsonc +62 -0
  203. package/docker/dev-multidc-multinode/datacenters/dc-c/rivet-engine/2/config.jsonc +62 -0
  204. package/docker/dev-multidc-multinode/datacenters/dc-c/vector-client/vector.yaml +31 -0
  205. package/docker/dev-multidc-multinode/datacenters/dc-c/vector-server/vector.yaml +61 -0
  206. package/docker/dev-multidc-multinode/docker-compose.yml +888 -0
  207. package/docker/dev-multinode/.gitattributes +1 -0
  208. package/docker/dev-multinode/README.md +74 -0
  209. package/docker/dev-multinode/clickhouse/client-config.xml +5 -0
  210. package/docker/dev-multinode/clickhouse/config.xml +52 -0
  211. package/docker/dev-multinode/clickhouse/init/01-create-otel-table.sql +107 -0
  212. package/docker/dev-multinode/clickhouse/users.xml +35 -0
  213. package/docker/dev-multinode/docker-compose.yml +323 -0
  214. package/docker/dev-multinode/grafana/dashboards/api.json +1240 -0
  215. package/docker/dev-multinode/grafana/dashboards/cache.json +1075 -0
  216. package/docker/dev-multinode/grafana/dashboards/futures.json +230 -0
  217. package/docker/dev-multinode/grafana/dashboards/gasoline.json +2477 -0
  218. package/docker/dev-multinode/grafana/dashboards/guard.json +1274 -0
  219. package/docker/dev-multinode/grafana/dashboards/tokio.json +1005 -0
  220. package/docker/dev-multinode/grafana/dashboards/traces.json +957 -0
  221. package/docker/dev-multinode/grafana/grafana.ini +14 -0
  222. package/docker/dev-multinode/grafana/provisioning/dashboards/dashboards.yaml +10 -0
  223. package/docker/dev-multinode/grafana/provisioning/datasources/datasources.yaml +30 -0
  224. package/docker/dev-multinode/otel-collector-client/config.yaml +39 -0
  225. package/docker/dev-multinode/otel-collector-server/config.yaml +72 -0
  226. package/docker/dev-multinode/postgres/init-db.sh +6 -0
  227. package/docker/dev-multinode/rivet-engine/0/config.jsonc +48 -0
  228. package/docker/dev-multinode/rivet-engine/1/config.jsonc +48 -0
  229. package/docker/dev-multinode/rivet-engine/2/config.jsonc +48 -0
  230. package/docker/dev-multinode/vector-client/vector.yaml +31 -0
  231. package/docker/dev-multinode/vector-server/vector.yaml +61 -0
  232. package/docker/engine/build.sh +67 -0
  233. package/docker/engine/linux-aarch64.Dockerfile +97 -0
  234. package/docker/engine/linux-x86_64.Dockerfile +93 -0
  235. package/docker/engine/macos-aarch64.Dockerfile +92 -0
  236. package/docker/engine/macos-x86_64.Dockerfile +92 -0
  237. package/docker/engine/windows.Dockerfile +80 -0
  238. package/docker/prod-file-system/.gitattributes +1 -0
  239. package/docker/prod-file-system/README.md +76 -0
  240. package/docker/prod-file-system/docker-compose.yml +41 -0
  241. package/docker/prod-file-system/rivet-engine/config.jsonc +2 -0
  242. package/docker/template/README.md +20 -0
  243. package/docker/template/grafana-dashboards/api.json +1240 -0
  244. package/docker/template/grafana-dashboards/cache.json +1075 -0
  245. package/docker/template/grafana-dashboards/futures.json +230 -0
  246. package/docker/template/grafana-dashboards/gasoline.json +2477 -0
  247. package/docker/template/grafana-dashboards/guard.json +1274 -0
  248. package/docker/template/grafana-dashboards/tokio.json +1005 -0
  249. package/docker/template/grafana-dashboards/traces.json +957 -0
  250. package/docker/template/node_modules/.bin/js-yaml +21 -0
  251. package/docker/template/node_modules/.bin/tsc +21 -0
  252. package/docker/template/node_modules/.bin/tsserver +21 -0
  253. package/docker/template/node_modules/.bin/tsx +21 -0
  254. package/docker/template/package.json +23 -0
  255. package/docker/template/src/config.ts +104 -0
  256. package/docker/template/src/context.ts +216 -0
  257. package/docker/template/src/docker-compose.ts +368 -0
  258. package/docker/template/src/git.ts +8 -0
  259. package/docker/template/src/main.ts +65 -0
  260. package/docker/template/src/readme.ts +98 -0
  261. package/docker/template/src/services/core/clickhouse.ts +223 -0
  262. package/docker/template/src/services/core/grafana.ts +115 -0
  263. package/docker/template/src/services/edge/otel-collector-client.ts +64 -0
  264. package/docker/template/src/services/edge/otel-collector-server.ts +107 -0
  265. package/docker/template/src/services/edge/postgres.ts +23 -0
  266. package/docker/template/src/services/edge/rivet-engine.ts +87 -0
  267. package/docker/template/src/services/edge/runner.ts +7 -0
  268. package/docker/template/src/services/edge/vector-client.ts +55 -0
  269. package/docker/template/src/services/edge/vector-server.ts +111 -0
  270. package/docker/template/src/utils.ts +19 -0
  271. package/docker/template/tsconfig.json +18 -0
  272. package/docker/universal/Dockerfile +133 -0
  273. package/package.json +10 -0
  274. package/packages/actor-kv/Cargo.toml +31 -0
  275. package/packages/actor-kv/src/entry.rs +147 -0
  276. package/packages/actor-kv/src/key.rs +81 -0
  277. package/packages/actor-kv/src/lib.rs +357 -0
  278. package/packages/actor-kv/src/utils.rs +101 -0
  279. package/packages/actor-kv/tests/kv_operations.rs +294 -0
  280. package/packages/actor-kv/tests/list_edge_cases.rs +370 -0
  281. package/packages/api-builder/Cargo.toml +36 -0
  282. package/packages/api-builder/src/context.rs +98 -0
  283. package/packages/api-builder/src/error_response.rs +116 -0
  284. package/packages/api-builder/src/errors.rs +29 -0
  285. package/packages/api-builder/src/extract.rs +137 -0
  286. package/packages/api-builder/src/global_context.rs +31 -0
  287. package/packages/api-builder/src/lib.rs +19 -0
  288. package/packages/api-builder/src/metrics.rs +29 -0
  289. package/packages/api-builder/src/middleware.rs +232 -0
  290. package/packages/api-builder/src/prelude.rs +18 -0
  291. package/packages/api-builder/src/request_ids.rs +17 -0
  292. package/packages/api-builder/src/router.rs +89 -0
  293. package/packages/api-builder/src/wrappers.rs +138 -0
  294. package/packages/api-builder/tests/basic.rs +215 -0
  295. package/packages/api-builder/tests/errors.rs +104 -0
  296. package/packages/api-peer/Cargo.toml +34 -0
  297. package/packages/api-peer/src/actors/create.rs +40 -0
  298. package/packages/api-peer/src/actors/delete.rs +87 -0
  299. package/packages/api-peer/src/actors/kv_get.rs +67 -0
  300. package/packages/api-peer/src/actors/list.rs +98 -0
  301. package/packages/api-peer/src/actors/list_names.rs +56 -0
  302. package/packages/api-peer/src/actors/mod.rs +5 -0
  303. package/packages/api-peer/src/internal.rs +186 -0
  304. package/packages/api-peer/src/lib.rs +28 -0
  305. package/packages/api-peer/src/namespaces.rs +122 -0
  306. package/packages/api-peer/src/router.rs +51 -0
  307. package/packages/api-peer/src/runner_configs.rs +160 -0
  308. package/packages/api-peer/src/runners.rs +109 -0
  309. package/packages/api-public/Cargo.toml +38 -0
  310. package/packages/api-public/build.rs +45 -0
  311. package/packages/api-public/src/actors/create.rs +99 -0
  312. package/packages/api-public/src/actors/delete.rs +86 -0
  313. package/packages/api-public/src/actors/get_or_create.rs +170 -0
  314. package/packages/api-public/src/actors/kv_get.rs +79 -0
  315. package/packages/api-public/src/actors/list.rs +241 -0
  316. package/packages/api-public/src/actors/list_names.rs +76 -0
  317. package/packages/api-public/src/actors/mod.rs +7 -0
  318. package/packages/api-public/src/actors/utils.rs +216 -0
  319. package/packages/api-public/src/ctx.rs +70 -0
  320. package/packages/api-public/src/datacenters.rs +43 -0
  321. package/packages/api-public/src/errors.rs +30 -0
  322. package/packages/api-public/src/health.rs +166 -0
  323. package/packages/api-public/src/lib.rs +13 -0
  324. package/packages/api-public/src/metadata.rs +24 -0
  325. package/packages/api-public/src/namespaces.rs +89 -0
  326. package/packages/api-public/src/router.rs +182 -0
  327. package/packages/api-public/src/runner_configs/delete.rs +99 -0
  328. package/packages/api-public/src/runner_configs/list.rs +98 -0
  329. package/packages/api-public/src/runner_configs/mod.rs +12 -0
  330. package/packages/api-public/src/runner_configs/refresh_metadata.rs +116 -0
  331. package/packages/api-public/src/runner_configs/serverless_health_check.rs +81 -0
  332. package/packages/api-public/src/runner_configs/upsert.rs +194 -0
  333. package/packages/api-public/src/runner_configs/utils.rs +217 -0
  334. package/packages/api-public/src/runners.rs +144 -0
  335. package/packages/api-public/src/ui.rs +44 -0
  336. package/packages/api-types/Cargo.toml +17 -0
  337. package/packages/api-types/src/actors/create.rs +29 -0
  338. package/packages/api-types/src/actors/list.rs +23 -0
  339. package/packages/api-types/src/actors/list_names.rs +24 -0
  340. package/packages/api-types/src/actors/mod.rs +3 -0
  341. package/packages/api-types/src/datacenters/list.rs +12 -0
  342. package/packages/api-types/src/datacenters/mod.rs +1 -0
  343. package/packages/api-types/src/lib.rs +6 -0
  344. package/packages/api-types/src/namespaces/list.rs +21 -0
  345. package/packages/api-types/src/namespaces/mod.rs +2 -0
  346. package/packages/api-types/src/namespaces/runner_configs.rs +55 -0
  347. package/packages/api-types/src/pagination.rs +8 -0
  348. package/packages/api-types/src/runner_configs/list.rs +29 -0
  349. package/packages/api-types/src/runner_configs/mod.rs +1 -0
  350. package/packages/api-types/src/runners/list.rs +25 -0
  351. package/packages/api-types/src/runners/mod.rs +1 -0
  352. package/packages/api-util/Cargo.toml +22 -0
  353. package/packages/api-util/src/errors.rs +9 -0
  354. package/packages/api-util/src/lib.rs +209 -0
  355. package/packages/bootstrap/Cargo.toml +19 -0
  356. package/packages/bootstrap/src/lib.rs +102 -0
  357. package/packages/cache/Cargo.toml +28 -0
  358. package/packages/cache/src/driver.rs +346 -0
  359. package/packages/cache/src/errors.rs +23 -0
  360. package/packages/cache/src/getter_ctx.rs +138 -0
  361. package/packages/cache/src/inner.rs +60 -0
  362. package/packages/cache/src/key.rs +101 -0
  363. package/packages/cache/src/lib.rs +19 -0
  364. package/packages/cache/src/metrics.rs +34 -0
  365. package/packages/cache/src/purge.rs +13 -0
  366. package/packages/cache/src/rate_limit.rs +109 -0
  367. package/packages/cache/src/req_config.rs +443 -0
  368. package/packages/cache/tests/integration.rs +582 -0
  369. package/packages/cache-purge/Cargo.toml +17 -0
  370. package/packages/cache-purge/src/lib.rs +44 -0
  371. package/packages/cache-result/Cargo.toml +9 -0
  372. package/packages/cache-result/src/lib.rs +61 -0
  373. package/packages/clickhouse-inserter/Cargo.toml +17 -0
  374. package/packages/clickhouse-inserter/src/error.rs +16 -0
  375. package/packages/clickhouse-inserter/src/lib.rs +179 -0
  376. package/packages/clickhouse-user-query/Cargo.toml +16 -0
  377. package/packages/clickhouse-user-query/examples/case_sensitivity_demo.rs +100 -0
  378. package/packages/clickhouse-user-query/examples/group_by_example.rs +53 -0
  379. package/packages/clickhouse-user-query/examples/string_contains_demo.rs +96 -0
  380. package/packages/clickhouse-user-query/src/builder.rs +445 -0
  381. package/packages/clickhouse-user-query/src/error.rs +37 -0
  382. package/packages/clickhouse-user-query/src/lib.rs +61 -0
  383. package/packages/clickhouse-user-query/src/query.rs +143 -0
  384. package/packages/clickhouse-user-query/src/schema.rs +78 -0
  385. package/packages/clickhouse-user-query/tests/builder_tests.rs +619 -0
  386. package/packages/clickhouse-user-query/tests/case_sensitivity_tests.rs +307 -0
  387. package/packages/clickhouse-user-query/tests/integration_tests.rs +540 -0
  388. package/packages/clickhouse-user-query/tests/query_tests.rs +263 -0
  389. package/packages/clickhouse-user-query/tests/schema_tests.rs +44 -0
  390. package/packages/config/Cargo.toml +20 -0
  391. package/packages/config/src/config/api_peer.rs +21 -0
  392. package/packages/config/src/config/api_public.rs +25 -0
  393. package/packages/config/src/config/auth.rs +10 -0
  394. package/packages/config/src/config/cache.rs +24 -0
  395. package/packages/config/src/config/clickhouse.rs +49 -0
  396. package/packages/config/src/config/db.rs +52 -0
  397. package/packages/config/src/config/guard.rs +42 -0
  398. package/packages/config/src/config/logs.rs +10 -0
  399. package/packages/config/src/config/mod.rs +240 -0
  400. package/packages/config/src/config/pegboard.rs +94 -0
  401. package/packages/config/src/config/pubsub.rs +90 -0
  402. package/packages/config/src/config/runtime.rs +31 -0
  403. package/packages/config/src/config/telemetry.rs +14 -0
  404. package/packages/config/src/config/topology.rs +123 -0
  405. package/packages/config/src/config/vector.rs +18 -0
  406. package/packages/config/src/defaults.rs +11 -0
  407. package/packages/config/src/lib.rs +135 -0
  408. package/packages/config/src/paths.rs +25 -0
  409. package/packages/config/src/secret.rs +72 -0
  410. package/packages/dump-openapi/Cargo.toml +11 -0
  411. package/packages/dump-openapi/build.rs +26 -0
  412. package/packages/dump-openapi/src/lib.rs +1 -0
  413. package/packages/engine/Cargo.toml +74 -0
  414. package/packages/engine/src/commands/config.rs +18 -0
  415. package/packages/engine/src/commands/db/mod.rs +80 -0
  416. package/packages/engine/src/commands/mod.rs +7 -0
  417. package/packages/engine/src/commands/start.rs +143 -0
  418. package/packages/engine/src/commands/tracing.rs +86 -0
  419. package/packages/engine/src/commands/udb/cli.rs +562 -0
  420. package/packages/engine/src/commands/udb/mod.rs +132 -0
  421. package/packages/engine/src/commands/udb_keys.rs +200 -0
  422. package/packages/engine/src/commands/wf/mod.rs +125 -0
  423. package/packages/engine/src/commands/wf/signal.rs +80 -0
  424. package/packages/engine/src/keys.rs +47 -0
  425. package/packages/engine/src/lib.rs +55 -0
  426. package/packages/engine/src/main.rs +60 -0
  427. package/packages/engine/src/run_config.rs +53 -0
  428. package/packages/engine/src/util/db.rs +99 -0
  429. package/packages/engine/src/util/format.rs +69 -0
  430. package/packages/engine/src/util/mod.rs +13 -0
  431. package/packages/engine/src/util/udb.rs +687 -0
  432. package/packages/engine/src/util/wf/mod.rs +649 -0
  433. package/packages/engine/src/util/wf/signal.rs +126 -0
  434. package/packages/engine/tests/actors_create.rs +524 -0
  435. package/packages/engine/tests/actors_delete.rs +243 -0
  436. package/packages/engine/tests/actors_general.rs +191 -0
  437. package/packages/engine/tests/actors_get.rs +230 -0
  438. package/packages/engine/tests/actors_get_by_id.rs +170 -0
  439. package/packages/engine/tests/actors_get_or_create.rs +294 -0
  440. package/packages/engine/tests/actors_get_or_create_by_id.rs +147 -0
  441. package/packages/engine/tests/actors_lifecycle.rs +165 -0
  442. package/packages/engine/tests/actors_list.rs +798 -0
  443. package/packages/engine/tests/actors_list_names.rs +353 -0
  444. package/packages/engine/tests/common/actors.rs +554 -0
  445. package/packages/engine/tests/common/ctx.rs +201 -0
  446. package/packages/engine/tests/common/mod.rs +30 -0
  447. package/packages/engine/tests/common/ns.rs +36 -0
  448. package/packages/engine/tests/common/runner.rs +134 -0
  449. package/packages/engine/tests/common/test_helpers.rs +226 -0
  450. package/packages/engine/tests/runners_dupe_key.rs +27 -0
  451. package/packages/engine/tests/runners_version.rs +50 -0
  452. package/packages/env/Cargo.toml +14 -0
  453. package/packages/env/build.rs +8 -0
  454. package/packages/env/src/lib.rs +30 -0
  455. package/packages/epoxy/Cargo.toml +45 -0
  456. package/packages/epoxy/README.md +158 -0
  457. package/packages/epoxy/spec/KEYS.md +33 -0
  458. package/packages/epoxy/spec/PROPOSAL.md +125 -0
  459. package/packages/epoxy/spec/RECONFIGURE.md +40 -0
  460. package/packages/epoxy/src/consts.rs +42 -0
  461. package/packages/epoxy/src/errors.rs +21 -0
  462. package/packages/epoxy/src/http_client.rs +192 -0
  463. package/packages/epoxy/src/http_routes.rs +34 -0
  464. package/packages/epoxy/src/keys/keys.rs +99 -0
  465. package/packages/epoxy/src/keys/mod.rs +9 -0
  466. package/packages/epoxy/src/keys/replica.rs +283 -0
  467. package/packages/epoxy/src/lib.rs +25 -0
  468. package/packages/epoxy/src/ops/explicit_prepare.rs +342 -0
  469. package/packages/epoxy/src/ops/kv/get_local.rs +44 -0
  470. package/packages/epoxy/src/ops/kv/get_optimistic.rs +150 -0
  471. package/packages/epoxy/src/ops/kv/mod.rs +3 -0
  472. package/packages/epoxy/src/ops/kv/purge_local.rs +28 -0
  473. package/packages/epoxy/src/ops/mod.rs +4 -0
  474. package/packages/epoxy/src/ops/propose.rs +352 -0
  475. package/packages/epoxy/src/ops/read_cluster_config.rs +24 -0
  476. package/packages/epoxy/src/replica/ballot.rs +130 -0
  477. package/packages/epoxy/src/replica/commit_kv.rs +80 -0
  478. package/packages/epoxy/src/replica/decide_path.rs +51 -0
  479. package/packages/epoxy/src/replica/lead_consensus.rs +65 -0
  480. package/packages/epoxy/src/replica/log.rs +84 -0
  481. package/packages/epoxy/src/replica/message_request.rs +166 -0
  482. package/packages/epoxy/src/replica/messages/accept.rs +50 -0
  483. package/packages/epoxy/src/replica/messages/accepted.rs +35 -0
  484. package/packages/epoxy/src/replica/messages/commit.rs +46 -0
  485. package/packages/epoxy/src/replica/messages/committed.rs +41 -0
  486. package/packages/epoxy/src/replica/messages/download_instances.rs +69 -0
  487. package/packages/epoxy/src/replica/messages/mod.rs +15 -0
  488. package/packages/epoxy/src/replica/messages/pre_accept.rs +69 -0
  489. package/packages/epoxy/src/replica/messages/prepare.rs +89 -0
  490. package/packages/epoxy/src/replica/mod.rs +11 -0
  491. package/packages/epoxy/src/replica/update_config.rs +24 -0
  492. package/packages/epoxy/src/replica/utils.rs +111 -0
  493. package/packages/epoxy/src/types.rs +117 -0
  494. package/packages/epoxy/src/utils.rs +65 -0
  495. package/packages/epoxy/src/workflows/coordinator/mod.rs +121 -0
  496. package/packages/epoxy/src/workflows/coordinator/reconfigure.rs +291 -0
  497. package/packages/epoxy/src/workflows/coordinator/replica_status_change.rs +193 -0
  498. package/packages/epoxy/src/workflows/mod.rs +3 -0
  499. package/packages/epoxy/src/workflows/purger.rs +81 -0
  500. package/packages/epoxy/src/workflows/replica/mod.rs +39 -0
  501. package/packages/epoxy/src/workflows/replica/setup.rs +823 -0
  502. package/packages/epoxy/tests/common/api.rs +25 -0
  503. package/packages/epoxy/tests/common/mod.rs +301 -0
  504. package/packages/epoxy/tests/common/utils.rs +23 -0
  505. package/packages/epoxy/tests/kv.rs +187 -0
  506. package/packages/epoxy/tests/kv_get_optimistic.rs +179 -0
  507. package/packages/epoxy/tests/proposal.rs +38 -0
  508. package/packages/epoxy/tests/reconfigure.rs +618 -0
  509. package/packages/error/Cargo.toml +16 -0
  510. package/packages/error/src/error.rs +90 -0
  511. package/packages/error/src/lib.rs +13 -0
  512. package/packages/error/src/schema.rs +86 -0
  513. package/packages/error/tests/basic.rs +338 -0
  514. package/packages/error-macros/Cargo.toml +19 -0
  515. package/packages/error-macros/src/lib.rs +632 -0
  516. package/packages/gasoline/Cargo.toml +55 -0
  517. package/packages/gasoline/src/activity.rs +24 -0
  518. package/packages/gasoline/src/builder/common/message.rs +104 -0
  519. package/packages/gasoline/src/builder/common/mod.rs +5 -0
  520. package/packages/gasoline/src/builder/common/signal.rs +193 -0
  521. package/packages/gasoline/src/builder/common/workflow.rs +196 -0
  522. package/packages/gasoline/src/builder/mod.rs +60 -0
  523. package/packages/gasoline/src/builder/workflow/message.rs +147 -0
  524. package/packages/gasoline/src/builder/workflow/mod.rs +5 -0
  525. package/packages/gasoline/src/builder/workflow/signal.rs +227 -0
  526. package/packages/gasoline/src/builder/workflow/sub_workflow.rs +318 -0
  527. package/packages/gasoline/src/ctx/activity.rs +192 -0
  528. package/packages/gasoline/src/ctx/common.rs +153 -0
  529. package/packages/gasoline/src/ctx/listen.rs +121 -0
  530. package/packages/gasoline/src/ctx/message.rs +346 -0
  531. package/packages/gasoline/src/ctx/mod.rs +18 -0
  532. package/packages/gasoline/src/ctx/operation.rs +191 -0
  533. package/packages/gasoline/src/ctx/standalone.rs +228 -0
  534. package/packages/gasoline/src/ctx/test.rs +251 -0
  535. package/packages/gasoline/src/ctx/versioned_workflow.rs +198 -0
  536. package/packages/gasoline/src/ctx/workflow.rs +1459 -0
  537. package/packages/gasoline/src/db/debug.rs +199 -0
  538. package/packages/gasoline/src/db/kv/debug.rs +1493 -0
  539. package/packages/gasoline/src/db/kv/keys/history.rs +1780 -0
  540. package/packages/gasoline/src/db/kv/keys/metric.rs +170 -0
  541. package/packages/gasoline/src/db/kv/keys/mod.rs +6 -0
  542. package/packages/gasoline/src/db/kv/keys/signal.rs +401 -0
  543. package/packages/gasoline/src/db/kv/keys/wake.rs +310 -0
  544. package/packages/gasoline/src/db/kv/keys/worker.rs +185 -0
  545. package/packages/gasoline/src/db/kv/keys/workflow.rs +1175 -0
  546. package/packages/gasoline/src/db/kv/mod.rs +3044 -0
  547. package/packages/gasoline/src/db/kv/subjects.rs +13 -0
  548. package/packages/gasoline/src/db/kv/system.rs +33 -0
  549. package/packages/gasoline/src/db/mod.rs +344 -0
  550. package/packages/gasoline/src/error.rs +258 -0
  551. package/packages/gasoline/src/executable.rs +186 -0
  552. package/packages/gasoline/src/history/cursor.rs +779 -0
  553. package/packages/gasoline/src/history/event.rs +210 -0
  554. package/packages/gasoline/src/history/location.rs +185 -0
  555. package/packages/gasoline/src/history/mod.rs +8 -0
  556. package/packages/gasoline/src/history/removed.rs +94 -0
  557. package/packages/gasoline/src/lib.rs +18 -0
  558. package/packages/gasoline/src/listen.rs +24 -0
  559. package/packages/gasoline/src/message.rs +103 -0
  560. package/packages/gasoline/src/metrics.rs +156 -0
  561. package/packages/gasoline/src/operation.rs +21 -0
  562. package/packages/gasoline/src/prelude.rs +53 -0
  563. package/packages/gasoline/src/registry.rs +111 -0
  564. package/packages/gasoline/src/signal.rs +117 -0
  565. package/packages/gasoline/src/stub.rs +118 -0
  566. package/packages/gasoline/src/utils/mod.rs +20 -0
  567. package/packages/gasoline/src/utils/tags.rs +82 -0
  568. package/packages/gasoline/src/utils/time.rs +85 -0
  569. package/packages/gasoline/src/worker.rs +336 -0
  570. package/packages/gasoline/src/workflow.rs +64 -0
  571. package/packages/gasoline/tests/activity_ctx.rs +83 -0
  572. package/packages/gasoline/tests/workflow_ctx.rs +288 -0
  573. package/packages/gasoline/tests/workflows/activity_test.rs +33 -0
  574. package/packages/gasoline/tests/workflows/basic.rs +13 -0
  575. package/packages/gasoline/tests/workflows/eviction_test.rs +45 -0
  576. package/packages/gasoline/tests/workflows/listen_timeout.rs +27 -0
  577. package/packages/gasoline/tests/workflows/loop_test.rs +30 -0
  578. package/packages/gasoline/tests/workflows/mod.rs +11 -0
  579. package/packages/gasoline/tests/workflows/properties_test.rs +56 -0
  580. package/packages/gasoline/tests/workflows/signal_test.rs +24 -0
  581. package/packages/gasoline/tests/workflows/sleep_test.rs +15 -0
  582. package/packages/gasoline/tests/workflows/state_test.rs +69 -0
  583. package/packages/gasoline/tests/workflows/sub_test.rs +21 -0
  584. package/packages/gasoline/tests/workflows/tags_test.rs +40 -0
  585. package/packages/gasoline-macros/Cargo.toml +14 -0
  586. package/packages/gasoline-macros/src/lib.rs +527 -0
  587. package/packages/guard/Cargo.toml +56 -0
  588. package/packages/guard/src/cache/actor.rs +43 -0
  589. package/packages/guard/src/cache/mod.rs +69 -0
  590. package/packages/guard/src/errors.rs +62 -0
  591. package/packages/guard/src/lib.rs +58 -0
  592. package/packages/guard/src/middleware.rs +42 -0
  593. package/packages/guard/src/routing/api_public.rs +70 -0
  594. package/packages/guard/src/routing/mod.rs +245 -0
  595. package/packages/guard/src/routing/pegboard_gateway.rs +260 -0
  596. package/packages/guard/src/routing/runner.rs +129 -0
  597. package/packages/guard/src/shared_state.rs +31 -0
  598. package/packages/guard/src/tls.rs +224 -0
  599. package/packages/guard/tests/parse_actor_path.rs +240 -0
  600. package/packages/guard-core/Cargo.toml +58 -0
  601. package/packages/guard-core/src/analytics.rs +46 -0
  602. package/packages/guard-core/src/cert_resolver.rs +61 -0
  603. package/packages/guard-core/src/custom_serve.rs +52 -0
  604. package/packages/guard-core/src/errors.rs +113 -0
  605. package/packages/guard-core/src/lib.rs +25 -0
  606. package/packages/guard-core/src/metrics.rs +64 -0
  607. package/packages/guard-core/src/proxy_service.rs +2699 -0
  608. package/packages/guard-core/src/request_context.rs +184 -0
  609. package/packages/guard-core/src/server.rs +289 -0
  610. package/packages/guard-core/src/task_group.rs +57 -0
  611. package/packages/guard-core/src/types.rs +19 -0
  612. package/packages/guard-core/src/websocket_handle.rs +47 -0
  613. package/packages/guard-core/tests/common/mod.rs +678 -0
  614. package/packages/guard-core/tests/custom_serve.rs +392 -0
  615. package/packages/guard-core/tests/fixtures/tls/README.md +6 -0
  616. package/packages/guard-core/tests/fixtures/tls/api_cert.pem +51 -0
  617. package/packages/guard-core/tests/fixtures/tls/api_key.pem +7 -0
  618. package/packages/guard-core/tests/fixtures/tls/job_cert.pem +55 -0
  619. package/packages/guard-core/tests/fixtures/tls/job_key.pem +7 -0
  620. package/packages/guard-core/tests/https.rs +400 -0
  621. package/packages/guard-core/tests/metrics.rs +247 -0
  622. package/packages/guard-core/tests/proxy.rs +842 -0
  623. package/packages/guard-core/tests/simple_websocket.rs +258 -0
  624. package/packages/guard-core/tests/simple_websocket_echo.rs +318 -0
  625. package/packages/guard-core/tests/simple_websocket_test2.rs +120 -0
  626. package/packages/guard-core/tests/streaming_response.rs +265 -0
  627. package/packages/guard-core/tests/websocket.rs +1113 -0
  628. package/packages/internal/Cargo.toml +13 -0
  629. package/packages/internal/README.md +1 -0
  630. package/packages/internal/src/lib.rs +1 -0
  631. package/packages/internal/src/ops/bump_serverless_autoscaler_global.rs +64 -0
  632. package/packages/internal/src/ops/cache/mod.rs +1 -0
  633. package/packages/internal/src/ops/cache/purge_global.rs +81 -0
  634. package/packages/internal/src/ops/mod.rs +2 -0
  635. package/packages/logs/Cargo.toml +20 -0
  636. package/packages/logs/src/lib.rs +9 -0
  637. package/packages/logs/src/unix.rs +201 -0
  638. package/packages/logs/src/windows.rs +240 -0
  639. package/packages/metrics/Cargo.toml +20 -0
  640. package/packages/metrics/src/buckets.rs +32 -0
  641. package/packages/metrics/src/lib.rs +8 -0
  642. package/packages/metrics/src/providers.rs +183 -0
  643. package/packages/namespace/Cargo.toml +28 -0
  644. package/packages/namespace/src/errors.rs +39 -0
  645. package/packages/namespace/src/keys/mod.rs +190 -0
  646. package/packages/namespace/src/keys/runner_config.rs +211 -0
  647. package/packages/namespace/src/lib.rs +16 -0
  648. package/packages/namespace/src/ops/get_global.rs +58 -0
  649. package/packages/namespace/src/ops/get_local.rs +69 -0
  650. package/packages/namespace/src/ops/list.rs +69 -0
  651. package/packages/namespace/src/ops/mod.rs +6 -0
  652. package/packages/namespace/src/ops/resolve_for_name_global.rs +57 -0
  653. package/packages/namespace/src/ops/resolve_for_name_local.rs +41 -0
  654. package/packages/namespace/src/ops/runner_config/delete.rs +53 -0
  655. package/packages/namespace/src/ops/runner_config/get.rs +94 -0
  656. package/packages/namespace/src/ops/runner_config/list.rs +94 -0
  657. package/packages/namespace/src/ops/runner_config/mod.rs +4 -0
  658. package/packages/namespace/src/ops/runner_config/upsert.rs +148 -0
  659. package/packages/namespace/src/utils.rs +11 -0
  660. package/packages/namespace/src/workflows/mod.rs +1 -0
  661. package/packages/namespace/src/workflows/namespace.rs +178 -0
  662. package/packages/pegboard/Cargo.toml +34 -0
  663. package/packages/pegboard/src/errors.rs +76 -0
  664. package/packages/pegboard/src/keys/actor.rs +443 -0
  665. package/packages/pegboard/src/keys/epoxy/mod.rs +1 -0
  666. package/packages/pegboard/src/keys/epoxy/ns.rs +68 -0
  667. package/packages/pegboard/src/keys/hibernating_request.rs +72 -0
  668. package/packages/pegboard/src/keys/mod.rs +15 -0
  669. package/packages/pegboard/src/keys/ns.rs +1367 -0
  670. package/packages/pegboard/src/keys/runner.rs +818 -0
  671. package/packages/pegboard/src/lib.rs +19 -0
  672. package/packages/pegboard/src/metrics.rs +19 -0
  673. package/packages/pegboard/src/ops/actor/create.rs +159 -0
  674. package/packages/pegboard/src/ops/actor/get.rs +100 -0
  675. package/packages/pegboard/src/ops/actor/get_for_gateway.rs +70 -0
  676. package/packages/pegboard/src/ops/actor/get_for_key.rs +93 -0
  677. package/packages/pegboard/src/ops/actor/get_reservation_for_key.rs +46 -0
  678. package/packages/pegboard/src/ops/actor/get_runner.rs +64 -0
  679. package/packages/pegboard/src/ops/actor/hibernating_request/delete.rs +41 -0
  680. package/packages/pegboard/src/ops/actor/hibernating_request/list.rs +65 -0
  681. package/packages/pegboard/src/ops/actor/hibernating_request/mod.rs +3 -0
  682. package/packages/pegboard/src/ops/actor/hibernating_request/upsert.rs +51 -0
  683. package/packages/pegboard/src/ops/actor/list_for_ns.rs +207 -0
  684. package/packages/pegboard/src/ops/actor/list_names.rs +62 -0
  685. package/packages/pegboard/src/ops/actor/mod.rs +9 -0
  686. package/packages/pegboard/src/ops/mod.rs +2 -0
  687. package/packages/pegboard/src/ops/runner/find_dc_with_runner.rs +222 -0
  688. package/packages/pegboard/src/ops/runner/get.rs +143 -0
  689. package/packages/pegboard/src/ops/runner/get_by_key.rs +51 -0
  690. package/packages/pegboard/src/ops/runner/list_for_ns.rs +209 -0
  691. package/packages/pegboard/src/ops/runner/list_names.rs +60 -0
  692. package/packages/pegboard/src/ops/runner/mod.rs +6 -0
  693. package/packages/pegboard/src/ops/runner/update_alloc_idx.rs +208 -0
  694. package/packages/pegboard/src/pubsub_subjects.rs +80 -0
  695. package/packages/pegboard/src/utils.rs +29 -0
  696. package/packages/pegboard/src/workflows/actor/destroy.rs +264 -0
  697. package/packages/pegboard/src/workflows/actor/keys.rs +283 -0
  698. package/packages/pegboard/src/workflows/actor/mod.rs +804 -0
  699. package/packages/pegboard/src/workflows/actor/runtime.rs +909 -0
  700. package/packages/pegboard/src/workflows/actor/setup.rs +175 -0
  701. package/packages/pegboard/src/workflows/mod.rs +2 -0
  702. package/packages/pegboard/src/workflows/runner.rs +1182 -0
  703. package/packages/pegboard-gateway/Cargo.toml +35 -0
  704. package/packages/pegboard-gateway/src/keepalive_task.rs +61 -0
  705. package/packages/pegboard-gateway/src/lib.rs +698 -0
  706. package/packages/pegboard-gateway/src/metrics.rs +14 -0
  707. package/packages/pegboard-gateway/src/ping_task.rs +23 -0
  708. package/packages/pegboard-gateway/src/shared_state.rs +588 -0
  709. package/packages/pegboard-gateway/src/tunnel_to_ws_task.rs +85 -0
  710. package/packages/pegboard-gateway/src/ws_to_tunnel_task.rs +65 -0
  711. package/packages/pegboard-runner/Cargo.toml +38 -0
  712. package/packages/pegboard-runner/src/conn.rs +183 -0
  713. package/packages/pegboard-runner/src/errors.rs +33 -0
  714. package/packages/pegboard-runner/src/lib.rs +249 -0
  715. package/packages/pegboard-runner/src/ping_task.rs +66 -0
  716. package/packages/pegboard-runner/src/tunnel_to_ws_task.rs +137 -0
  717. package/packages/pegboard-runner/src/utils.rs +40 -0
  718. package/packages/pegboard-runner/src/ws_to_tunnel_task.rs +443 -0
  719. package/packages/pegboard-serverless/Cargo.toml +25 -0
  720. package/packages/pegboard-serverless/src/lib.rs +523 -0
  721. package/packages/pools/Cargo.toml +38 -0
  722. package/packages/pools/src/db/clickhouse.rs +37 -0
  723. package/packages/pools/src/db/mod.rs +3 -0
  724. package/packages/pools/src/db/udb.rs +37 -0
  725. package/packages/pools/src/db/ups.rs +91 -0
  726. package/packages/pools/src/error.rs +41 -0
  727. package/packages/pools/src/lib.rs +16 -0
  728. package/packages/pools/src/metrics.rs +32 -0
  729. package/packages/pools/src/pools.rs +114 -0
  730. package/packages/pools/src/prelude.rs +3 -0
  731. package/packages/pools/src/reqwest.rs +25 -0
  732. package/packages/runtime/Cargo.lock +1394 -0
  733. package/packages/runtime/Cargo.toml +29 -0
  734. package/packages/runtime/src/lib.rs +154 -0
  735. package/packages/runtime/src/metrics.rs +34 -0
  736. package/packages/runtime/src/term_signal.rs +113 -0
  737. package/packages/runtime/src/traces.rs +158 -0
  738. package/packages/service-manager/Cargo.toml +19 -0
  739. package/packages/service-manager/src/lib.rs +359 -0
  740. package/packages/telemetry/Cargo.toml +13 -0
  741. package/packages/telemetry/README.md +12 -0
  742. package/packages/telemetry/src/lib.rs +39 -0
  743. package/packages/test-deps/Cargo.toml +19 -0
  744. package/packages/test-deps/src/datacenter.rs +109 -0
  745. package/packages/test-deps/src/lib.rs +131 -0
  746. package/packages/test-deps-docker/Cargo.toml +14 -0
  747. package/packages/test-deps-docker/src/database.rs +135 -0
  748. package/packages/test-deps-docker/src/lib.rs +280 -0
  749. package/packages/test-deps-docker/src/pubsub.rs +76 -0
  750. package/packages/tracing-reconfigure/Cargo.toml +18 -0
  751. package/packages/tracing-reconfigure/src/lib.rs +78 -0
  752. package/packages/tracing-utils/Cargo.toml +12 -0
  753. package/packages/tracing-utils/src/lib.rs +91 -0
  754. package/packages/types/Cargo.toml +19 -0
  755. package/packages/types/README.md +3 -0
  756. package/packages/types/src/actors.rs +79 -0
  757. package/packages/types/src/datacenters.rs +10 -0
  758. package/packages/types/src/keys/mod.rs +2 -0
  759. package/packages/types/src/keys/namespace/mod.rs +1 -0
  760. package/packages/types/src/keys/namespace/runner_config.rs +28 -0
  761. package/packages/types/src/keys/pegboard/mod.rs +7 -0
  762. package/packages/types/src/keys/pegboard/ns.rs +109 -0
  763. package/packages/types/src/lib.rs +7 -0
  764. package/packages/types/src/msgs/mod.rs +1 -0
  765. package/packages/types/src/msgs/pegboard.rs +5 -0
  766. package/packages/types/src/namespaces.rs +10 -0
  767. package/packages/types/src/runner_configs.rs +96 -0
  768. package/packages/types/src/runners.rs +24 -0
  769. package/packages/universaldb/Cargo.toml +32 -0
  770. package/packages/universaldb/src/atomic.rs +190 -0
  771. package/packages/universaldb/src/database.rs +56 -0
  772. package/packages/universaldb/src/driver/mod.rs +87 -0
  773. package/packages/universaldb/src/driver/postgres/database.rs +244 -0
  774. package/packages/universaldb/src/driver/postgres/mod.rs +5 -0
  775. package/packages/universaldb/src/driver/postgres/transaction.rs +337 -0
  776. package/packages/universaldb/src/driver/postgres/transaction_task.rs +538 -0
  777. package/packages/universaldb/src/driver/rocksdb/database.rs +129 -0
  778. package/packages/universaldb/src/driver/rocksdb/mod.rs +6 -0
  779. package/packages/universaldb/src/driver/rocksdb/transaction.rs +354 -0
  780. package/packages/universaldb/src/driver/rocksdb/transaction_conflict_tracker.rs +109 -0
  781. package/packages/universaldb/src/driver/rocksdb/transaction_task.rs +526 -0
  782. package/packages/universaldb/src/error.rs +30 -0
  783. package/packages/universaldb/src/key_selector.rs +97 -0
  784. package/packages/universaldb/src/lib.rs +24 -0
  785. package/packages/universaldb/src/metrics.rs +27 -0
  786. package/packages/universaldb/src/options.rs +284 -0
  787. package/packages/universaldb/src/prelude.rs +8 -0
  788. package/packages/universaldb/src/range_option.rs +159 -0
  789. package/packages/universaldb/src/transaction.rs +378 -0
  790. package/packages/universaldb/src/tx_ops.rs +425 -0
  791. package/packages/universaldb/src/utils/cherry_pick.rs +88 -0
  792. package/packages/universaldb/src/utils/codes.rs +9 -0
  793. package/packages/universaldb/src/utils/ext.rs +58 -0
  794. package/packages/universaldb/src/utils/formal_key.rs +23 -0
  795. package/packages/universaldb/src/utils/keys.rs +134 -0
  796. package/packages/universaldb/src/utils/mod.rs +92 -0
  797. package/packages/universaldb/src/utils/subspace.rs +95 -0
  798. package/packages/universaldb/src/value.rs +159 -0
  799. package/packages/universaldb/src/versionstamp.rs +173 -0
  800. package/packages/universaldb/tests/integration.rs +2733 -0
  801. package/packages/universaldb/tests/integration_gas.rs +264 -0
  802. package/packages/universaldb/tests/rocksdb.rs +141 -0
  803. package/packages/universaldb/tests/versionstamp.rs +184 -0
  804. package/packages/universalpubsub/Cargo.toml +38 -0
  805. package/packages/universalpubsub/benches/simple.rs +932 -0
  806. package/packages/universalpubsub/src/chunking.rs +226 -0
  807. package/packages/universalpubsub/src/driver/memory/mod.rs +91 -0
  808. package/packages/universalpubsub/src/driver/mod.rs +58 -0
  809. package/packages/universalpubsub/src/driver/nats/mod.rs +79 -0
  810. package/packages/universalpubsub/src/driver/postgres/mod.rs +443 -0
  811. package/packages/universalpubsub/src/errors.rs +11 -0
  812. package/packages/universalpubsub/src/lib.rs +7 -0
  813. package/packages/universalpubsub/src/pubsub.rs +415 -0
  814. package/packages/universalpubsub/tests/integration.rs +441 -0
  815. package/packages/universalpubsub/tests/reconnect.rs +359 -0
  816. package/packages/util/Cargo.toml +41 -0
  817. package/packages/util/build.rs +13 -0
  818. package/packages/util/src/backoff.rs +109 -0
  819. package/packages/util/src/billing.rs +3 -0
  820. package/packages/util/src/build_meta.rs +33 -0
  821. package/packages/util/src/check.rs +222 -0
  822. package/packages/util/src/duration.rs +77 -0
  823. package/packages/util/src/faker.rs +81 -0
  824. package/packages/util/src/format.rs +185 -0
  825. package/packages/util/src/future.rs +1 -0
  826. package/packages/util/src/geo.rs +5 -0
  827. package/packages/util/src/lib.rs +40 -0
  828. package/packages/util/src/math.rs +35 -0
  829. package/packages/util/src/req.rs +41 -0
  830. package/packages/util/src/serde.rs +516 -0
  831. package/packages/util/src/size.rs +27 -0
  832. package/packages/util/src/sort.rs +13 -0
  833. package/packages/util/src/timestamp.rs +58 -0
  834. package/packages/util/src/url.rs +3 -0
  835. package/packages/util-id/Cargo.toml +13 -0
  836. package/packages/util-id/src/lib.rs +329 -0
  837. package/packages/workflow-worker/Cargo.toml +16 -0
  838. package/packages/workflow-worker/src/lib.rs +15 -0
  839. package/sdks/api/fern/fern.config.json +4 -0
  840. package/sdks/api/fern/generators.yml +25 -0
  841. package/sdks/go/api-full/client/client.go +459 -0
  842. package/sdks/go/api-full/client/client_test.go +43 -0
  843. package/sdks/go/api-full/client/options.go +39 -0
  844. package/sdks/go/api-full/core/client_option.go +44 -0
  845. package/sdks/go/api-full/core/core.go +220 -0
  846. package/sdks/go/api-full/core/core_test.go +219 -0
  847. package/sdks/go/api-full/core/stringer.go +13 -0
  848. package/sdks/go/api-full/datacenters/client.go +50 -0
  849. package/sdks/go/api-full/go.mod +8 -0
  850. package/sdks/go/api-full/go.sum +12 -0
  851. package/sdks/go/api-full/health/client.go +50 -0
  852. package/sdks/go/api-full/namespaces/client.go +92 -0
  853. package/sdks/go/api-full/namespaces.go +15 -0
  854. package/sdks/go/api-full/pointer.go +103 -0
  855. package/sdks/go/api-full/runners/client.go +111 -0
  856. package/sdks/go/api-full/runners.go +18 -0
  857. package/sdks/go/api-full/types.go +1638 -0
  858. package/sdks/rust/api-full/.openapi-generator/FILES +28 -0
  859. package/sdks/rust/api-full/.openapi-generator/VERSION +1 -0
  860. package/sdks/rust/api-full/.openapi-generator-ignore +23 -0
  861. package/sdks/rust/api-full/.travis.yml +1 -0
  862. package/sdks/rust/api-full/Cargo.toml +15 -0
  863. package/sdks/rust/api-full/README.md +53 -0
  864. package/sdks/rust/api-full/docs/Actor.md +19 -0
  865. package/sdks/rust/api-full/docs/ActorLifecycle.md +12 -0
  866. package/sdks/rust/api-full/docs/ActorsApi.md +37 -0
  867. package/sdks/rust/api-full/docs/ActorsCreateRequest.md +13 -0
  868. package/sdks/rust/api-full/docs/ActorsCreateResponse.md +11 -0
  869. package/sdks/rust/api-full/docs/Namespace.md +14 -0
  870. package/sdks/rust/api-full/docs/NamespacesCreateRequest.md +12 -0
  871. package/sdks/rust/api-full/docs/NamespacesCreateResponse.md +11 -0
  872. package/sdks/rust/api-full/docs/NsApi.md +37 -0
  873. package/sdks/rust/api-full/git_push.sh +57 -0
  874. package/sdks/rust/api-full/rust/.openapi-generator/FILES +140 -0
  875. package/sdks/rust/api-full/rust/.openapi-generator/VERSION +1 -0
  876. package/sdks/rust/api-full/rust/.openapi-generator-ignore +23 -0
  877. package/sdks/rust/api-full/rust/.travis.yml +1 -0
  878. package/sdks/rust/api-full/rust/Cargo.toml +15 -0
  879. package/sdks/rust/api-full/rust/README.md +111 -0
  880. package/sdks/rust/api-full/rust/docs/Actor.md +24 -0
  881. package/sdks/rust/api-full/rust/docs/ActorName.md +11 -0
  882. package/sdks/rust/api-full/rust/docs/ActorsCreateApi.md +40 -0
  883. package/sdks/rust/api-full/rust/docs/ActorsCreateRequest.md +16 -0
  884. package/sdks/rust/api-full/rust/docs/ActorsCreateResponse.md +11 -0
  885. package/sdks/rust/api-full/rust/docs/ActorsDeleteApi.md +40 -0
  886. package/sdks/rust/api-full/rust/docs/ActorsGetOrCreateApi.md +40 -0
  887. package/sdks/rust/api-full/rust/docs/ActorsGetOrCreateRequest.md +16 -0
  888. package/sdks/rust/api-full/rust/docs/ActorsGetOrCreateResponse.md +12 -0
  889. package/sdks/rust/api-full/rust/docs/ActorsKvGetApi.md +38 -0
  890. package/sdks/rust/api-full/rust/docs/ActorsKvGetResponse.md +12 -0
  891. package/sdks/rust/api-full/rust/docs/ActorsListApi.md +45 -0
  892. package/sdks/rust/api-full/rust/docs/ActorsListNamesApi.md +41 -0
  893. package/sdks/rust/api-full/rust/docs/ActorsListNamesResponse.md +12 -0
  894. package/sdks/rust/api-full/rust/docs/ActorsListResponse.md +12 -0
  895. package/sdks/rust/api-full/rust/docs/CrashPolicy.md +14 -0
  896. package/sdks/rust/api-full/rust/docs/Datacenter.md +13 -0
  897. package/sdks/rust/api-full/rust/docs/DatacenterHealth.md +16 -0
  898. package/sdks/rust/api-full/rust/docs/DatacentersApi.md +34 -0
  899. package/sdks/rust/api-full/rust/docs/DatacentersListResponse.md +12 -0
  900. package/sdks/rust/api-full/rust/docs/HealthApi.md +34 -0
  901. package/sdks/rust/api-full/rust/docs/HealthFanoutResponse.md +11 -0
  902. package/sdks/rust/api-full/rust/docs/HealthResponse.md +13 -0
  903. package/sdks/rust/api-full/rust/docs/HealthStatus.md +13 -0
  904. package/sdks/rust/api-full/rust/docs/Namespace.md +14 -0
  905. package/sdks/rust/api-full/rust/docs/NamespaceListResponse.md +12 -0
  906. package/sdks/rust/api-full/rust/docs/NamespacesApi.md +69 -0
  907. package/sdks/rust/api-full/rust/docs/NamespacesCreateRequest.md +12 -0
  908. package/sdks/rust/api-full/rust/docs/NamespacesCreateResponse.md +11 -0
  909. package/sdks/rust/api-full/rust/docs/Pagination.md +11 -0
  910. package/sdks/rust/api-full/rust/docs/Runner.md +25 -0
  911. package/sdks/rust/api-full/rust/docs/RunnerConfig.md +13 -0
  912. package/sdks/rust/api-full/rust/docs/RunnerConfigKind.md +12 -0
  913. package/sdks/rust/api-full/rust/docs/RunnerConfigKindOneOf.md +11 -0
  914. package/sdks/rust/api-full/rust/docs/RunnerConfigKindOneOf1.md +11 -0
  915. package/sdks/rust/api-full/rust/docs/RunnerConfigKindOneOf1Serverless.md +17 -0
  916. package/sdks/rust/api-full/rust/docs/RunnerConfigVariant.md +13 -0
  917. package/sdks/rust/api-full/rust/docs/RunnerConfigsDeleteApi.md +38 -0
  918. package/sdks/rust/api-full/rust/docs/RunnerConfigsListApi.md +41 -0
  919. package/sdks/rust/api-full/rust/docs/RunnerConfigsListResponse.md +12 -0
  920. package/sdks/rust/api-full/rust/docs/RunnerConfigsListResponseRunnerConfigsValue.md +11 -0
  921. package/sdks/rust/api-full/rust/docs/RunnerConfigsRefreshMetadataApi.md +39 -0
  922. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckApi.md +38 -0
  923. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckRequest.md +12 -0
  924. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponse.md +12 -0
  925. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponseOneOf.md +11 -0
  926. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponseOneOf1.md +11 -0
  927. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponseOneOf1Failure.md +11 -0
  928. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponseOneOfSuccess.md +11 -0
  929. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataError.md +16 -0
  930. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf.md +11 -0
  931. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf1.md +11 -0
  932. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf2.md +11 -0
  933. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf3.md +11 -0
  934. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf3NonSuccessStatus.md +12 -0
  935. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf4.md +11 -0
  936. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf4InvalidResponseJson.md +11 -0
  937. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf5.md +11 -0
  938. package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf5InvalidResponseSchema.md +12 -0
  939. package/sdks/rust/api-full/rust/docs/RunnerConfigsUpsertApi.md +39 -0
  940. package/sdks/rust/api-full/rust/docs/RunnerConfigsUpsertRequestBody.md +11 -0
  941. package/sdks/rust/api-full/rust/docs/RunnerConfigsUpsertResponse.md +11 -0
  942. package/sdks/rust/api-full/rust/docs/RunnersApi.md +75 -0
  943. package/sdks/rust/api-full/rust/docs/RunnersListNamesResponse.md +12 -0
  944. package/sdks/rust/api-full/rust/docs/RunnersListResponse.md +12 -0
  945. package/sdks/rust/api-full/rust/git_push.sh +57 -0
  946. package/sdks/rust/api-full/rust/src/apis/actors_create_api.rs +68 -0
  947. package/sdks/rust/api-full/rust/src/apis/actors_delete_api.rs +69 -0
  948. package/sdks/rust/api-full/rust/src/apis/actors_get_or_create_api.rs +68 -0
  949. package/sdks/rust/api-full/rust/src/apis/actors_kv_get_api.rs +65 -0
  950. package/sdks/rust/api-full/rust/src/apis/actors_list_api.rs +90 -0
  951. package/sdks/rust/api-full/rust/src/apis/actors_list_names_api.rs +74 -0
  952. package/sdks/rust/api-full/rust/src/apis/configuration.rs +51 -0
  953. package/sdks/rust/api-full/rust/src/apis/datacenters_api.rs +62 -0
  954. package/sdks/rust/api-full/rust/src/apis/health_api.rs +62 -0
  955. package/sdks/rust/api-full/rust/src/apis/mod.rs +130 -0
  956. package/sdks/rust/api-full/rust/src/apis/namespaces_api.rs +126 -0
  957. package/sdks/rust/api-full/rust/src/apis/runner_configs_delete_api.rs +66 -0
  958. package/sdks/rust/api-full/rust/src/apis/runner_configs_list_api.rs +81 -0
  959. package/sdks/rust/api-full/rust/src/apis/runner_configs_refresh_metadata_api.rs +68 -0
  960. package/sdks/rust/api-full/rust/src/apis/runner_configs_serverless_health_check_api.rs +67 -0
  961. package/sdks/rust/api-full/rust/src/apis/runner_configs_upsert_api.rs +68 -0
  962. package/sdks/rust/api-full/rust/src/apis/runners_api.rs +141 -0
  963. package/sdks/rust/api-full/rust/src/lib.rs +11 -0
  964. package/sdks/rust/api-full/rust/src/models/actor.rs +73 -0
  965. package/sdks/rust/api-full/rust/src/models/actor_name.rs +27 -0
  966. package/sdks/rust/api-full/rust/src/models/actors_create_request.rs +42 -0
  967. package/sdks/rust/api-full/rust/src/models/actors_create_response.rs +27 -0
  968. package/sdks/rust/api-full/rust/src/models/actors_get_or_create_request.rs +42 -0
  969. package/sdks/rust/api-full/rust/src/models/actors_get_or_create_response.rs +30 -0
  970. package/sdks/rust/api-full/rust/src/models/actors_kv_get_response.rs +30 -0
  971. package/sdks/rust/api-full/rust/src/models/actors_list_names_response.rs +30 -0
  972. package/sdks/rust/api-full/rust/src/models/actors_list_response.rs +30 -0
  973. package/sdks/rust/api-full/rust/src/models/crash_policy.rs +41 -0
  974. package/sdks/rust/api-full/rust/src/models/datacenter.rs +33 -0
  975. package/sdks/rust/api-full/rust/src/models/datacenter_health.rs +42 -0
  976. package/sdks/rust/api-full/rust/src/models/datacenters_list_response.rs +30 -0
  977. package/sdks/rust/api-full/rust/src/models/health_fanout_response.rs +27 -0
  978. package/sdks/rust/api-full/rust/src/models/health_response.rs +33 -0
  979. package/sdks/rust/api-full/rust/src/models/health_status.rs +38 -0
  980. package/sdks/rust/api-full/rust/src/models/mod.rs +100 -0
  981. package/sdks/rust/api-full/rust/src/models/namespace.rs +36 -0
  982. package/sdks/rust/api-full/rust/src/models/namespace_list_response.rs +30 -0
  983. package/sdks/rust/api-full/rust/src/models/namespaces_create_request.rs +30 -0
  984. package/sdks/rust/api-full/rust/src/models/namespaces_create_response.rs +27 -0
  985. package/sdks/rust/api-full/rust/src/models/pagination.rs +27 -0
  986. package/sdks/rust/api-full/rust/src/models/runner.rs +69 -0
  987. package/sdks/rust/api-full/rust/src/models/runner_config.rs +33 -0
  988. package/sdks/rust/api-full/rust/src/models/runner_config_kind.rs +26 -0
  989. package/sdks/rust/api-full/rust/src/models/runner_config_kind_one_of.rs +27 -0
  990. package/sdks/rust/api-full/rust/src/models/runner_config_kind_one_of_1.rs +27 -0
  991. package/sdks/rust/api-full/rust/src/models/runner_config_kind_one_of_1_serverless.rs +46 -0
  992. package/sdks/rust/api-full/rust/src/models/runner_config_variant.rs +38 -0
  993. package/sdks/rust/api-full/rust/src/models/runner_configs_list_response.rs +30 -0
  994. package/sdks/rust/api-full/rust/src/models/runner_configs_list_response_runner_configs_value.rs +27 -0
  995. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_request.rs +30 -0
  996. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response.rs +26 -0
  997. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response_one_of.rs +27 -0
  998. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response_one_of_1.rs +27 -0
  999. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response_one_of_1_failure.rs +27 -0
  1000. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response_one_of_success.rs +27 -0
  1001. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error.rs +30 -0
  1002. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of.rs +27 -0
  1003. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_1.rs +27 -0
  1004. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_2.rs +27 -0
  1005. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_3.rs +27 -0
  1006. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_3_non_success_status.rs +30 -0
  1007. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_4.rs +27 -0
  1008. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_4_invalid_response_json.rs +27 -0
  1009. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_5.rs +27 -0
  1010. package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_5_invalid_response_schema.rs +30 -0
  1011. package/sdks/rust/api-full/rust/src/models/runner_configs_upsert_request_body.rs +27 -0
  1012. package/sdks/rust/api-full/rust/src/models/runner_configs_upsert_response.rs +27 -0
  1013. package/sdks/rust/api-full/rust/src/models/runners_list_names_response.rs +30 -0
  1014. package/sdks/rust/api-full/rust/src/models/runners_list_response.rs +30 -0
  1015. package/sdks/rust/api-full/src/apis/actors_api.rs +67 -0
  1016. package/sdks/rust/api-full/src/apis/configuration.rs +48 -0
  1017. package/sdks/rust/api-full/src/apis/mod.rs +119 -0
  1018. package/sdks/rust/api-full/src/apis/ns_api.rs +67 -0
  1019. package/sdks/rust/api-full/src/lib.rs +11 -0
  1020. package/sdks/rust/api-full/src/models/actor.rs +72 -0
  1021. package/sdks/rust/api-full/src/models/actor_lifecycle.rs +29 -0
  1022. package/sdks/rust/api-full/src/models/actors_create_request.rs +36 -0
  1023. package/sdks/rust/api-full/src/models/actors_create_response.rs +26 -0
  1024. package/sdks/rust/api-full/src/models/mod.rs +14 -0
  1025. package/sdks/rust/api-full/src/models/namespace.rs +40 -0
  1026. package/sdks/rust/api-full/src/models/namespaces_create_request.rs +26 -0
  1027. package/sdks/rust/api-full/src/models/namespaces_create_response.rs +26 -0
  1028. package/sdks/rust/data/Cargo.toml +18 -0
  1029. package/sdks/rust/data/build.rs +15 -0
  1030. package/sdks/rust/data/src/converted.rs +137 -0
  1031. package/sdks/rust/data/src/generated.rs +1 -0
  1032. package/sdks/rust/data/src/lib.rs +11 -0
  1033. package/sdks/rust/data/src/versioned/mod.rs +178 -0
  1034. package/sdks/rust/data/src/versioned/namespace_runner_config.rs +125 -0
  1035. package/sdks/rust/epoxy-protocol/Cargo.toml +17 -0
  1036. package/sdks/rust/epoxy-protocol/build.rs +18 -0
  1037. package/sdks/rust/epoxy-protocol/src/generated.rs +1 -0
  1038. package/sdks/rust/epoxy-protocol/src/lib.rs +7 -0
  1039. package/sdks/rust/epoxy-protocol/src/versioned.rs +206 -0
  1040. package/sdks/rust/runner-protocol/Cargo.toml +23 -0
  1041. package/sdks/rust/runner-protocol/build.rs +115 -0
  1042. package/sdks/rust/runner-protocol/src/compat.rs +7 -0
  1043. package/sdks/rust/runner-protocol/src/generated.rs +1 -0
  1044. package/sdks/rust/runner-protocol/src/lib.rs +10 -0
  1045. package/sdks/rust/runner-protocol/src/util.rs +14 -0
  1046. package/sdks/rust/runner-protocol/src/uuid_compat.rs +209 -0
  1047. package/sdks/rust/runner-protocol/src/versioned.rs +1734 -0
  1048. package/sdks/rust/ups-protocol/Cargo.toml +17 -0
  1049. package/sdks/rust/ups-protocol/build.rs +18 -0
  1050. package/sdks/rust/ups-protocol/src/generated.rs +1 -0
  1051. package/sdks/rust/ups-protocol/src/lib.rs +7 -0
  1052. package/sdks/rust/ups-protocol/src/versioned.rs +48 -0
  1053. package/sdks/schemas/README.md +6 -0
  1054. package/sdks/schemas/data/namespace.runner_config.v1.bare +13 -0
  1055. package/sdks/schemas/data/namespace.runner_config.v2.bare +23 -0
  1056. package/sdks/schemas/data/pegboard.namespace.actor_by_key.v1.bare +6 -0
  1057. package/sdks/schemas/data/pegboard.namespace.actor_name.v1.bare +5 -0
  1058. package/sdks/schemas/data/pegboard.namespace.runner_alloc_idx.v1.bare +7 -0
  1059. package/sdks/schemas/data/pegboard.namespace.runner_by_key.v1.bare +6 -0
  1060. package/sdks/schemas/data/pegboard.runner.metadata.v1.bare +5 -0
  1061. package/sdks/schemas/epoxy-protocol/v1.bare +260 -0
  1062. package/sdks/schemas/runner-protocol/v1.bare +393 -0
  1063. package/sdks/schemas/runner-protocol/v2.bare +403 -0
  1064. package/sdks/schemas/runner-protocol/v3.bare +436 -0
  1065. package/sdks/schemas/ups-protocol/v1.bare +23 -0
  1066. package/sdks/typescript/api-full/.turbo/turbo-build.log +42 -0
  1067. package/sdks/typescript/api-full/build.js +69 -0
  1068. package/sdks/typescript/api-full/package.json +59 -0
  1069. package/sdks/typescript/api-full/rivetkit-engine-api-full-25.5.3.tgz +0 -0
  1070. package/sdks/typescript/api-full/src/Client.ts +984 -0
  1071. package/sdks/typescript/api-full/src/api/client/index.ts +1 -0
  1072. package/sdks/typescript/api-full/src/api/client/requests/ActorsCreateRequest.ts +24 -0
  1073. package/sdks/typescript/api-full/src/api/client/requests/ActorsDeleteRequest.ts +11 -0
  1074. package/sdks/typescript/api-full/src/api/client/requests/ActorsGetOrCreateRequest.ts +25 -0
  1075. package/sdks/typescript/api-full/src/api/client/requests/ActorsListNamesRequest.ts +15 -0
  1076. package/sdks/typescript/api-full/src/api/client/requests/ActorsListRequest.ts +19 -0
  1077. package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsDeleteRequest.ts +13 -0
  1078. package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsListRequest.ts +19 -0
  1079. package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsRefreshMetadataRequest.ts +19 -0
  1080. package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsServerlessHealthCheckRequest.ts +16 -0
  1081. package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsUpsertRequestBody.ts +19 -0
  1082. package/sdks/typescript/api-full/src/api/client/requests/index.ts +10 -0
  1083. package/sdks/typescript/api-full/src/api/index.ts +3 -0
  1084. package/sdks/typescript/api-full/src/api/resources/datacenters/client/Client.ts +97 -0
  1085. package/sdks/typescript/api-full/src/api/resources/datacenters/client/index.ts +1 -0
  1086. package/sdks/typescript/api-full/src/api/resources/datacenters/index.ts +1 -0
  1087. package/sdks/typescript/api-full/src/api/resources/health/client/Client.ts +97 -0
  1088. package/sdks/typescript/api-full/src/api/resources/health/client/index.ts +1 -0
  1089. package/sdks/typescript/api-full/src/api/resources/health/index.ts +1 -0
  1090. package/sdks/typescript/api-full/src/api/resources/index.ts +6 -0
  1091. package/sdks/typescript/api-full/src/api/resources/namespaces/client/Client.ts +187 -0
  1092. package/sdks/typescript/api-full/src/api/resources/namespaces/client/index.ts +1 -0
  1093. package/sdks/typescript/api-full/src/api/resources/namespaces/client/requests/NamespacesCreateRequest.ts +15 -0
  1094. package/sdks/typescript/api-full/src/api/resources/namespaces/client/requests/NamespacesListRequest.ts +14 -0
  1095. package/sdks/typescript/api-full/src/api/resources/namespaces/client/requests/index.ts +2 -0
  1096. package/sdks/typescript/api-full/src/api/resources/namespaces/index.ts +1 -0
  1097. package/sdks/typescript/api-full/src/api/resources/runners/client/Client.ts +209 -0
  1098. package/sdks/typescript/api-full/src/api/resources/runners/client/index.ts +1 -0
  1099. package/sdks/typescript/api-full/src/api/resources/runners/client/requests/RunnersListNamesRequest.ts +15 -0
  1100. package/sdks/typescript/api-full/src/api/resources/runners/client/requests/RunnersListRequest.ts +18 -0
  1101. package/sdks/typescript/api-full/src/api/resources/runners/client/requests/index.ts +2 -0
  1102. package/sdks/typescript/api-full/src/api/resources/runners/index.ts +1 -0
  1103. package/sdks/typescript/api-full/src/api/types/Actor.ts +32 -0
  1104. package/sdks/typescript/api-full/src/api/types/ActorName.ts +7 -0
  1105. package/sdks/typescript/api-full/src/api/types/ActorsCreateResponse.ts +9 -0
  1106. package/sdks/typescript/api-full/src/api/types/ActorsDeleteResponse.ts +5 -0
  1107. package/sdks/typescript/api-full/src/api/types/ActorsGetOrCreateResponse.ts +10 -0
  1108. package/sdks/typescript/api-full/src/api/types/ActorsKvGetResponse.ts +8 -0
  1109. package/sdks/typescript/api-full/src/api/types/ActorsListNamesResponse.ts +10 -0
  1110. package/sdks/typescript/api-full/src/api/types/ActorsListResponse.ts +10 -0
  1111. package/sdks/typescript/api-full/src/api/types/CrashPolicy.ts +10 -0
  1112. package/sdks/typescript/api-full/src/api/types/Datacenter.ts +9 -0
  1113. package/sdks/typescript/api-full/src/api/types/DatacenterHealth.ts +14 -0
  1114. package/sdks/typescript/api-full/src/api/types/DatacentersListResponse.ts +10 -0
  1115. package/sdks/typescript/api-full/src/api/types/HealthFanoutResponse.ts +9 -0
  1116. package/sdks/typescript/api-full/src/api/types/HealthResponse.ts +9 -0
  1117. package/sdks/typescript/api-full/src/api/types/HealthStatus.ts +9 -0
  1118. package/sdks/typescript/api-full/src/api/types/Namespace.ts +12 -0
  1119. package/sdks/typescript/api-full/src/api/types/NamespaceListResponse.ts +10 -0
  1120. package/sdks/typescript/api-full/src/api/types/NamespacesCreateResponse.ts +9 -0
  1121. package/sdks/typescript/api-full/src/api/types/Pagination.ts +7 -0
  1122. package/sdks/typescript/api-full/src/api/types/RivetId.ts +5 -0
  1123. package/sdks/typescript/api-full/src/api/types/Runner.ts +23 -0
  1124. package/sdks/typescript/api-full/src/api/types/RunnerConfig.ts +11 -0
  1125. package/sdks/typescript/api-full/src/api/types/RunnerConfigKind.ts +7 -0
  1126. package/sdks/typescript/api-full/src/api/types/RunnerConfigKindNormal.ts +7 -0
  1127. package/sdks/typescript/api-full/src/api/types/RunnerConfigKindServerless.ts +9 -0
  1128. package/sdks/typescript/api-full/src/api/types/RunnerConfigKindServerlessServerless.ts +14 -0
  1129. package/sdks/typescript/api-full/src/api/types/RunnerConfigServerless.ts +14 -0
  1130. package/sdks/typescript/api-full/src/api/types/RunnerConfigVariant.ts +9 -0
  1131. package/sdks/typescript/api-full/src/api/types/RunnerConfigsDeleteResponse.ts +5 -0
  1132. package/sdks/typescript/api-full/src/api/types/RunnerConfigsListResponse.ts +10 -0
  1133. package/sdks/typescript/api-full/src/api/types/RunnerConfigsListResponseRunnerConfigsValue.ts +9 -0
  1134. package/sdks/typescript/api-full/src/api/types/RunnerConfigsRefreshMetadataRequestBody.ts +5 -0
  1135. package/sdks/typescript/api-full/src/api/types/RunnerConfigsRefreshMetadataResponse.ts +5 -0
  1136. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponse.ts +9 -0
  1137. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponseFailure.ts +9 -0
  1138. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponseFailureFailure.ts +9 -0
  1139. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponseSuccess.ts +9 -0
  1140. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponseSuccessSuccess.ts +7 -0
  1141. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataError.ts +13 -0
  1142. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidRequest.ts +7 -0
  1143. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJson.ts +9 -0
  1144. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJsonInvalidResponseJson.ts +7 -0
  1145. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchema.ts +9 -0
  1146. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchemaInvalidResponseSchema.ts +8 -0
  1147. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatus.ts +9 -0
  1148. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatusNonSuccessStatus.ts +8 -0
  1149. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorRequestFailed.ts +7 -0
  1150. package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorRequestTimedOut.ts +7 -0
  1151. package/sdks/typescript/api-full/src/api/types/RunnerConfigsUpsertResponse.ts +7 -0
  1152. package/sdks/typescript/api-full/src/api/types/RunnersListNamesResponse.ts +10 -0
  1153. package/sdks/typescript/api-full/src/api/types/RunnersListResponse.ts +10 -0
  1154. package/sdks/typescript/api-full/src/api/types/index.ts +51 -0
  1155. package/sdks/typescript/api-full/src/core/auth/BasicAuth.ts +31 -0
  1156. package/sdks/typescript/api-full/src/core/auth/BearerToken.ts +15 -0
  1157. package/sdks/typescript/api-full/src/core/auth/index.ts +2 -0
  1158. package/sdks/typescript/api-full/src/core/fetcher/APIResponse.ts +12 -0
  1159. package/sdks/typescript/api-full/src/core/fetcher/Fetcher.ts +144 -0
  1160. package/sdks/typescript/api-full/src/core/fetcher/Supplier.ts +11 -0
  1161. package/sdks/typescript/api-full/src/core/fetcher/createRequestUrl.ts +10 -0
  1162. package/sdks/typescript/api-full/src/core/fetcher/getFetchFn.ts +25 -0
  1163. package/sdks/typescript/api-full/src/core/fetcher/getHeader.ts +8 -0
  1164. package/sdks/typescript/api-full/src/core/fetcher/getRequestBody.ts +16 -0
  1165. package/sdks/typescript/api-full/src/core/fetcher/getResponseBody.ts +34 -0
  1166. package/sdks/typescript/api-full/src/core/fetcher/index.ts +5 -0
  1167. package/sdks/typescript/api-full/src/core/fetcher/makeRequest.ts +44 -0
  1168. package/sdks/typescript/api-full/src/core/fetcher/requestWithRetries.ts +33 -0
  1169. package/sdks/typescript/api-full/src/core/fetcher/signals.ts +38 -0
  1170. package/sdks/typescript/api-full/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +257 -0
  1171. package/sdks/typescript/api-full/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +107 -0
  1172. package/sdks/typescript/api-full/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +243 -0
  1173. package/sdks/typescript/api-full/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +34 -0
  1174. package/sdks/typescript/api-full/src/core/index.ts +4 -0
  1175. package/sdks/typescript/api-full/src/core/json.ts +27 -0
  1176. package/sdks/typescript/api-full/src/core/runtime/index.ts +1 -0
  1177. package/sdks/typescript/api-full/src/core/runtime/runtime.ts +131 -0
  1178. package/sdks/typescript/api-full/src/core/schemas/Schema.ts +101 -0
  1179. package/sdks/typescript/api-full/src/core/schemas/builders/bigint/bigint.ts +55 -0
  1180. package/sdks/typescript/api-full/src/core/schemas/builders/bigint/index.ts +1 -0
  1181. package/sdks/typescript/api-full/src/core/schemas/builders/date/date.ts +65 -0
  1182. package/sdks/typescript/api-full/src/core/schemas/builders/date/index.ts +1 -0
  1183. package/sdks/typescript/api-full/src/core/schemas/builders/enum/enum.ts +43 -0
  1184. package/sdks/typescript/api-full/src/core/schemas/builders/enum/index.ts +1 -0
  1185. package/sdks/typescript/api-full/src/core/schemas/builders/index.ts +14 -0
  1186. package/sdks/typescript/api-full/src/core/schemas/builders/lazy/index.ts +3 -0
  1187. package/sdks/typescript/api-full/src/core/schemas/builders/lazy/lazy.ts +32 -0
  1188. package/sdks/typescript/api-full/src/core/schemas/builders/lazy/lazyObject.ts +20 -0
  1189. package/sdks/typescript/api-full/src/core/schemas/builders/list/index.ts +1 -0
  1190. package/sdks/typescript/api-full/src/core/schemas/builders/list/list.ts +73 -0
  1191. package/sdks/typescript/api-full/src/core/schemas/builders/literals/booleanLiteral.ts +29 -0
  1192. package/sdks/typescript/api-full/src/core/schemas/builders/literals/index.ts +2 -0
  1193. package/sdks/typescript/api-full/src/core/schemas/builders/literals/stringLiteral.ts +29 -0
  1194. package/sdks/typescript/api-full/src/core/schemas/builders/object/index.ts +22 -0
  1195. package/sdks/typescript/api-full/src/core/schemas/builders/object/object.ts +366 -0
  1196. package/sdks/typescript/api-full/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts +18 -0
  1197. package/sdks/typescript/api-full/src/core/schemas/builders/object/property.ts +23 -0
  1198. package/sdks/typescript/api-full/src/core/schemas/builders/object/types.ts +58 -0
  1199. package/sdks/typescript/api-full/src/core/schemas/builders/object-like/getObjectLikeUtils.ts +79 -0
  1200. package/sdks/typescript/api-full/src/core/schemas/builders/object-like/index.ts +2 -0
  1201. package/sdks/typescript/api-full/src/core/schemas/builders/object-like/types.ts +11 -0
  1202. package/sdks/typescript/api-full/src/core/schemas/builders/primitives/any.ts +4 -0
  1203. package/sdks/typescript/api-full/src/core/schemas/builders/primitives/boolean.ts +25 -0
  1204. package/sdks/typescript/api-full/src/core/schemas/builders/primitives/index.ts +5 -0
  1205. package/sdks/typescript/api-full/src/core/schemas/builders/primitives/number.ts +25 -0
  1206. package/sdks/typescript/api-full/src/core/schemas/builders/primitives/string.ts +25 -0
  1207. package/sdks/typescript/api-full/src/core/schemas/builders/primitives/unknown.ts +4 -0
  1208. package/sdks/typescript/api-full/src/core/schemas/builders/record/index.ts +2 -0
  1209. package/sdks/typescript/api-full/src/core/schemas/builders/record/record.ts +129 -0
  1210. package/sdks/typescript/api-full/src/core/schemas/builders/record/types.ts +17 -0
  1211. package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/JsonError.ts +9 -0
  1212. package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/ParseError.ts +9 -0
  1213. package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/getSchemaUtils.ts +181 -0
  1214. package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/index.ts +4 -0
  1215. package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts +8 -0
  1216. package/sdks/typescript/api-full/src/core/schemas/builders/set/index.ts +1 -0
  1217. package/sdks/typescript/api-full/src/core/schemas/builders/set/set.ts +43 -0
  1218. package/sdks/typescript/api-full/src/core/schemas/builders/undiscriminated-union/index.ts +6 -0
  1219. package/sdks/typescript/api-full/src/core/schemas/builders/undiscriminated-union/types.ts +10 -0
  1220. package/sdks/typescript/api-full/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +60 -0
  1221. package/sdks/typescript/api-full/src/core/schemas/builders/union/discriminant.ts +14 -0
  1222. package/sdks/typescript/api-full/src/core/schemas/builders/union/index.ts +10 -0
  1223. package/sdks/typescript/api-full/src/core/schemas/builders/union/types.ts +26 -0
  1224. package/sdks/typescript/api-full/src/core/schemas/builders/union/union.ts +170 -0
  1225. package/sdks/typescript/api-full/src/core/schemas/index.ts +2 -0
  1226. package/sdks/typescript/api-full/src/core/schemas/utils/MaybePromise.ts +1 -0
  1227. package/sdks/typescript/api-full/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts +9 -0
  1228. package/sdks/typescript/api-full/src/core/schemas/utils/createIdentitySchemaCreator.ts +21 -0
  1229. package/sdks/typescript/api-full/src/core/schemas/utils/entries.ts +3 -0
  1230. package/sdks/typescript/api-full/src/core/schemas/utils/filterObject.ts +13 -0
  1231. package/sdks/typescript/api-full/src/core/schemas/utils/getErrorMessageForIncorrectType.ts +25 -0
  1232. package/sdks/typescript/api-full/src/core/schemas/utils/isPlainObject.ts +17 -0
  1233. package/sdks/typescript/api-full/src/core/schemas/utils/keys.ts +3 -0
  1234. package/sdks/typescript/api-full/src/core/schemas/utils/maybeSkipValidation.ts +38 -0
  1235. package/sdks/typescript/api-full/src/core/schemas/utils/partition.ts +12 -0
  1236. package/sdks/typescript/api-full/src/errors/RivetError.ts +47 -0
  1237. package/sdks/typescript/api-full/src/errors/RivetTimeoutError.ts +10 -0
  1238. package/sdks/typescript/api-full/src/errors/index.ts +2 -0
  1239. package/sdks/typescript/api-full/src/index.ts +4 -0
  1240. package/sdks/typescript/api-full/src/serialization/client/index.ts +1 -0
  1241. package/sdks/typescript/api-full/src/serialization/client/requests/ActorsCreateRequest.ts +31 -0
  1242. package/sdks/typescript/api-full/src/serialization/client/requests/ActorsGetOrCreateRequest.ts +31 -0
  1243. package/sdks/typescript/api-full/src/serialization/client/requests/RunnerConfigsServerlessHealthCheckRequest.ts +22 -0
  1244. package/sdks/typescript/api-full/src/serialization/client/requests/RunnerConfigsUpsertRequestBody.ts +21 -0
  1245. package/sdks/typescript/api-full/src/serialization/client/requests/index.ts +4 -0
  1246. package/sdks/typescript/api-full/src/serialization/index.ts +3 -0
  1247. package/sdks/typescript/api-full/src/serialization/resources/index.ts +2 -0
  1248. package/sdks/typescript/api-full/src/serialization/resources/namespaces/client/index.ts +1 -0
  1249. package/sdks/typescript/api-full/src/serialization/resources/namespaces/client/requests/NamespacesCreateRequest.ts +22 -0
  1250. package/sdks/typescript/api-full/src/serialization/resources/namespaces/client/requests/index.ts +1 -0
  1251. package/sdks/typescript/api-full/src/serialization/resources/namespaces/index.ts +1 -0
  1252. package/sdks/typescript/api-full/src/serialization/types/Actor.ts +45 -0
  1253. package/sdks/typescript/api-full/src/serialization/types/ActorName.ts +18 -0
  1254. package/sdks/typescript/api-full/src/serialization/types/ActorsCreateResponse.ts +21 -0
  1255. package/sdks/typescript/api-full/src/serialization/types/ActorsDeleteResponse.ts +16 -0
  1256. package/sdks/typescript/api-full/src/serialization/types/ActorsGetOrCreateResponse.ts +23 -0
  1257. package/sdks/typescript/api-full/src/serialization/types/ActorsKvGetResponse.ts +22 -0
  1258. package/sdks/typescript/api-full/src/serialization/types/ActorsListNamesResponse.ts +24 -0
  1259. package/sdks/typescript/api-full/src/serialization/types/ActorsListResponse.ts +24 -0
  1260. package/sdks/typescript/api-full/src/serialization/types/CrashPolicy.ts +14 -0
  1261. package/sdks/typescript/api-full/src/serialization/types/Datacenter.ts +22 -0
  1262. package/sdks/typescript/api-full/src/serialization/types/DatacenterHealth.ts +32 -0
  1263. package/sdks/typescript/api-full/src/serialization/types/DatacentersListResponse.ts +24 -0
  1264. package/sdks/typescript/api-full/src/serialization/types/HealthFanoutResponse.ts +21 -0
  1265. package/sdks/typescript/api-full/src/serialization/types/HealthResponse.ts +22 -0
  1266. package/sdks/typescript/api-full/src/serialization/types/HealthStatus.ts +14 -0
  1267. package/sdks/typescript/api-full/src/serialization/types/Namespace.ts +25 -0
  1268. package/sdks/typescript/api-full/src/serialization/types/NamespaceListResponse.ts +24 -0
  1269. package/sdks/typescript/api-full/src/serialization/types/NamespacesCreateResponse.ts +21 -0
  1270. package/sdks/typescript/api-full/src/serialization/types/Pagination.ts +18 -0
  1271. package/sdks/typescript/api-full/src/serialization/types/RivetId.ts +13 -0
  1272. package/sdks/typescript/api-full/src/serialization/types/Runner.ts +46 -0
  1273. package/sdks/typescript/api-full/src/serialization/types/RunnerConfig.ts +23 -0
  1274. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigKind.ts +16 -0
  1275. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigKindNormal.ts +20 -0
  1276. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigKindServerless.ts +21 -0
  1277. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigKindServerlessServerless.ts +32 -0
  1278. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigServerless.ts +32 -0
  1279. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigVariant.ts +16 -0
  1280. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsDeleteResponse.ts +16 -0
  1281. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsListResponse.ts +27 -0
  1282. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsListResponseRunnerConfigsValue.ts +21 -0
  1283. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsRefreshMetadataRequestBody.ts +16 -0
  1284. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsRefreshMetadataResponse.ts +16 -0
  1285. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponse.ts +23 -0
  1286. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponseFailure.ts +21 -0
  1287. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponseFailureFailure.ts +21 -0
  1288. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponseSuccess.ts +21 -0
  1289. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponseSuccessSuccess.ts +20 -0
  1290. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataError.ts +35 -0
  1291. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidRequest.ts +23 -0
  1292. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJson.ts +24 -0
  1293. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJsonInvalidResponseJson.ts +20 -0
  1294. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchema.ts +24 -0
  1295. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchemaInvalidResponseSchema.ts +22 -0
  1296. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatus.ts +24 -0
  1297. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatusNonSuccessStatus.ts +22 -0
  1298. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorRequestFailed.ts +23 -0
  1299. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorRequestTimedOut.ts +23 -0
  1300. package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsUpsertResponse.ts +20 -0
  1301. package/sdks/typescript/api-full/src/serialization/types/RunnersListNamesResponse.ts +23 -0
  1302. package/sdks/typescript/api-full/src/serialization/types/RunnersListResponse.ts +24 -0
  1303. package/sdks/typescript/api-full/src/serialization/types/index.ts +51 -0
  1304. package/sdks/typescript/api-full/tsconfig.json +24 -0
  1305. package/sdks/typescript/runner/.turbo/turbo-build.log +22 -0
  1306. package/sdks/typescript/runner/benches/actor-lifecycle.bench.ts +190 -0
  1307. package/sdks/typescript/runner/benches/utils.ts +143 -0
  1308. package/sdks/typescript/runner/dist/mod.cjs +2951 -0
  1309. package/sdks/typescript/runner/dist/mod.cjs.map +1 -0
  1310. package/sdks/typescript/runner/dist/mod.d.cts +326 -0
  1311. package/sdks/typescript/runner/dist/mod.d.ts +326 -0
  1312. package/sdks/typescript/runner/dist/mod.js +2951 -0
  1313. package/sdks/typescript/runner/dist/mod.js.map +1 -0
  1314. package/sdks/typescript/runner/node_modules/.bin/pino +21 -0
  1315. package/sdks/typescript/runner/node_modules/.bin/tsc +21 -0
  1316. package/sdks/typescript/runner/node_modules/.bin/tsserver +21 -0
  1317. package/sdks/typescript/runner/node_modules/.bin/tsup +21 -0
  1318. package/sdks/typescript/runner/node_modules/.bin/tsup-node +21 -0
  1319. package/sdks/typescript/runner/node_modules/.bin/tsx +21 -0
  1320. package/sdks/typescript/runner/node_modules/.bin/uuid +21 -0
  1321. package/sdks/typescript/runner/node_modules/.bin/vitest +21 -0
  1322. package/sdks/typescript/runner/package.json +37 -0
  1323. package/sdks/typescript/runner/src/actor.ts +196 -0
  1324. package/sdks/typescript/runner/src/log.ts +11 -0
  1325. package/sdks/typescript/runner/src/mod.ts +1755 -0
  1326. package/sdks/typescript/runner/src/stringify.ts +354 -0
  1327. package/sdks/typescript/runner/src/tunnel.ts +1178 -0
  1328. package/sdks/typescript/runner/src/utils.ts +159 -0
  1329. package/sdks/typescript/runner/src/websocket-tunnel-adapter.ts +567 -0
  1330. package/sdks/typescript/runner/src/websocket.ts +43 -0
  1331. package/sdks/typescript/runner/tests/lifecycle.test.ts +596 -0
  1332. package/sdks/typescript/runner/tests/utils.test.ts +194 -0
  1333. package/sdks/typescript/runner/tsconfig.json +11 -0
  1334. package/sdks/typescript/runner/tsup.config.ts +4 -0
  1335. package/sdks/typescript/runner/turbo.json +4 -0
  1336. package/sdks/typescript/runner/vitest.config.ts +16 -0
  1337. package/sdks/typescript/runner-protocol/.turbo/turbo-build.log +22 -0
  1338. package/sdks/typescript/runner-protocol/dist/index.cjs +1632 -0
  1339. package/sdks/typescript/runner-protocol/dist/index.cjs.map +1 -0
  1340. package/sdks/typescript/runner-protocol/dist/index.d.cts +666 -0
  1341. package/sdks/typescript/runner-protocol/dist/index.d.ts +666 -0
  1342. package/sdks/typescript/runner-protocol/dist/index.js +1632 -0
  1343. package/sdks/typescript/runner-protocol/dist/index.js.map +1 -0
  1344. package/sdks/typescript/runner-protocol/node_modules/.bin/tsc +21 -0
  1345. package/sdks/typescript/runner-protocol/node_modules/.bin/tsserver +21 -0
  1346. package/sdks/typescript/runner-protocol/node_modules/.bin/tsup +21 -0
  1347. package/sdks/typescript/runner-protocol/node_modules/.bin/tsup-node +21 -0
  1348. package/sdks/typescript/runner-protocol/package.json +34 -0
  1349. package/sdks/typescript/runner-protocol/src/index.ts +2121 -0
  1350. package/sdks/typescript/runner-protocol/tsconfig.json +17 -0
  1351. package/sdks/typescript/runner-protocol/tsup.config.ts +4 -0
  1352. package/sdks/typescript/runner-protocol/turbo.json +4 -0
  1353. package/sdks/typescript/test-runner/.turbo/turbo-build.log +17 -0
  1354. package/sdks/typescript/test-runner/Dockerfile +26 -0
  1355. package/sdks/typescript/test-runner/dist/index.d.ts +6 -0
  1356. package/sdks/typescript/test-runner/dist/index.js +345 -0
  1357. package/sdks/typescript/test-runner/dist/index.js.map +1 -0
  1358. package/sdks/typescript/test-runner/node_modules/.bin/pino +21 -0
  1359. package/sdks/typescript/test-runner/node_modules/.bin/tsc +21 -0
  1360. package/sdks/typescript/test-runner/node_modules/.bin/tsserver +21 -0
  1361. package/sdks/typescript/test-runner/node_modules/.bin/tsup +21 -0
  1362. package/sdks/typescript/test-runner/node_modules/.bin/tsup-node +21 -0
  1363. package/sdks/typescript/test-runner/node_modules/.bin/tsx +21 -0
  1364. package/sdks/typescript/test-runner/node_modules/.bin/vitest +21 -0
  1365. package/sdks/typescript/test-runner/package.json +27 -0
  1366. package/sdks/typescript/test-runner/src/index.ts +287 -0
  1367. package/sdks/typescript/test-runner/src/log.ts +194 -0
  1368. package/sdks/typescript/test-runner/tsconfig.json +11 -0
  1369. package/sdks/typescript/test-runner/tsup.config.ts +7 -0
  1370. package/sdks/typescript/test-runner/turbo.json +4 -0
  1371. package/sdks/typescript/test-runner/vitest.config.ts +16 -0
  1372. package/tests/load/README.md +28 -0
  1373. package/tests/load/actor-lifecycle/README.md +26 -0
  1374. package/tests/load/actor-lifecycle/actor.ts +41 -0
  1375. package/tests/load/actor-lifecycle/config.ts +14 -0
  1376. package/tests/load/actor-lifecycle/index.ts +62 -0
  1377. package/tests/load/actor-lifecycle/rivet_api.ts +140 -0
  1378. package/tests/load/actor-lifecycle/types.ts +17 -0
  1379. package/tests/load/node_modules/.bin/biome +21 -0
  1380. package/tests/load/node_modules/.bin/tsc +21 -0
  1381. package/tests/load/node_modules/.bin/tsserver +21 -0
  1382. package/tests/load/package.json +15 -0
  1383. package/tests/load/tsconfig.json +20 -0
  1384. package/tests/smoke/README.md +32 -0
  1385. package/tests/smoke/package.json +19 -0
  1386. package/tests/smoke/scripts/connect.ts +41 -0
  1387. package/tests/smoke/src/server/registry.ts +32 -0
  1388. package/tests/smoke/src/server/server.ts +7 -0
  1389. package/tests/smoke/src/smoke-test/index.ts +161 -0
  1390. package/tests/smoke/src/smoke-test/spawn-actor.ts +109 -0
  1391. package/tests/smoke/tsconfig.json +43 -0
  1392. package/tests/smoke/turbo.json +4 -0
@@ -0,0 +1,1780 @@
1
+ use std::result::Result::Ok;
2
+
3
+ use anyhow::*;
4
+ use rivet_util::Id;
5
+ use universaldb::prelude::*;
6
+
7
+ use crate::history::{
8
+ event::{EventType, SleepState},
9
+ location::{Coordinate, Location},
10
+ };
11
+
12
+ // Parses workflow id and location, ignores the rest
13
+ #[derive(Debug)]
14
+ pub struct PartialEventKey {
15
+ #[allow(dead_code)]
16
+ workflow_id: Id,
17
+ pub location: Location,
18
+ pub forgotten: bool,
19
+ }
20
+
21
+ impl<'de> TupleUnpack<'de> for PartialEventKey {
22
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
23
+ let (mut input, (_, _, workflow_id, data, history_variant)) =
24
+ <(usize, usize, Id, usize, usize)>::unpack(input, tuple_depth)?;
25
+ if data != HISTORY {
26
+ return Err(PackError::Message("expected HISTORY data".into()));
27
+ }
28
+
29
+ let mut coords = Vec::new();
30
+
31
+ loop {
32
+ let Ok((input2, coord)) = Coordinate::unpack(input, tuple_depth) else {
33
+ break;
34
+ };
35
+
36
+ coords.push(coord);
37
+ input = input2;
38
+ }
39
+
40
+ Ok((
41
+ // Ignore rest
42
+ &input[0..0],
43
+ PartialEventKey {
44
+ workflow_id,
45
+ location: Location::from_iter(coords),
46
+ forgotten: history_variant == FORGOTTEN,
47
+ },
48
+ ))
49
+ }
50
+ }
51
+
52
+ #[derive(Debug, Clone, Copy)]
53
+ pub enum HistorySubspaceVariant {
54
+ All,
55
+ Active,
56
+ Forgotten,
57
+ }
58
+
59
+ #[derive(Debug, Clone, Copy)]
60
+ pub struct HistorySubspaceKey {
61
+ workflow_id: Id,
62
+ variant: HistorySubspaceVariant,
63
+ }
64
+
65
+ impl HistorySubspaceKey {
66
+ pub fn new(workflow_id: Id, variant: HistorySubspaceVariant) -> Self {
67
+ HistorySubspaceKey {
68
+ workflow_id,
69
+ variant,
70
+ }
71
+ }
72
+ }
73
+
74
+ impl TuplePack for HistorySubspaceKey {
75
+ fn pack<W: std::io::Write>(
76
+ &self,
77
+ w: &mut W,
78
+ tuple_depth: TupleDepth,
79
+ ) -> std::io::Result<VersionstampOffset> {
80
+ let mut offset = VersionstampOffset::None { size: 0 };
81
+
82
+ let t = (WORKFLOW, DATA, self.workflow_id, HISTORY);
83
+ offset += t.pack(w, tuple_depth)?;
84
+
85
+ match self.variant {
86
+ HistorySubspaceVariant::All => {}
87
+ HistorySubspaceVariant::Active => {
88
+ offset += ACTIVE.pack(w, tuple_depth)?;
89
+ }
90
+ HistorySubspaceVariant::Forgotten => {
91
+ offset += FORGOTTEN.pack(w, tuple_depth)?;
92
+ }
93
+ }
94
+
95
+ Ok(offset)
96
+ }
97
+ }
98
+
99
+ #[derive(Debug, Clone)]
100
+ pub struct EventHistorySubspaceKey {
101
+ workflow_id: Id,
102
+ location: Location,
103
+ idx: Option<usize>,
104
+ forgotten: bool,
105
+ }
106
+
107
+ impl EventHistorySubspaceKey {
108
+ pub fn new(workflow_id: Id, location: Location, idx: usize, forgotten: bool) -> Self {
109
+ EventHistorySubspaceKey {
110
+ workflow_id,
111
+ location,
112
+ idx: Some(idx),
113
+ forgotten,
114
+ }
115
+ }
116
+
117
+ pub fn entire(workflow_id: Id, location: Location, forgotten: bool) -> Self {
118
+ EventHistorySubspaceKey {
119
+ workflow_id,
120
+ location,
121
+ idx: None,
122
+ forgotten,
123
+ }
124
+ }
125
+ }
126
+
127
+ impl TuplePack for EventHistorySubspaceKey {
128
+ fn pack<W: std::io::Write>(
129
+ &self,
130
+ w: &mut W,
131
+ tuple_depth: TupleDepth,
132
+ ) -> std::io::Result<VersionstampOffset> {
133
+ let mut offset = VersionstampOffset::None { size: 0 };
134
+
135
+ let t = (
136
+ WORKFLOW,
137
+ DATA,
138
+ self.workflow_id,
139
+ HISTORY,
140
+ if self.forgotten { FORGOTTEN } else { ACTIVE },
141
+ );
142
+ offset += t.pack(w, tuple_depth)?;
143
+
144
+ for coord in &*self.location {
145
+ offset += coord.pack(w, tuple_depth)?;
146
+ }
147
+
148
+ // This ensures we are only reading events under the given location and not event data at the current
149
+ // location
150
+ w.write_all(&[universaldb::utils::codes::NESTED])?;
151
+ offset += 1;
152
+
153
+ if let Some(idx) = self.idx {
154
+ offset += idx.pack(w, tuple_depth)?;
155
+ }
156
+
157
+ Ok(offset)
158
+ }
159
+ }
160
+
161
+ #[derive(Debug)]
162
+ pub struct EventTypeKey {
163
+ workflow_id: Id,
164
+ location: Location,
165
+ forgotten: bool,
166
+ }
167
+
168
+ impl EventTypeKey {
169
+ pub fn new(workflow_id: Id, location: Location) -> Self {
170
+ EventTypeKey {
171
+ workflow_id,
172
+ location,
173
+ forgotten: false,
174
+ }
175
+ }
176
+ }
177
+
178
+ impl FormalKey for EventTypeKey {
179
+ type Value = EventType;
180
+
181
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
182
+ EventType::from_repr(usize::from_be_bytes(raw.try_into()?)).context("invalid EventType")
183
+ }
184
+
185
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
186
+ Ok((value as usize).to_be_bytes().to_vec())
187
+ }
188
+ }
189
+
190
+ impl TuplePack for EventTypeKey {
191
+ fn pack<W: std::io::Write>(
192
+ &self,
193
+ w: &mut W,
194
+ tuple_depth: TupleDepth,
195
+ ) -> std::io::Result<VersionstampOffset> {
196
+ pack_history_key(
197
+ self.workflow_id,
198
+ &self.location,
199
+ w,
200
+ tuple_depth,
201
+ self.forgotten,
202
+ EVENT_TYPE,
203
+ )
204
+ }
205
+ }
206
+
207
+ impl<'de> TupleUnpack<'de> for EventTypeKey {
208
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
209
+ let (input, (workflow_id, location, forgotten)) =
210
+ unpack_history_key(input, tuple_depth, EVENT_TYPE, "EVENT_TYPE")?;
211
+
212
+ Ok((
213
+ input,
214
+ EventTypeKey {
215
+ workflow_id,
216
+ location,
217
+ forgotten,
218
+ },
219
+ ))
220
+ }
221
+ }
222
+
223
+ #[derive(Debug)]
224
+ pub struct VersionKey {
225
+ workflow_id: Id,
226
+ location: Location,
227
+ forgotten: bool,
228
+ }
229
+
230
+ impl VersionKey {
231
+ pub fn new(workflow_id: Id, location: Location) -> Self {
232
+ VersionKey {
233
+ workflow_id,
234
+ location,
235
+ forgotten: false,
236
+ }
237
+ }
238
+ }
239
+
240
+ impl FormalKey for VersionKey {
241
+ type Value = usize;
242
+
243
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
244
+ Ok(usize::from_be_bytes(raw.try_into()?))
245
+ }
246
+
247
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
248
+ Ok(value.to_be_bytes().to_vec())
249
+ }
250
+ }
251
+
252
+ impl TuplePack for VersionKey {
253
+ fn pack<W: std::io::Write>(
254
+ &self,
255
+ w: &mut W,
256
+ tuple_depth: TupleDepth,
257
+ ) -> std::io::Result<VersionstampOffset> {
258
+ pack_history_key(
259
+ self.workflow_id,
260
+ &self.location,
261
+ w,
262
+ tuple_depth,
263
+ self.forgotten,
264
+ VERSION,
265
+ )
266
+ }
267
+ }
268
+
269
+ impl<'de> TupleUnpack<'de> for VersionKey {
270
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
271
+ let (input, (workflow_id, location, forgotten)) =
272
+ unpack_history_key(input, tuple_depth, VERSION, "VERSION")?;
273
+
274
+ Ok((
275
+ input,
276
+ VersionKey {
277
+ workflow_id,
278
+ location,
279
+ forgotten,
280
+ },
281
+ ))
282
+ }
283
+ }
284
+
285
+ #[derive(Debug)]
286
+ pub struct CreateTsKey {
287
+ workflow_id: Id,
288
+ location: Location,
289
+ forgotten: bool,
290
+ }
291
+
292
+ impl CreateTsKey {
293
+ pub fn new(workflow_id: Id, location: Location) -> Self {
294
+ CreateTsKey {
295
+ workflow_id,
296
+ location,
297
+ forgotten: false,
298
+ }
299
+ }
300
+ }
301
+
302
+ impl FormalKey for CreateTsKey {
303
+ /// Timestamp.
304
+ type Value = i64;
305
+
306
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
307
+ Ok(i64::from_be_bytes(raw.try_into()?))
308
+ }
309
+
310
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
311
+ Ok(value.to_be_bytes().to_vec())
312
+ }
313
+ }
314
+
315
+ impl TuplePack for CreateTsKey {
316
+ fn pack<W: std::io::Write>(
317
+ &self,
318
+ w: &mut W,
319
+ tuple_depth: TupleDepth,
320
+ ) -> std::io::Result<VersionstampOffset> {
321
+ pack_history_key(
322
+ self.workflow_id,
323
+ &self.location,
324
+ w,
325
+ tuple_depth,
326
+ self.forgotten,
327
+ CREATE_TS,
328
+ )
329
+ }
330
+ }
331
+
332
+ impl<'de> TupleUnpack<'de> for CreateTsKey {
333
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
334
+ let (input, (workflow_id, location, forgotten)) =
335
+ unpack_history_key(input, tuple_depth, CREATE_TS, "CREATE_TS")?;
336
+
337
+ Ok((
338
+ input,
339
+ CreateTsKey {
340
+ workflow_id,
341
+ location,
342
+ forgotten,
343
+ },
344
+ ))
345
+ }
346
+ }
347
+
348
+ #[derive(Debug)]
349
+ pub struct NameKey {
350
+ workflow_id: Id,
351
+ location: Location,
352
+ forgotten: bool,
353
+ }
354
+
355
+ impl NameKey {
356
+ pub fn new(workflow_id: Id, location: Location) -> Self {
357
+ NameKey {
358
+ workflow_id,
359
+ location,
360
+ forgotten: false,
361
+ }
362
+ }
363
+ }
364
+
365
+ impl FormalKey for NameKey {
366
+ type Value = String;
367
+
368
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
369
+ String::from_utf8(raw.to_vec()).map_err(Into::into)
370
+ }
371
+
372
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
373
+ Ok(value.into_bytes())
374
+ }
375
+ }
376
+
377
+ impl TuplePack for NameKey {
378
+ fn pack<W: std::io::Write>(
379
+ &self,
380
+ w: &mut W,
381
+ tuple_depth: TupleDepth,
382
+ ) -> std::io::Result<VersionstampOffset> {
383
+ pack_history_key(
384
+ self.workflow_id,
385
+ &self.location,
386
+ w,
387
+ tuple_depth,
388
+ self.forgotten,
389
+ NAME,
390
+ )
391
+ }
392
+ }
393
+
394
+ impl<'de> TupleUnpack<'de> for NameKey {
395
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
396
+ let (input, (workflow_id, location, forgotten)) =
397
+ unpack_history_key(input, tuple_depth, NAME, "NAME")?;
398
+
399
+ Ok((
400
+ input,
401
+ NameKey {
402
+ workflow_id,
403
+ location,
404
+ forgotten,
405
+ },
406
+ ))
407
+ }
408
+ }
409
+
410
+ #[derive(Debug)]
411
+ pub struct SignalIdKey {
412
+ workflow_id: Id,
413
+ location: Location,
414
+ forgotten: bool,
415
+ }
416
+
417
+ impl SignalIdKey {
418
+ pub fn new(workflow_id: Id, location: Location) -> Self {
419
+ SignalIdKey {
420
+ workflow_id,
421
+ location,
422
+ forgotten: false,
423
+ }
424
+ }
425
+ }
426
+
427
+ impl FormalKey for SignalIdKey {
428
+ type Value = Id;
429
+
430
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
431
+ Ok(Id::from_slice(raw)?)
432
+ }
433
+
434
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
435
+ Ok(value.as_bytes().to_vec())
436
+ }
437
+ }
438
+
439
+ impl TuplePack for SignalIdKey {
440
+ fn pack<W: std::io::Write>(
441
+ &self,
442
+ w: &mut W,
443
+ tuple_depth: TupleDepth,
444
+ ) -> std::io::Result<VersionstampOffset> {
445
+ pack_history_key(
446
+ self.workflow_id,
447
+ &self.location,
448
+ w,
449
+ tuple_depth,
450
+ self.forgotten,
451
+ SIGNAL_ID,
452
+ )
453
+ }
454
+ }
455
+
456
+ impl<'de> TupleUnpack<'de> for SignalIdKey {
457
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
458
+ let (input, (workflow_id, location, forgotten)) =
459
+ unpack_history_key(input, tuple_depth, SIGNAL_ID, "SIGNAL_ID")?;
460
+
461
+ Ok((
462
+ input,
463
+ SignalIdKey {
464
+ workflow_id,
465
+ location,
466
+ forgotten,
467
+ },
468
+ ))
469
+ }
470
+ }
471
+
472
+ #[derive(Debug)]
473
+ pub struct SubWorkflowIdKey {
474
+ workflow_id: Id,
475
+ location: Location,
476
+ forgotten: bool,
477
+ }
478
+
479
+ impl SubWorkflowIdKey {
480
+ pub fn new(workflow_id: Id, location: Location) -> Self {
481
+ SubWorkflowIdKey {
482
+ workflow_id,
483
+ location,
484
+ forgotten: false,
485
+ }
486
+ }
487
+ }
488
+
489
+ impl FormalKey for SubWorkflowIdKey {
490
+ type Value = Id;
491
+
492
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
493
+ Ok(Id::from_slice(raw)?)
494
+ }
495
+
496
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
497
+ Ok(value.as_bytes().to_vec())
498
+ }
499
+ }
500
+
501
+ impl TuplePack for SubWorkflowIdKey {
502
+ fn pack<W: std::io::Write>(
503
+ &self,
504
+ w: &mut W,
505
+ tuple_depth: TupleDepth,
506
+ ) -> std::io::Result<VersionstampOffset> {
507
+ pack_history_key(
508
+ self.workflow_id,
509
+ &self.location,
510
+ w,
511
+ tuple_depth,
512
+ self.forgotten,
513
+ SUB_WORKFLOW_ID,
514
+ )
515
+ }
516
+ }
517
+
518
+ impl<'de> TupleUnpack<'de> for SubWorkflowIdKey {
519
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
520
+ let (input, (workflow_id, location, forgotten)) =
521
+ unpack_history_key(input, tuple_depth, SUB_WORKFLOW_ID, "SUB_WORKFLOW_ID")?;
522
+
523
+ Ok((
524
+ input,
525
+ SubWorkflowIdKey {
526
+ workflow_id,
527
+ location,
528
+ forgotten,
529
+ },
530
+ ))
531
+ }
532
+ }
533
+
534
+ pub struct InputKey {
535
+ workflow_id: Id,
536
+ location: Location,
537
+ forgotten: bool,
538
+ }
539
+
540
+ impl InputKey {
541
+ pub fn new(workflow_id: Id, location: Location) -> Self {
542
+ InputKey {
543
+ workflow_id,
544
+ location,
545
+ forgotten: false,
546
+ }
547
+ }
548
+
549
+ pub fn split_ref(&self, value: &serde_json::value::RawValue) -> Result<Vec<Vec<u8>>> {
550
+ Ok(value
551
+ .get()
552
+ .as_bytes()
553
+ .chunks(universaldb::utils::CHUNK_SIZE)
554
+ .map(|x| x.to_vec())
555
+ .collect())
556
+ }
557
+ }
558
+
559
+ impl FormalChunkedKey for InputKey {
560
+ type ChunkKey = InputChunkKey;
561
+ type Value = Box<serde_json::value::RawValue>;
562
+
563
+ fn chunk(&self, chunk: usize) -> Self::ChunkKey {
564
+ InputChunkKey {
565
+ workflow_id: self.workflow_id,
566
+ location: self.location.clone(),
567
+ forgotten: self.forgotten,
568
+ chunk,
569
+ }
570
+ }
571
+
572
+ fn combine(&self, chunks: Vec<Value>) -> Result<Self::Value> {
573
+ serde_json::value::RawValue::from_string(String::from_utf8(
574
+ chunks
575
+ .iter()
576
+ .map(|x| x.value().iter().map(|x| *x))
577
+ .flatten()
578
+ .collect(),
579
+ )?)
580
+ .context("failed to combine `InputKey`")
581
+ }
582
+
583
+ fn split(&self, value: Self::Value) -> Result<Vec<Vec<u8>>> {
584
+ self.split_ref(value.as_ref())
585
+ }
586
+ }
587
+
588
+ impl TuplePack for InputKey {
589
+ fn pack<W: std::io::Write>(
590
+ &self,
591
+ w: &mut W,
592
+ tuple_depth: TupleDepth,
593
+ ) -> std::io::Result<VersionstampOffset> {
594
+ pack_history_key(
595
+ self.workflow_id,
596
+ &self.location,
597
+ w,
598
+ tuple_depth,
599
+ self.forgotten,
600
+ INPUT,
601
+ )
602
+ }
603
+ }
604
+
605
+ pub struct InputChunkKey {
606
+ workflow_id: Id,
607
+ location: Location,
608
+ forgotten: bool,
609
+ chunk: usize,
610
+ }
611
+
612
+ impl TuplePack for InputChunkKey {
613
+ fn pack<W: std::io::Write>(
614
+ &self,
615
+ w: &mut W,
616
+ tuple_depth: TupleDepth,
617
+ ) -> std::io::Result<VersionstampOffset> {
618
+ pack_history_key(
619
+ self.workflow_id,
620
+ &self.location,
621
+ w,
622
+ tuple_depth,
623
+ self.forgotten,
624
+ INPUT,
625
+ )?;
626
+
627
+ self.chunk.pack(w, tuple_depth)
628
+ }
629
+ }
630
+
631
+ impl<'de> TupleUnpack<'de> for InputChunkKey {
632
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
633
+ let (input, (workflow_id, location, forgotten)) =
634
+ unpack_history_key(input, tuple_depth, INPUT, "INPUT")?;
635
+
636
+ let (input, chunk) = <usize>::unpack(input, tuple_depth)?;
637
+
638
+ Ok((
639
+ input,
640
+ InputChunkKey {
641
+ workflow_id,
642
+ location,
643
+ forgotten,
644
+ chunk,
645
+ },
646
+ ))
647
+ }
648
+ }
649
+
650
+ pub struct OutputKey {
651
+ workflow_id: Id,
652
+ location: Location,
653
+ forgotten: bool,
654
+ }
655
+
656
+ impl OutputKey {
657
+ pub fn new(workflow_id: Id, location: Location) -> Self {
658
+ OutputKey {
659
+ workflow_id,
660
+ location,
661
+ forgotten: false,
662
+ }
663
+ }
664
+
665
+ pub fn split_ref(&self, value: &serde_json::value::RawValue) -> Result<Vec<Vec<u8>>> {
666
+ Ok(value
667
+ .get()
668
+ .as_bytes()
669
+ .chunks(universaldb::utils::CHUNK_SIZE)
670
+ .map(|x| x.to_vec())
671
+ .collect())
672
+ }
673
+ }
674
+
675
+ impl FormalChunkedKey for OutputKey {
676
+ type ChunkKey = OutputChunkKey;
677
+ type Value = Box<serde_json::value::RawValue>;
678
+
679
+ fn chunk(&self, chunk: usize) -> Self::ChunkKey {
680
+ OutputChunkKey {
681
+ workflow_id: self.workflow_id,
682
+ location: self.location.clone(),
683
+ forgotten: self.forgotten,
684
+ chunk,
685
+ }
686
+ }
687
+
688
+ fn combine(&self, chunks: Vec<Value>) -> Result<Self::Value> {
689
+ serde_json::value::RawValue::from_string(String::from_utf8(
690
+ chunks
691
+ .iter()
692
+ .map(|x| x.value().iter().map(|x| *x))
693
+ .flatten()
694
+ .collect(),
695
+ )?)
696
+ .context("failed to combine `OutputKey`")
697
+ }
698
+
699
+ fn split(&self, value: Self::Value) -> Result<Vec<Vec<u8>>> {
700
+ self.split_ref(value.as_ref())
701
+ }
702
+ }
703
+
704
+ impl TuplePack for OutputKey {
705
+ fn pack<W: std::io::Write>(
706
+ &self,
707
+ w: &mut W,
708
+ tuple_depth: TupleDepth,
709
+ ) -> std::io::Result<VersionstampOffset> {
710
+ pack_history_key(
711
+ self.workflow_id,
712
+ &self.location,
713
+ w,
714
+ tuple_depth,
715
+ self.forgotten,
716
+ OUTPUT,
717
+ )
718
+ }
719
+ }
720
+
721
+ pub struct OutputChunkKey {
722
+ workflow_id: Id,
723
+ location: Location,
724
+ forgotten: bool,
725
+ chunk: usize,
726
+ }
727
+
728
+ impl TuplePack for OutputChunkKey {
729
+ fn pack<W: std::io::Write>(
730
+ &self,
731
+ w: &mut W,
732
+ tuple_depth: TupleDepth,
733
+ ) -> std::io::Result<VersionstampOffset> {
734
+ pack_history_key(
735
+ self.workflow_id,
736
+ &self.location,
737
+ w,
738
+ tuple_depth,
739
+ self.forgotten,
740
+ OUTPUT,
741
+ )?;
742
+
743
+ self.chunk.pack(w, tuple_depth)
744
+ }
745
+ }
746
+
747
+ impl<'de> TupleUnpack<'de> for OutputChunkKey {
748
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
749
+ let (input, (workflow_id, location, forgotten)) =
750
+ unpack_history_key(input, tuple_depth, OUTPUT, "OUTPUT")?;
751
+
752
+ let (input, chunk) = <usize>::unpack(input, tuple_depth)?;
753
+
754
+ Ok((
755
+ input,
756
+ OutputChunkKey {
757
+ workflow_id,
758
+ location,
759
+ forgotten,
760
+ chunk,
761
+ },
762
+ ))
763
+ }
764
+ }
765
+
766
+ // TODO: Reimplement as an atomic counter key + a latest timestamp?
767
+ #[derive(Debug)]
768
+ pub struct ErrorKey {
769
+ workflow_id: Id,
770
+ location: Location,
771
+ forgotten: bool,
772
+ pub ts: i64,
773
+ pub error: String,
774
+ }
775
+
776
+ impl ErrorKey {
777
+ pub fn new(workflow_id: Id, location: Location, ts: i64, error: String) -> Self {
778
+ ErrorKey {
779
+ workflow_id,
780
+ location,
781
+ forgotten: false,
782
+ ts,
783
+ error,
784
+ }
785
+ }
786
+ }
787
+
788
+ impl FormalKey for ErrorKey {
789
+ type Value = ();
790
+
791
+ fn deserialize(&self, _raw: &[u8]) -> Result<Self::Value> {
792
+ Ok(())
793
+ }
794
+
795
+ fn serialize(&self, _value: Self::Value) -> Result<Vec<u8>> {
796
+ Ok(Vec::new())
797
+ }
798
+ }
799
+
800
+ impl TuplePack for ErrorKey {
801
+ fn pack<W: std::io::Write>(
802
+ &self,
803
+ w: &mut W,
804
+ tuple_depth: TupleDepth,
805
+ ) -> std::io::Result<VersionstampOffset> {
806
+ let mut offset = VersionstampOffset::None { size: 0 };
807
+
808
+ offset += pack_history_key(
809
+ self.workflow_id,
810
+ &self.location,
811
+ w,
812
+ tuple_depth,
813
+ self.forgotten,
814
+ ERROR,
815
+ )?;
816
+
817
+ let t = (self.ts, &self.error);
818
+ t.pack(w, tuple_depth)?;
819
+
820
+ Ok(offset)
821
+ }
822
+ }
823
+
824
+ impl<'de> TupleUnpack<'de> for ErrorKey {
825
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
826
+ let (input, (workflow_id, location, forgotten)) =
827
+ unpack_history_key(input, tuple_depth, ERROR, "ERROR")?;
828
+
829
+ let (input, (ts, error)) = <(i64, String)>::unpack(input, tuple_depth)?;
830
+
831
+ Ok((
832
+ input,
833
+ ErrorKey {
834
+ workflow_id,
835
+ location,
836
+ forgotten,
837
+ ts,
838
+ error,
839
+ },
840
+ ))
841
+ }
842
+ }
843
+
844
+ #[derive(Debug)]
845
+ pub struct IterationKey {
846
+ workflow_id: Id,
847
+ location: Location,
848
+ forgotten: bool,
849
+ }
850
+
851
+ impl IterationKey {
852
+ pub fn new(workflow_id: Id, location: Location) -> Self {
853
+ IterationKey {
854
+ workflow_id,
855
+ location,
856
+ forgotten: false,
857
+ }
858
+ }
859
+ }
860
+
861
+ impl FormalKey for IterationKey {
862
+ type Value = usize;
863
+
864
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
865
+ Ok(usize::from_be_bytes(raw.try_into()?))
866
+ }
867
+
868
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
869
+ Ok(value.to_be_bytes().to_vec())
870
+ }
871
+ }
872
+
873
+ impl TuplePack for IterationKey {
874
+ fn pack<W: std::io::Write>(
875
+ &self,
876
+ w: &mut W,
877
+ tuple_depth: TupleDepth,
878
+ ) -> std::io::Result<VersionstampOffset> {
879
+ pack_history_key(
880
+ self.workflow_id,
881
+ &self.location,
882
+ w,
883
+ tuple_depth,
884
+ self.forgotten,
885
+ ITERATION,
886
+ )
887
+ }
888
+ }
889
+
890
+ impl<'de> TupleUnpack<'de> for IterationKey {
891
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
892
+ let (input, (workflow_id, location, forgotten)) =
893
+ unpack_history_key(input, tuple_depth, ITERATION, "ITERATION")?;
894
+
895
+ Ok((
896
+ input,
897
+ IterationKey {
898
+ workflow_id,
899
+ location,
900
+ forgotten,
901
+ },
902
+ ))
903
+ }
904
+ }
905
+
906
+ #[derive(Debug)]
907
+ pub struct DeadlineTsKey {
908
+ workflow_id: Id,
909
+ location: Location,
910
+ forgotten: bool,
911
+ }
912
+
913
+ impl DeadlineTsKey {
914
+ pub fn new(workflow_id: Id, location: Location) -> Self {
915
+ DeadlineTsKey {
916
+ workflow_id,
917
+ location,
918
+ forgotten: false,
919
+ }
920
+ }
921
+ }
922
+
923
+ impl FormalKey for DeadlineTsKey {
924
+ /// Timestamp.
925
+ type Value = i64;
926
+
927
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
928
+ Ok(i64::from_be_bytes(raw.try_into()?))
929
+ }
930
+
931
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
932
+ Ok(value.to_be_bytes().to_vec())
933
+ }
934
+ }
935
+
936
+ impl TuplePack for DeadlineTsKey {
937
+ fn pack<W: std::io::Write>(
938
+ &self,
939
+ w: &mut W,
940
+ tuple_depth: TupleDepth,
941
+ ) -> std::io::Result<VersionstampOffset> {
942
+ pack_history_key(
943
+ self.workflow_id,
944
+ &self.location,
945
+ w,
946
+ tuple_depth,
947
+ self.forgotten,
948
+ DEADLINE_TS,
949
+ )
950
+ }
951
+ }
952
+
953
+ impl<'de> TupleUnpack<'de> for DeadlineTsKey {
954
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
955
+ let (input, (workflow_id, location, forgotten)) =
956
+ unpack_history_key(input, tuple_depth, DEADLINE_TS, "DEADLINE_TS")?;
957
+
958
+ Ok((
959
+ input,
960
+ DeadlineTsKey {
961
+ workflow_id,
962
+ location,
963
+ forgotten,
964
+ },
965
+ ))
966
+ }
967
+ }
968
+
969
+ #[derive(Debug)]
970
+ pub struct SleepStateKey {
971
+ workflow_id: Id,
972
+ location: Location,
973
+ forgotten: bool,
974
+ }
975
+
976
+ impl SleepStateKey {
977
+ pub fn new(workflow_id: Id, location: Location) -> Self {
978
+ SleepStateKey {
979
+ workflow_id,
980
+ location,
981
+ forgotten: false,
982
+ }
983
+ }
984
+ }
985
+
986
+ impl FormalKey for SleepStateKey {
987
+ type Value = SleepState;
988
+
989
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
990
+ SleepState::from_repr(usize::from_be_bytes(raw.try_into()?)).context("invalid EventType")
991
+ }
992
+
993
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
994
+ Ok((value as usize).to_be_bytes().to_vec())
995
+ }
996
+ }
997
+
998
+ impl TuplePack for SleepStateKey {
999
+ fn pack<W: std::io::Write>(
1000
+ &self,
1001
+ w: &mut W,
1002
+ tuple_depth: TupleDepth,
1003
+ ) -> std::io::Result<VersionstampOffset> {
1004
+ pack_history_key(
1005
+ self.workflow_id,
1006
+ &self.location,
1007
+ w,
1008
+ tuple_depth,
1009
+ self.forgotten,
1010
+ SLEEP_STATE,
1011
+ )
1012
+ }
1013
+ }
1014
+
1015
+ impl<'de> TupleUnpack<'de> for SleepStateKey {
1016
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
1017
+ let (input, (workflow_id, location, forgotten)) =
1018
+ unpack_history_key(input, tuple_depth, SLEEP_STATE, "SLEEP_STATE")?;
1019
+
1020
+ Ok((
1021
+ input,
1022
+ SleepStateKey {
1023
+ workflow_id,
1024
+ location,
1025
+ forgotten,
1026
+ },
1027
+ ))
1028
+ }
1029
+ }
1030
+
1031
+ #[derive(Debug)]
1032
+ pub struct InnerEventTypeKey {
1033
+ workflow_id: Id,
1034
+ location: Location,
1035
+ forgotten: bool,
1036
+ }
1037
+
1038
+ impl InnerEventTypeKey {
1039
+ pub fn new(workflow_id: Id, location: Location) -> Self {
1040
+ InnerEventTypeKey {
1041
+ workflow_id,
1042
+ location,
1043
+ forgotten: false,
1044
+ }
1045
+ }
1046
+ }
1047
+
1048
+ impl FormalKey for InnerEventTypeKey {
1049
+ type Value = EventType;
1050
+
1051
+ fn deserialize(&self, raw: &[u8]) -> Result<Self::Value> {
1052
+ EventType::from_repr(usize::from_be_bytes(raw.try_into()?)).context("invalid EventType")
1053
+ }
1054
+
1055
+ fn serialize(&self, value: Self::Value) -> Result<Vec<u8>> {
1056
+ Ok((value as usize).to_be_bytes().to_vec())
1057
+ }
1058
+ }
1059
+
1060
+ impl TuplePack for InnerEventTypeKey {
1061
+ fn pack<W: std::io::Write>(
1062
+ &self,
1063
+ w: &mut W,
1064
+ tuple_depth: TupleDepth,
1065
+ ) -> std::io::Result<VersionstampOffset> {
1066
+ pack_history_key(
1067
+ self.workflow_id,
1068
+ &self.location,
1069
+ w,
1070
+ tuple_depth,
1071
+ self.forgotten,
1072
+ INNER_EVENT_TYPE,
1073
+ )
1074
+ }
1075
+ }
1076
+
1077
+ impl<'de> TupleUnpack<'de> for InnerEventTypeKey {
1078
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
1079
+ let (input, (workflow_id, location, forgotten)) =
1080
+ unpack_history_key(input, tuple_depth, INNER_EVENT_TYPE, "INNER_EVENT_TYPE")?;
1081
+
1082
+ Ok((
1083
+ input,
1084
+ InnerEventTypeKey {
1085
+ workflow_id,
1086
+ location,
1087
+ forgotten,
1088
+ },
1089
+ ))
1090
+ }
1091
+ }
1092
+
1093
+ #[derive(Debug)]
1094
+ pub struct TagKey {
1095
+ workflow_id: Id,
1096
+ location: Location,
1097
+ forgotten: bool,
1098
+ pub k: String,
1099
+ pub v: String,
1100
+ }
1101
+
1102
+ impl TagKey {
1103
+ pub fn new(workflow_id: Id, location: Location, k: String, v: String) -> Self {
1104
+ TagKey {
1105
+ workflow_id,
1106
+ location,
1107
+ forgotten: false,
1108
+ k,
1109
+ v,
1110
+ }
1111
+ }
1112
+ }
1113
+
1114
+ impl FormalKey for TagKey {
1115
+ type Value = ();
1116
+
1117
+ fn deserialize(&self, _raw: &[u8]) -> Result<Self::Value> {
1118
+ Ok(())
1119
+ }
1120
+
1121
+ fn serialize(&self, _value: Self::Value) -> Result<Vec<u8>> {
1122
+ Ok(Vec::new())
1123
+ }
1124
+ }
1125
+
1126
+ impl TuplePack for TagKey {
1127
+ fn pack<W: std::io::Write>(
1128
+ &self,
1129
+ w: &mut W,
1130
+ tuple_depth: TupleDepth,
1131
+ ) -> std::io::Result<VersionstampOffset> {
1132
+ let mut offset = VersionstampOffset::None { size: 0 };
1133
+
1134
+ offset += pack_history_key(
1135
+ self.workflow_id,
1136
+ &self.location,
1137
+ w,
1138
+ tuple_depth,
1139
+ self.forgotten,
1140
+ TAG,
1141
+ )?;
1142
+
1143
+ let t = (&self.k, &self.v);
1144
+ offset += t.pack(w, tuple_depth)?;
1145
+
1146
+ Ok(offset)
1147
+ }
1148
+ }
1149
+
1150
+ impl<'de> TupleUnpack<'de> for TagKey {
1151
+ fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
1152
+ let (input, (workflow_id, location, forgotten)) =
1153
+ unpack_history_key(input, tuple_depth, TAG, "TAG")?;
1154
+
1155
+ let (input, (k, v)) = <(String, String)>::unpack(input, tuple_depth)?;
1156
+
1157
+ Ok((
1158
+ input,
1159
+ TagKey {
1160
+ workflow_id,
1161
+ location,
1162
+ forgotten,
1163
+ k,
1164
+ v,
1165
+ },
1166
+ ))
1167
+ }
1168
+ }
1169
+
1170
+ fn pack_history_key<W: std::io::Write>(
1171
+ workflow_id: Id,
1172
+ location: &Location,
1173
+ w: &mut W,
1174
+ tuple_depth: TupleDepth,
1175
+ forgotten: bool,
1176
+ variant: usize,
1177
+ ) -> std::io::Result<VersionstampOffset> {
1178
+ let mut offset = VersionstampOffset::None { size: 0 };
1179
+
1180
+ let t = (
1181
+ WORKFLOW,
1182
+ DATA,
1183
+ workflow_id,
1184
+ HISTORY,
1185
+ if forgotten { FORGOTTEN } else { ACTIVE },
1186
+ );
1187
+ offset += t.pack(w, tuple_depth)?;
1188
+
1189
+ for coord in &**location {
1190
+ offset += coord.pack(w, tuple_depth)?;
1191
+ }
1192
+
1193
+ let t = (DATA, variant);
1194
+ offset += t.pack(w, tuple_depth)?;
1195
+
1196
+ Ok(offset)
1197
+ }
1198
+
1199
+ fn unpack_history_key<'de>(
1200
+ input: &'de [u8],
1201
+ tuple_depth: TupleDepth,
1202
+ variant: usize,
1203
+ variant_str: &str,
1204
+ ) -> PackResult<(&'de [u8], (Id, Location, bool))> {
1205
+ let (mut input, (_, _, workflow_id, data, history_variant)) =
1206
+ <(usize, usize, Id, usize, usize)>::unpack(input, tuple_depth)?;
1207
+ if data != HISTORY {
1208
+ return Err(PackError::Message("expected HISTORY data".into()));
1209
+ }
1210
+
1211
+ let mut coords = Vec::new();
1212
+
1213
+ loop {
1214
+ let Ok((input2, coord)) = Coordinate::unpack(input, tuple_depth) else {
1215
+ break;
1216
+ };
1217
+
1218
+ coords.push(coord);
1219
+ input = input2;
1220
+ }
1221
+
1222
+ let (input, (_, data)) = <(usize, usize)>::unpack(input, tuple_depth)?;
1223
+
1224
+ if data != variant {
1225
+ return Err(PackError::Message(
1226
+ format!("expected {variant_str} data").into(),
1227
+ ));
1228
+ }
1229
+
1230
+ Ok((
1231
+ input,
1232
+ (
1233
+ workflow_id,
1234
+ Location::from_iter(coords),
1235
+ history_variant == FORGOTTEN,
1236
+ ),
1237
+ ))
1238
+ }
1239
+
1240
+ pub mod insert {
1241
+ use anyhow::Result;
1242
+ use rivet_util::Id;
1243
+ use universaldb::utils::{FormalChunkedKey, FormalKey};
1244
+
1245
+ use super::super::super::value_to_str;
1246
+ use crate::{
1247
+ error::{WorkflowError, WorkflowResult},
1248
+ history::{
1249
+ event::{EventType, SleepState},
1250
+ location::Location,
1251
+ },
1252
+ };
1253
+
1254
+ pub fn common(
1255
+ subspace: &universaldb::tuple::Subspace,
1256
+ tx: &universaldb::RetryableTransaction,
1257
+ workflow_id: Id,
1258
+ location: &Location,
1259
+ event_type: EventType,
1260
+ version: usize,
1261
+ create_ts: i64,
1262
+ ) -> Result<()> {
1263
+ let event_type_key = super::EventTypeKey::new(workflow_id, location.clone());
1264
+ tx.set(
1265
+ &subspace.pack(&event_type_key),
1266
+ &event_type_key.serialize(event_type)?,
1267
+ );
1268
+
1269
+ let version_key = super::VersionKey::new(workflow_id, location.clone());
1270
+ tx.set(
1271
+ &subspace.pack(&version_key),
1272
+ &version_key.serialize(version)?,
1273
+ );
1274
+
1275
+ let create_ts_key = super::CreateTsKey::new(workflow_id, location.clone());
1276
+ tx.set(
1277
+ &subspace.pack(&create_ts_key),
1278
+ &create_ts_key.serialize(create_ts)?,
1279
+ );
1280
+
1281
+ Ok(())
1282
+ }
1283
+
1284
+ pub fn signal_event(
1285
+ subspace: &universaldb::tuple::Subspace,
1286
+ tx: &universaldb::RetryableTransaction,
1287
+ workflow_id: Id,
1288
+ location: &Location,
1289
+ version: usize,
1290
+ create_ts: i64,
1291
+ signal_id: Id,
1292
+ signal_name: &str,
1293
+ body: &serde_json::value::RawValue,
1294
+ ) -> Result<()> {
1295
+ common(
1296
+ subspace,
1297
+ tx,
1298
+ workflow_id,
1299
+ location,
1300
+ EventType::Signal,
1301
+ version,
1302
+ create_ts,
1303
+ )?;
1304
+
1305
+ let signal_id_key = super::SignalIdKey::new(workflow_id, location.clone());
1306
+ tx.set(
1307
+ &subspace.pack(&signal_id_key),
1308
+ &signal_id_key.serialize(signal_id)?,
1309
+ );
1310
+
1311
+ let signal_name_key = super::NameKey::new(workflow_id, location.clone());
1312
+ tx.set(
1313
+ &subspace.pack(&signal_name_key),
1314
+ &signal_name_key.serialize(signal_name.to_string())?,
1315
+ );
1316
+
1317
+ let signal_body_key = super::InputKey::new(workflow_id, location.clone());
1318
+
1319
+ // Write signal body
1320
+ for (i, chunk) in signal_body_key.split_ref(&body)?.into_iter().enumerate() {
1321
+ let chunk_key = signal_body_key.chunk(i);
1322
+
1323
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1324
+ }
1325
+
1326
+ Ok(())
1327
+ }
1328
+
1329
+ pub fn signal_send_event(
1330
+ subspace: &universaldb::tuple::Subspace,
1331
+ tx: &universaldb::RetryableTransaction,
1332
+ workflow_id: Id,
1333
+ location: &Location,
1334
+ version: usize,
1335
+ create_ts: i64,
1336
+ signal_id: Id,
1337
+ signal_name: &str,
1338
+ body: &serde_json::value::RawValue,
1339
+ to_workflow_id: Id,
1340
+ ) -> Result<()> {
1341
+ common(
1342
+ subspace,
1343
+ tx,
1344
+ workflow_id,
1345
+ location,
1346
+ EventType::SignalSend,
1347
+ version,
1348
+ create_ts,
1349
+ )?;
1350
+
1351
+ let signal_id_key = super::SignalIdKey::new(workflow_id, location.clone());
1352
+ tx.set(
1353
+ &subspace.pack(&signal_id_key),
1354
+ &signal_id_key.serialize(signal_id)?,
1355
+ );
1356
+
1357
+ let signal_name_key = super::NameKey::new(workflow_id, location.clone());
1358
+ tx.set(
1359
+ &subspace.pack(&signal_name_key),
1360
+ &signal_name_key.serialize(signal_name.to_string())?,
1361
+ );
1362
+
1363
+ let signal_body_key = super::InputKey::new(workflow_id, location.clone());
1364
+
1365
+ // Write signal body
1366
+ for (i, chunk) in signal_body_key.split_ref(&body)?.into_iter().enumerate() {
1367
+ let chunk_key = signal_body_key.chunk(i);
1368
+
1369
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1370
+ }
1371
+
1372
+ let to_workflow_id_key = super::SubWorkflowIdKey::new(workflow_id, location.clone());
1373
+ tx.set(
1374
+ &subspace.pack(&to_workflow_id_key),
1375
+ &to_workflow_id_key.serialize(to_workflow_id)?,
1376
+ );
1377
+
1378
+ Ok(())
1379
+ }
1380
+
1381
+ pub fn sub_workflow_event(
1382
+ subspace: &universaldb::tuple::Subspace,
1383
+ tx: &universaldb::RetryableTransaction,
1384
+ workflow_id: Id,
1385
+ location: &Location,
1386
+ version: usize,
1387
+ create_ts: i64,
1388
+ sub_workflow_id: Id,
1389
+ sub_workflow_name: &str,
1390
+ tags: Option<&serde_json::Value>,
1391
+ input: &serde_json::value::RawValue,
1392
+ ) -> Result<()> {
1393
+ common(
1394
+ subspace,
1395
+ tx,
1396
+ workflow_id,
1397
+ location,
1398
+ EventType::SubWorkflow,
1399
+ version,
1400
+ create_ts,
1401
+ )?;
1402
+
1403
+ let sub_workflow_id_key = super::SubWorkflowIdKey::new(workflow_id, location.clone());
1404
+ tx.set(
1405
+ &subspace.pack(&sub_workflow_id_key),
1406
+ &sub_workflow_id_key.serialize(sub_workflow_id)?,
1407
+ );
1408
+
1409
+ let sub_workflow_name_key = super::NameKey::new(workflow_id, location.clone());
1410
+ tx.set(
1411
+ &subspace.pack(&sub_workflow_name_key),
1412
+ &sub_workflow_name_key.serialize(sub_workflow_name.to_string())?,
1413
+ );
1414
+
1415
+ // Write tags
1416
+ let tags = tags
1417
+ .map(|x| {
1418
+ x.as_object()
1419
+ .ok_or_else(|| WorkflowError::InvalidTags("must be an object".to_string()))
1420
+ })
1421
+ .transpose()?
1422
+ .into_iter()
1423
+ .flatten()
1424
+ .map(|(k, v)| Ok((k.clone(), value_to_str(v)?)))
1425
+ .collect::<WorkflowResult<Vec<_>>>()?;
1426
+
1427
+ for (k, v) in &tags {
1428
+ // Write tag key
1429
+ let tag_key = super::TagKey::new(workflow_id, location.clone(), k.clone(), v.clone());
1430
+ tx.set(&subspace.pack(&tag_key), &tag_key.serialize(())?);
1431
+ }
1432
+
1433
+ let input_key = super::InputKey::new(workflow_id, location.clone());
1434
+
1435
+ // Write input
1436
+ for (i, chunk) in input_key.split_ref(&input)?.into_iter().enumerate() {
1437
+ let chunk_key = input_key.chunk(i);
1438
+
1439
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1440
+ }
1441
+
1442
+ Ok(())
1443
+ }
1444
+
1445
+ pub fn activity_event(
1446
+ subspace: &universaldb::tuple::Subspace,
1447
+ tx: &universaldb::RetryableTransaction,
1448
+ workflow_id: Id,
1449
+ location: &Location,
1450
+ version: usize,
1451
+ create_ts: i64,
1452
+ activity_name: &str,
1453
+ input: &serde_json::value::RawValue,
1454
+ res: std::result::Result<&serde_json::value::RawValue, &str>,
1455
+ ) -> Result<()> {
1456
+ common(
1457
+ subspace,
1458
+ tx,
1459
+ workflow_id,
1460
+ location,
1461
+ EventType::Activity,
1462
+ version,
1463
+ create_ts,
1464
+ )?;
1465
+
1466
+ let activity_name_key = super::NameKey::new(workflow_id, location.clone());
1467
+ tx.set(
1468
+ &subspace.pack(&activity_name_key),
1469
+ &activity_name_key.serialize(activity_name.to_string())?,
1470
+ );
1471
+
1472
+ let input_key = super::InputKey::new(workflow_id, location.clone());
1473
+
1474
+ // Write input
1475
+ for (i, chunk) in input_key.split_ref(&input)?.into_iter().enumerate() {
1476
+ let chunk_key = input_key.chunk(i);
1477
+
1478
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1479
+ }
1480
+
1481
+ match res {
1482
+ Ok(output) => {
1483
+ let output_key = super::OutputKey::new(workflow_id, location.clone());
1484
+
1485
+ // Write output
1486
+ for (i, chunk) in output_key.split_ref(&output)?.into_iter().enumerate() {
1487
+ let chunk_key = output_key.chunk(i);
1488
+
1489
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1490
+ }
1491
+ }
1492
+ Err(err) => {
1493
+ let error_key = super::ErrorKey::new(
1494
+ workflow_id,
1495
+ location.clone(),
1496
+ rivet_util::timestamp::now(),
1497
+ err.to_string(),
1498
+ );
1499
+ tx.set(&subspace.pack(&error_key), &error_key.serialize(())?);
1500
+ }
1501
+ }
1502
+
1503
+ Ok(())
1504
+ }
1505
+
1506
+ pub fn message_send_event(
1507
+ subspace: &universaldb::tuple::Subspace,
1508
+ tx: &universaldb::RetryableTransaction,
1509
+ workflow_id: Id,
1510
+ location: &Location,
1511
+ version: usize,
1512
+ create_ts: i64,
1513
+ tags: &serde_json::Value,
1514
+ message_name: &str,
1515
+ body: &serde_json::value::RawValue,
1516
+ ) -> Result<()> {
1517
+ common(
1518
+ subspace,
1519
+ tx,
1520
+ workflow_id,
1521
+ location,
1522
+ EventType::MessageSend,
1523
+ version,
1524
+ create_ts,
1525
+ )?;
1526
+
1527
+ // Write tags
1528
+ let tags = tags
1529
+ .as_object()
1530
+ .ok_or_else(|| WorkflowError::InvalidTags("must be an object".to_string()))?
1531
+ .into_iter()
1532
+ .map(|(k, v)| Ok((k.clone(), value_to_str(v)?)))
1533
+ .collect::<WorkflowResult<Vec<_>>>()?;
1534
+
1535
+ for (k, v) in &tags {
1536
+ // Write tag key
1537
+ let tag_key = super::TagKey::new(workflow_id, location.clone(), k.clone(), v.clone());
1538
+ tx.set(&subspace.pack(&tag_key), &tag_key.serialize(())?);
1539
+ }
1540
+
1541
+ let message_name_key = super::NameKey::new(workflow_id, location.clone());
1542
+ tx.set(
1543
+ &subspace.pack(&message_name_key),
1544
+ &message_name_key.serialize(message_name.to_string())?,
1545
+ );
1546
+
1547
+ let body_key = super::InputKey::new(workflow_id, location.clone());
1548
+
1549
+ // Write body
1550
+ for (i, chunk) in body_key.split_ref(&body)?.into_iter().enumerate() {
1551
+ let chunk_key = body_key.chunk(i);
1552
+
1553
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1554
+ }
1555
+
1556
+ Ok(())
1557
+ }
1558
+
1559
+ pub fn loop_event(
1560
+ subspace: &universaldb::tuple::Subspace,
1561
+ tx: &universaldb::RetryableTransaction,
1562
+ workflow_id: Id,
1563
+ location: &Location,
1564
+ version: usize,
1565
+ create_ts: i64,
1566
+ iteration: usize,
1567
+ state: &serde_json::value::RawValue,
1568
+ output: Option<&serde_json::value::RawValue>,
1569
+ ) -> Result<()> {
1570
+ common(
1571
+ subspace,
1572
+ tx,
1573
+ workflow_id,
1574
+ location,
1575
+ EventType::Loop,
1576
+ version,
1577
+ create_ts,
1578
+ )?;
1579
+
1580
+ let iteration_key = super::IterationKey::new(workflow_id, location.clone());
1581
+ tx.set(
1582
+ &subspace.pack(&iteration_key),
1583
+ &iteration_key.serialize(iteration)?,
1584
+ );
1585
+
1586
+ let state_key = super::InputKey::new(workflow_id, location.clone());
1587
+
1588
+ // Write state
1589
+ for (i, chunk) in state_key.split_ref(&state)?.into_iter().enumerate() {
1590
+ let chunk_key = state_key.chunk(i);
1591
+
1592
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1593
+ }
1594
+
1595
+ if let Some(output) = output {
1596
+ let output_key = super::OutputKey::new(workflow_id, location.clone());
1597
+
1598
+ // Write output
1599
+ for (i, chunk) in output_key.split_ref(&output)?.into_iter().enumerate() {
1600
+ let chunk_key = output_key.chunk(i);
1601
+
1602
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1603
+ }
1604
+ }
1605
+
1606
+ Ok(())
1607
+ }
1608
+
1609
+ pub fn update_loop_event(
1610
+ subspace: &universaldb::tuple::Subspace,
1611
+ tx: &universaldb::RetryableTransaction,
1612
+ workflow_id: Id,
1613
+ location: &Location,
1614
+ iteration: usize,
1615
+ state: &serde_json::value::RawValue,
1616
+ output: Option<&serde_json::value::RawValue>,
1617
+ ) -> Result<()> {
1618
+ let iteration_key = super::IterationKey::new(workflow_id, location.clone());
1619
+ tx.set(
1620
+ &subspace.pack(&iteration_key),
1621
+ &iteration_key.serialize(iteration)?,
1622
+ );
1623
+
1624
+ let state_key = super::InputKey::new(workflow_id, location.clone());
1625
+ let state_subspace = subspace.subspace(&state_key);
1626
+
1627
+ // Clear old state
1628
+ tx.clear_subspace_range(&state_subspace);
1629
+
1630
+ // Write new state
1631
+ for (i, chunk) in state_key.split_ref(&state)?.into_iter().enumerate() {
1632
+ let chunk_key = state_key.chunk(i);
1633
+
1634
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1635
+ }
1636
+
1637
+ if let Some(output) = output {
1638
+ let output_key = super::OutputKey::new(workflow_id, location.clone());
1639
+
1640
+ // Write output
1641
+ for (i, chunk) in output_key.split_ref(&output)?.into_iter().enumerate() {
1642
+ let chunk_key = output_key.chunk(i);
1643
+
1644
+ tx.set(&subspace.pack(&chunk_key), &chunk);
1645
+ }
1646
+ }
1647
+
1648
+ Ok(())
1649
+ }
1650
+
1651
+ pub fn sleep_event(
1652
+ subspace: &universaldb::tuple::Subspace,
1653
+ tx: &universaldb::RetryableTransaction,
1654
+ workflow_id: Id,
1655
+ location: &Location,
1656
+ version: usize,
1657
+ create_ts: i64,
1658
+ deadline_ts: i64,
1659
+ sleep_state: SleepState,
1660
+ ) -> Result<()> {
1661
+ common(
1662
+ subspace,
1663
+ tx,
1664
+ workflow_id,
1665
+ location,
1666
+ EventType::Sleep,
1667
+ version,
1668
+ create_ts,
1669
+ )?;
1670
+
1671
+ let deadline_ts_key = super::DeadlineTsKey::new(workflow_id, location.clone());
1672
+ tx.set(
1673
+ &subspace.pack(&deadline_ts_key),
1674
+ &deadline_ts_key.serialize(deadline_ts)?,
1675
+ );
1676
+
1677
+ let sleep_state_key = super::SleepStateKey::new(workflow_id, location.clone());
1678
+ tx.set(
1679
+ &subspace.pack(&sleep_state_key),
1680
+ &sleep_state_key.serialize(sleep_state)?,
1681
+ );
1682
+
1683
+ Ok(())
1684
+ }
1685
+
1686
+ pub fn update_sleep_event(
1687
+ subspace: &universaldb::tuple::Subspace,
1688
+ tx: &universaldb::RetryableTransaction,
1689
+ workflow_id: Id,
1690
+ location: &Location,
1691
+ sleep_state: SleepState,
1692
+ ) -> Result<()> {
1693
+ let sleep_state_key = super::SleepStateKey::new(workflow_id, location.clone());
1694
+ tx.set(
1695
+ &subspace.pack(&sleep_state_key),
1696
+ &sleep_state_key.serialize(sleep_state)?,
1697
+ );
1698
+
1699
+ Ok(())
1700
+ }
1701
+
1702
+ pub fn branch_event(
1703
+ subspace: &universaldb::tuple::Subspace,
1704
+ tx: &universaldb::RetryableTransaction,
1705
+ workflow_id: Id,
1706
+ location: &Location,
1707
+ version: usize,
1708
+ create_ts: i64,
1709
+ ) -> Result<()> {
1710
+ common(
1711
+ subspace,
1712
+ tx,
1713
+ workflow_id,
1714
+ location,
1715
+ EventType::Branch,
1716
+ version,
1717
+ create_ts,
1718
+ )?;
1719
+
1720
+ Ok(())
1721
+ }
1722
+
1723
+ pub fn removed_event(
1724
+ subspace: &universaldb::tuple::Subspace,
1725
+ tx: &universaldb::RetryableTransaction,
1726
+ workflow_id: Id,
1727
+ location: &Location,
1728
+ version: usize,
1729
+ create_ts: i64,
1730
+ inner_event_type: EventType,
1731
+ inner_event_name: Option<&str>,
1732
+ ) -> Result<()> {
1733
+ common(
1734
+ subspace,
1735
+ tx,
1736
+ workflow_id,
1737
+ location,
1738
+ EventType::Removed,
1739
+ version,
1740
+ create_ts,
1741
+ )?;
1742
+
1743
+ let inner_event_type_key = super::InnerEventTypeKey::new(workflow_id, location.clone());
1744
+ tx.set(
1745
+ &subspace.pack(&inner_event_type_key),
1746
+ &inner_event_type_key.serialize(inner_event_type)?,
1747
+ );
1748
+
1749
+ if let Some(inner_event_name) = inner_event_name {
1750
+ let inner_event_name_key = super::NameKey::new(workflow_id, location.clone());
1751
+ tx.set(
1752
+ &subspace.pack(&inner_event_name_key),
1753
+ &inner_event_name_key.serialize(inner_event_name.to_string())?,
1754
+ );
1755
+ }
1756
+
1757
+ Ok(())
1758
+ }
1759
+
1760
+ pub fn version_check_event(
1761
+ subspace: &universaldb::tuple::Subspace,
1762
+ tx: &universaldb::RetryableTransaction,
1763
+ workflow_id: Id,
1764
+ location: &Location,
1765
+ version: usize,
1766
+ create_ts: i64,
1767
+ ) -> Result<()> {
1768
+ common(
1769
+ subspace,
1770
+ tx,
1771
+ workflow_id,
1772
+ location,
1773
+ EventType::VersionCheck,
1774
+ version,
1775
+ create_ts,
1776
+ )?;
1777
+
1778
+ Ok(())
1779
+ }
1780
+ }