@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.
- package/LICENSE +203 -0
- package/artifacts/errors/actor.destroyed_during_creation.json +5 -0
- package/artifacts/errors/actor.destroyed_while_waiting_for_ready.json +5 -0
- package/artifacts/errors/actor.duplicate_key.json +5 -0
- package/artifacts/errors/actor.empty_key.json +5 -0
- package/artifacts/errors/actor.input_too_large.json +5 -0
- package/artifacts/errors/actor.key_reserved_in_different_datacenter.json +5 -0
- package/artifacts/errors/actor.key_too_large.json +5 -0
- package/artifacts/errors/actor.kv_key_not_found.json +5 -0
- package/artifacts/errors/actor.namespace_not_found.json +5 -0
- package/artifacts/errors/actor.no_runners_available.json +5 -0
- package/artifacts/errors/actor.not_found.json +5 -0
- package/artifacts/errors/api.bad_request.json +5 -0
- package/artifacts/errors/api.forbidden.json +5 -0
- package/artifacts/errors/api.internal_error.json +5 -0
- package/artifacts/errors/api.not_found.json +5 -0
- package/artifacts/errors/api.rate_limited.json +5 -0
- package/artifacts/errors/api.unauthorized.json +5 -0
- package/artifacts/errors/datacenter.not_found.json +5 -0
- package/artifacts/errors/guard.actor_destroyed.json +5 -0
- package/artifacts/errors/guard.actor_not_found.json +5 -0
- package/artifacts/errors/guard.actor_ready_timeout.json +5 -0
- package/artifacts/errors/guard.connection_error.json +5 -0
- package/artifacts/errors/guard.http_request_build_failed.json +5 -0
- package/artifacts/errors/guard.missing_header.json +5 -0
- package/artifacts/errors/guard.must_use_regional_host.json +5 -0
- package/artifacts/errors/guard.no_route.json +5 -0
- package/artifacts/errors/guard.no_route_targets.json +5 -0
- package/artifacts/errors/guard.rate_limit.json +5 -0
- package/artifacts/errors/guard.request_build_error.json +5 -0
- package/artifacts/errors/guard.request_timeout.json +5 -0
- package/artifacts/errors/guard.retry_attempts_exceeded.json +5 -0
- package/artifacts/errors/guard.service_unavailable.json +5 -0
- package/artifacts/errors/guard.target_changed.json +5 -0
- package/artifacts/errors/guard.upstream_error.json +5 -0
- package/artifacts/errors/guard.uri_parse_error.json +5 -0
- package/artifacts/errors/guard.websocket_pending_limit_reached.json +5 -0
- package/artifacts/errors/guard.websocket_service_hibernate.json +5 -0
- package/artifacts/errors/guard.websocket_service_timeout.json +5 -0
- package/artifacts/errors/guard.websocket_service_unavailable.json +5 -0
- package/artifacts/errors/guard.wrong_addr_protocol.json +5 -0
- package/artifacts/errors/kv.leader_forwarding_failed.json +5 -0
- package/artifacts/errors/kv.no_leader_elected.json +5 -0
- package/artifacts/errors/kv.not_leader.json +5 -0
- package/artifacts/errors/kv.response_channel_closed.json +5 -0
- package/artifacts/errors/namespace.failed_to_create.json +5 -0
- package/artifacts/errors/namespace.invalid_name.json +5 -0
- package/artifacts/errors/namespace.invalid_update.json +5 -0
- package/artifacts/errors/namespace.name_not_unique.json +5 -0
- package/artifacts/errors/namespace.not_found.json +5 -0
- package/artifacts/errors/namespace.not_leader.json +5 -0
- package/artifacts/errors/runner.not_found.json +5 -0
- package/artifacts/errors/runner_config.invalid.json +5 -0
- package/artifacts/errors/runner_config.not_found.json +5 -0
- package/artifacts/errors/test.input_too_large.json +5 -0
- package/artifacts/errors/test.key_too_large.json +5 -0
- package/artifacts/errors/test.meta_error.json +5 -0
- package/artifacts/errors/test.not_found.json +5 -0
- package/artifacts/errors/test.simple_error.json +5 -0
- package/artifacts/errors/test.test_error.json +5 -0
- package/artifacts/errors/ups.publish_failed.json +5 -0
- package/artifacts/errors/ups.request_timeout.json +5 -0
- package/artifacts/errors/validation.invalid_input.json +5 -0
- package/artifacts/errors/validation.no_keys.json +5 -0
- package/artifacts/errors/validation.race_condition.json +5 -0
- package/artifacts/errors/validation.too_many_actor_ids.json +5 -0
- package/artifacts/errors/ws.connection_closed.json +5 -0
- package/artifacts/errors/ws.eviction.json +5 -0
- package/artifacts/errors/ws.invalid_initial_packet.json +5 -0
- package/artifacts/errors/ws.invalid_packet.json +5 -0
- package/artifacts/errors/ws.invalid_url.json +5 -0
- package/artifacts/errors/ws.timed_out_waiting_for_init.json +5 -0
- package/artifacts/openapi.json +1833 -0
- package/contrib-docs/ACTOR_KEY_RESERVATION.md +101 -0
- package/contrib-docs/API.md +11 -0
- package/contrib-docs/DOCKER.md +5 -0
- package/contrib-docs/ERRORS.md +13 -0
- package/contrib-docs/GUARD.md +76 -0
- package/contrib-docs/PEGBOARD_TUNNEL_RETRIES.md +83 -0
- package/contrib-docs/RUNNER_LIFECYCLE.md +172 -0
- package/contrib-docs/SDKS.md +9 -0
- package/contrib-docs/TEST_DEPENDENCIES.md +43 -0
- package/contrib-docs/design-choicse/EMBEDDED_KV.md +80 -0
- package/contrib-docs/operate/TRACING_RECONFIGURE.md +78 -0
- package/docker/dev/.gitattributes +1 -0
- package/docker/dev/README.md +74 -0
- package/docker/dev/clickhouse/client-config.xml +5 -0
- package/docker/dev/clickhouse/config.xml +52 -0
- package/docker/dev/clickhouse/init/01-create-otel-table.sql +107 -0
- package/docker/dev/clickhouse/users.xml +35 -0
- package/docker/dev/docker-compose.yml +217 -0
- package/docker/dev/grafana/dashboards/api.json +1240 -0
- package/docker/dev/grafana/dashboards/cache.json +1075 -0
- package/docker/dev/grafana/dashboards/futures.json +230 -0
- package/docker/dev/grafana/dashboards/gasoline.json +2477 -0
- package/docker/dev/grafana/dashboards/guard.json +1274 -0
- package/docker/dev/grafana/dashboards/tokio.json +1005 -0
- package/docker/dev/grafana/dashboards/traces.json +957 -0
- package/docker/dev/grafana/grafana.ini +14 -0
- package/docker/dev/grafana/provisioning/dashboards/dashboards.yaml +10 -0
- package/docker/dev/grafana/provisioning/datasources/datasources.yaml +30 -0
- package/docker/dev/otel-collector-client/config.yaml +39 -0
- package/docker/dev/otel-collector-server/config.yaml +72 -0
- package/docker/dev/postgres/init-db.sh +6 -0
- package/docker/dev/rivet-engine/config.jsonc +48 -0
- package/docker/dev/vector-client/vector.yaml +31 -0
- package/docker/dev/vector-server/vector.yaml +61 -0
- package/docker/dev-host/.gitattributes +1 -0
- package/docker/dev-host/README.md +74 -0
- package/docker/dev-host/clickhouse/client-config.xml +5 -0
- package/docker/dev-host/clickhouse/config.xml +52 -0
- package/docker/dev-host/clickhouse/init/01-create-otel-table.sql +107 -0
- package/docker/dev-host/clickhouse/users.xml +35 -0
- package/docker/dev-host/docker-compose.yml +190 -0
- package/docker/dev-host/grafana/dashboards/api.json +1240 -0
- package/docker/dev-host/grafana/dashboards/cache.json +1075 -0
- package/docker/dev-host/grafana/dashboards/futures.json +230 -0
- package/docker/dev-host/grafana/dashboards/gasoline.json +2477 -0
- package/docker/dev-host/grafana/dashboards/guard.json +1274 -0
- package/docker/dev-host/grafana/dashboards/tokio.json +1005 -0
- package/docker/dev-host/grafana/dashboards/traces.json +957 -0
- package/docker/dev-host/grafana/grafana.ini +14 -0
- package/docker/dev-host/grafana/provisioning/dashboards/dashboards.yaml +10 -0
- package/docker/dev-host/grafana/provisioning/datasources/datasources.yaml +30 -0
- package/docker/dev-host/otel-collector-client/config.yaml +39 -0
- package/docker/dev-host/otel-collector-server/config.yaml +72 -0
- package/docker/dev-host/postgres/init-db.sh +6 -0
- package/docker/dev-host/rivet-engine/config.jsonc +48 -0
- package/docker/dev-host/vector-client/vector.yaml +31 -0
- package/docker/dev-host/vector-server/vector.yaml +61 -0
- package/docker/dev-multidc/.gitattributes +1 -0
- package/docker/dev-multidc/README.md +86 -0
- package/docker/dev-multidc/core/clickhouse/client-config.xml +5 -0
- package/docker/dev-multidc/core/clickhouse/config.xml +52 -0
- package/docker/dev-multidc/core/clickhouse/init/01-create-otel-table.sql +107 -0
- package/docker/dev-multidc/core/clickhouse/users.xml +35 -0
- package/docker/dev-multidc/core/grafana/dashboards/api.json +1240 -0
- package/docker/dev-multidc/core/grafana/dashboards/cache.json +1075 -0
- package/docker/dev-multidc/core/grafana/dashboards/futures.json +230 -0
- package/docker/dev-multidc/core/grafana/dashboards/gasoline.json +2477 -0
- package/docker/dev-multidc/core/grafana/dashboards/guard.json +1274 -0
- package/docker/dev-multidc/core/grafana/dashboards/tokio.json +1005 -0
- package/docker/dev-multidc/core/grafana/dashboards/traces.json +957 -0
- package/docker/dev-multidc/core/grafana/grafana.ini +14 -0
- package/docker/dev-multidc/core/grafana/provisioning/dashboards/dashboards.yaml +10 -0
- package/docker/dev-multidc/core/grafana/provisioning/datasources/datasources.yaml +30 -0
- package/docker/dev-multidc/datacenters/dc-a/otel-collector-client/config.yaml +39 -0
- package/docker/dev-multidc/datacenters/dc-a/otel-collector-server/config.yaml +72 -0
- package/docker/dev-multidc/datacenters/dc-a/postgres/init-db.sh +6 -0
- package/docker/dev-multidc/datacenters/dc-a/rivet-engine/config.jsonc +62 -0
- package/docker/dev-multidc/datacenters/dc-a/vector-client/vector.yaml +31 -0
- package/docker/dev-multidc/datacenters/dc-a/vector-server/vector.yaml +61 -0
- package/docker/dev-multidc/datacenters/dc-b/otel-collector-client/config.yaml +39 -0
- package/docker/dev-multidc/datacenters/dc-b/otel-collector-server/config.yaml +72 -0
- package/docker/dev-multidc/datacenters/dc-b/postgres/init-db.sh +6 -0
- package/docker/dev-multidc/datacenters/dc-b/rivet-engine/config.jsonc +62 -0
- package/docker/dev-multidc/datacenters/dc-b/vector-client/vector.yaml +31 -0
- package/docker/dev-multidc/datacenters/dc-b/vector-server/vector.yaml +61 -0
- package/docker/dev-multidc/datacenters/dc-c/otel-collector-client/config.yaml +39 -0
- package/docker/dev-multidc/datacenters/dc-c/otel-collector-server/config.yaml +72 -0
- package/docker/dev-multidc/datacenters/dc-c/postgres/init-db.sh +6 -0
- package/docker/dev-multidc/datacenters/dc-c/rivet-engine/config.jsonc +62 -0
- package/docker/dev-multidc/datacenters/dc-c/vector-client/vector.yaml +31 -0
- package/docker/dev-multidc/datacenters/dc-c/vector-server/vector.yaml +61 -0
- package/docker/dev-multidc/docker-compose.yml +546 -0
- package/docker/dev-multidc-multinode/.gitattributes +1 -0
- package/docker/dev-multidc-multinode/README.md +86 -0
- package/docker/dev-multidc-multinode/core/clickhouse/client-config.xml +5 -0
- package/docker/dev-multidc-multinode/core/clickhouse/config.xml +52 -0
- package/docker/dev-multidc-multinode/core/clickhouse/init/01-create-otel-table.sql +107 -0
- package/docker/dev-multidc-multinode/core/clickhouse/users.xml +35 -0
- package/docker/dev-multidc-multinode/core/grafana/dashboards/api.json +1240 -0
- package/docker/dev-multidc-multinode/core/grafana/dashboards/cache.json +1075 -0
- package/docker/dev-multidc-multinode/core/grafana/dashboards/futures.json +230 -0
- package/docker/dev-multidc-multinode/core/grafana/dashboards/gasoline.json +2477 -0
- package/docker/dev-multidc-multinode/core/grafana/dashboards/guard.json +1274 -0
- package/docker/dev-multidc-multinode/core/grafana/dashboards/tokio.json +1005 -0
- package/docker/dev-multidc-multinode/core/grafana/dashboards/traces.json +957 -0
- package/docker/dev-multidc-multinode/core/grafana/grafana.ini +14 -0
- package/docker/dev-multidc-multinode/core/grafana/provisioning/dashboards/dashboards.yaml +10 -0
- package/docker/dev-multidc-multinode/core/grafana/provisioning/datasources/datasources.yaml +30 -0
- package/docker/dev-multidc-multinode/datacenters/dc-a/otel-collector-client/config.yaml +39 -0
- package/docker/dev-multidc-multinode/datacenters/dc-a/otel-collector-server/config.yaml +72 -0
- package/docker/dev-multidc-multinode/datacenters/dc-a/postgres/init-db.sh +6 -0
- package/docker/dev-multidc-multinode/datacenters/dc-a/rivet-engine/0/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-a/rivet-engine/1/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-a/rivet-engine/2/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-a/vector-client/vector.yaml +31 -0
- package/docker/dev-multidc-multinode/datacenters/dc-a/vector-server/vector.yaml +61 -0
- package/docker/dev-multidc-multinode/datacenters/dc-b/otel-collector-client/config.yaml +39 -0
- package/docker/dev-multidc-multinode/datacenters/dc-b/otel-collector-server/config.yaml +72 -0
- package/docker/dev-multidc-multinode/datacenters/dc-b/postgres/init-db.sh +6 -0
- package/docker/dev-multidc-multinode/datacenters/dc-b/rivet-engine/0/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-b/rivet-engine/1/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-b/rivet-engine/2/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-b/vector-client/vector.yaml +31 -0
- package/docker/dev-multidc-multinode/datacenters/dc-b/vector-server/vector.yaml +61 -0
- package/docker/dev-multidc-multinode/datacenters/dc-c/otel-collector-client/config.yaml +39 -0
- package/docker/dev-multidc-multinode/datacenters/dc-c/otel-collector-server/config.yaml +72 -0
- package/docker/dev-multidc-multinode/datacenters/dc-c/postgres/init-db.sh +6 -0
- package/docker/dev-multidc-multinode/datacenters/dc-c/rivet-engine/0/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-c/rivet-engine/1/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-c/rivet-engine/2/config.jsonc +62 -0
- package/docker/dev-multidc-multinode/datacenters/dc-c/vector-client/vector.yaml +31 -0
- package/docker/dev-multidc-multinode/datacenters/dc-c/vector-server/vector.yaml +61 -0
- package/docker/dev-multidc-multinode/docker-compose.yml +888 -0
- package/docker/dev-multinode/.gitattributes +1 -0
- package/docker/dev-multinode/README.md +74 -0
- package/docker/dev-multinode/clickhouse/client-config.xml +5 -0
- package/docker/dev-multinode/clickhouse/config.xml +52 -0
- package/docker/dev-multinode/clickhouse/init/01-create-otel-table.sql +107 -0
- package/docker/dev-multinode/clickhouse/users.xml +35 -0
- package/docker/dev-multinode/docker-compose.yml +323 -0
- package/docker/dev-multinode/grafana/dashboards/api.json +1240 -0
- package/docker/dev-multinode/grafana/dashboards/cache.json +1075 -0
- package/docker/dev-multinode/grafana/dashboards/futures.json +230 -0
- package/docker/dev-multinode/grafana/dashboards/gasoline.json +2477 -0
- package/docker/dev-multinode/grafana/dashboards/guard.json +1274 -0
- package/docker/dev-multinode/grafana/dashboards/tokio.json +1005 -0
- package/docker/dev-multinode/grafana/dashboards/traces.json +957 -0
- package/docker/dev-multinode/grafana/grafana.ini +14 -0
- package/docker/dev-multinode/grafana/provisioning/dashboards/dashboards.yaml +10 -0
- package/docker/dev-multinode/grafana/provisioning/datasources/datasources.yaml +30 -0
- package/docker/dev-multinode/otel-collector-client/config.yaml +39 -0
- package/docker/dev-multinode/otel-collector-server/config.yaml +72 -0
- package/docker/dev-multinode/postgres/init-db.sh +6 -0
- package/docker/dev-multinode/rivet-engine/0/config.jsonc +48 -0
- package/docker/dev-multinode/rivet-engine/1/config.jsonc +48 -0
- package/docker/dev-multinode/rivet-engine/2/config.jsonc +48 -0
- package/docker/dev-multinode/vector-client/vector.yaml +31 -0
- package/docker/dev-multinode/vector-server/vector.yaml +61 -0
- package/docker/engine/build.sh +67 -0
- package/docker/engine/linux-aarch64.Dockerfile +97 -0
- package/docker/engine/linux-x86_64.Dockerfile +93 -0
- package/docker/engine/macos-aarch64.Dockerfile +92 -0
- package/docker/engine/macos-x86_64.Dockerfile +92 -0
- package/docker/engine/windows.Dockerfile +80 -0
- package/docker/prod-file-system/.gitattributes +1 -0
- package/docker/prod-file-system/README.md +76 -0
- package/docker/prod-file-system/docker-compose.yml +41 -0
- package/docker/prod-file-system/rivet-engine/config.jsonc +2 -0
- package/docker/template/README.md +20 -0
- package/docker/template/grafana-dashboards/api.json +1240 -0
- package/docker/template/grafana-dashboards/cache.json +1075 -0
- package/docker/template/grafana-dashboards/futures.json +230 -0
- package/docker/template/grafana-dashboards/gasoline.json +2477 -0
- package/docker/template/grafana-dashboards/guard.json +1274 -0
- package/docker/template/grafana-dashboards/tokio.json +1005 -0
- package/docker/template/grafana-dashboards/traces.json +957 -0
- package/docker/template/node_modules/.bin/js-yaml +21 -0
- package/docker/template/node_modules/.bin/tsc +21 -0
- package/docker/template/node_modules/.bin/tsserver +21 -0
- package/docker/template/node_modules/.bin/tsx +21 -0
- package/docker/template/package.json +23 -0
- package/docker/template/src/config.ts +104 -0
- package/docker/template/src/context.ts +216 -0
- package/docker/template/src/docker-compose.ts +368 -0
- package/docker/template/src/git.ts +8 -0
- package/docker/template/src/main.ts +65 -0
- package/docker/template/src/readme.ts +98 -0
- package/docker/template/src/services/core/clickhouse.ts +223 -0
- package/docker/template/src/services/core/grafana.ts +115 -0
- package/docker/template/src/services/edge/otel-collector-client.ts +64 -0
- package/docker/template/src/services/edge/otel-collector-server.ts +107 -0
- package/docker/template/src/services/edge/postgres.ts +23 -0
- package/docker/template/src/services/edge/rivet-engine.ts +87 -0
- package/docker/template/src/services/edge/runner.ts +7 -0
- package/docker/template/src/services/edge/vector-client.ts +55 -0
- package/docker/template/src/services/edge/vector-server.ts +111 -0
- package/docker/template/src/utils.ts +19 -0
- package/docker/template/tsconfig.json +18 -0
- package/docker/universal/Dockerfile +133 -0
- package/package.json +10 -0
- package/packages/actor-kv/Cargo.toml +31 -0
- package/packages/actor-kv/src/entry.rs +147 -0
- package/packages/actor-kv/src/key.rs +81 -0
- package/packages/actor-kv/src/lib.rs +357 -0
- package/packages/actor-kv/src/utils.rs +101 -0
- package/packages/actor-kv/tests/kv_operations.rs +294 -0
- package/packages/actor-kv/tests/list_edge_cases.rs +370 -0
- package/packages/api-builder/Cargo.toml +36 -0
- package/packages/api-builder/src/context.rs +98 -0
- package/packages/api-builder/src/error_response.rs +116 -0
- package/packages/api-builder/src/errors.rs +29 -0
- package/packages/api-builder/src/extract.rs +137 -0
- package/packages/api-builder/src/global_context.rs +31 -0
- package/packages/api-builder/src/lib.rs +19 -0
- package/packages/api-builder/src/metrics.rs +29 -0
- package/packages/api-builder/src/middleware.rs +232 -0
- package/packages/api-builder/src/prelude.rs +18 -0
- package/packages/api-builder/src/request_ids.rs +17 -0
- package/packages/api-builder/src/router.rs +89 -0
- package/packages/api-builder/src/wrappers.rs +138 -0
- package/packages/api-builder/tests/basic.rs +215 -0
- package/packages/api-builder/tests/errors.rs +104 -0
- package/packages/api-peer/Cargo.toml +34 -0
- package/packages/api-peer/src/actors/create.rs +40 -0
- package/packages/api-peer/src/actors/delete.rs +87 -0
- package/packages/api-peer/src/actors/kv_get.rs +67 -0
- package/packages/api-peer/src/actors/list.rs +98 -0
- package/packages/api-peer/src/actors/list_names.rs +56 -0
- package/packages/api-peer/src/actors/mod.rs +5 -0
- package/packages/api-peer/src/internal.rs +186 -0
- package/packages/api-peer/src/lib.rs +28 -0
- package/packages/api-peer/src/namespaces.rs +122 -0
- package/packages/api-peer/src/router.rs +51 -0
- package/packages/api-peer/src/runner_configs.rs +160 -0
- package/packages/api-peer/src/runners.rs +109 -0
- package/packages/api-public/Cargo.toml +38 -0
- package/packages/api-public/build.rs +45 -0
- package/packages/api-public/src/actors/create.rs +99 -0
- package/packages/api-public/src/actors/delete.rs +86 -0
- package/packages/api-public/src/actors/get_or_create.rs +170 -0
- package/packages/api-public/src/actors/kv_get.rs +79 -0
- package/packages/api-public/src/actors/list.rs +241 -0
- package/packages/api-public/src/actors/list_names.rs +76 -0
- package/packages/api-public/src/actors/mod.rs +7 -0
- package/packages/api-public/src/actors/utils.rs +216 -0
- package/packages/api-public/src/ctx.rs +70 -0
- package/packages/api-public/src/datacenters.rs +43 -0
- package/packages/api-public/src/errors.rs +30 -0
- package/packages/api-public/src/health.rs +166 -0
- package/packages/api-public/src/lib.rs +13 -0
- package/packages/api-public/src/metadata.rs +24 -0
- package/packages/api-public/src/namespaces.rs +89 -0
- package/packages/api-public/src/router.rs +182 -0
- package/packages/api-public/src/runner_configs/delete.rs +99 -0
- package/packages/api-public/src/runner_configs/list.rs +98 -0
- package/packages/api-public/src/runner_configs/mod.rs +12 -0
- package/packages/api-public/src/runner_configs/refresh_metadata.rs +116 -0
- package/packages/api-public/src/runner_configs/serverless_health_check.rs +81 -0
- package/packages/api-public/src/runner_configs/upsert.rs +194 -0
- package/packages/api-public/src/runner_configs/utils.rs +217 -0
- package/packages/api-public/src/runners.rs +144 -0
- package/packages/api-public/src/ui.rs +44 -0
- package/packages/api-types/Cargo.toml +17 -0
- package/packages/api-types/src/actors/create.rs +29 -0
- package/packages/api-types/src/actors/list.rs +23 -0
- package/packages/api-types/src/actors/list_names.rs +24 -0
- package/packages/api-types/src/actors/mod.rs +3 -0
- package/packages/api-types/src/datacenters/list.rs +12 -0
- package/packages/api-types/src/datacenters/mod.rs +1 -0
- package/packages/api-types/src/lib.rs +6 -0
- package/packages/api-types/src/namespaces/list.rs +21 -0
- package/packages/api-types/src/namespaces/mod.rs +2 -0
- package/packages/api-types/src/namespaces/runner_configs.rs +55 -0
- package/packages/api-types/src/pagination.rs +8 -0
- package/packages/api-types/src/runner_configs/list.rs +29 -0
- package/packages/api-types/src/runner_configs/mod.rs +1 -0
- package/packages/api-types/src/runners/list.rs +25 -0
- package/packages/api-types/src/runners/mod.rs +1 -0
- package/packages/api-util/Cargo.toml +22 -0
- package/packages/api-util/src/errors.rs +9 -0
- package/packages/api-util/src/lib.rs +209 -0
- package/packages/bootstrap/Cargo.toml +19 -0
- package/packages/bootstrap/src/lib.rs +102 -0
- package/packages/cache/Cargo.toml +28 -0
- package/packages/cache/src/driver.rs +346 -0
- package/packages/cache/src/errors.rs +23 -0
- package/packages/cache/src/getter_ctx.rs +138 -0
- package/packages/cache/src/inner.rs +60 -0
- package/packages/cache/src/key.rs +101 -0
- package/packages/cache/src/lib.rs +19 -0
- package/packages/cache/src/metrics.rs +34 -0
- package/packages/cache/src/purge.rs +13 -0
- package/packages/cache/src/rate_limit.rs +109 -0
- package/packages/cache/src/req_config.rs +443 -0
- package/packages/cache/tests/integration.rs +582 -0
- package/packages/cache-purge/Cargo.toml +17 -0
- package/packages/cache-purge/src/lib.rs +44 -0
- package/packages/cache-result/Cargo.toml +9 -0
- package/packages/cache-result/src/lib.rs +61 -0
- package/packages/clickhouse-inserter/Cargo.toml +17 -0
- package/packages/clickhouse-inserter/src/error.rs +16 -0
- package/packages/clickhouse-inserter/src/lib.rs +179 -0
- package/packages/clickhouse-user-query/Cargo.toml +16 -0
- package/packages/clickhouse-user-query/examples/case_sensitivity_demo.rs +100 -0
- package/packages/clickhouse-user-query/examples/group_by_example.rs +53 -0
- package/packages/clickhouse-user-query/examples/string_contains_demo.rs +96 -0
- package/packages/clickhouse-user-query/src/builder.rs +445 -0
- package/packages/clickhouse-user-query/src/error.rs +37 -0
- package/packages/clickhouse-user-query/src/lib.rs +61 -0
- package/packages/clickhouse-user-query/src/query.rs +143 -0
- package/packages/clickhouse-user-query/src/schema.rs +78 -0
- package/packages/clickhouse-user-query/tests/builder_tests.rs +619 -0
- package/packages/clickhouse-user-query/tests/case_sensitivity_tests.rs +307 -0
- package/packages/clickhouse-user-query/tests/integration_tests.rs +540 -0
- package/packages/clickhouse-user-query/tests/query_tests.rs +263 -0
- package/packages/clickhouse-user-query/tests/schema_tests.rs +44 -0
- package/packages/config/Cargo.toml +20 -0
- package/packages/config/src/config/api_peer.rs +21 -0
- package/packages/config/src/config/api_public.rs +25 -0
- package/packages/config/src/config/auth.rs +10 -0
- package/packages/config/src/config/cache.rs +24 -0
- package/packages/config/src/config/clickhouse.rs +49 -0
- package/packages/config/src/config/db.rs +52 -0
- package/packages/config/src/config/guard.rs +42 -0
- package/packages/config/src/config/logs.rs +10 -0
- package/packages/config/src/config/mod.rs +240 -0
- package/packages/config/src/config/pegboard.rs +94 -0
- package/packages/config/src/config/pubsub.rs +90 -0
- package/packages/config/src/config/runtime.rs +31 -0
- package/packages/config/src/config/telemetry.rs +14 -0
- package/packages/config/src/config/topology.rs +123 -0
- package/packages/config/src/config/vector.rs +18 -0
- package/packages/config/src/defaults.rs +11 -0
- package/packages/config/src/lib.rs +135 -0
- package/packages/config/src/paths.rs +25 -0
- package/packages/config/src/secret.rs +72 -0
- package/packages/dump-openapi/Cargo.toml +11 -0
- package/packages/dump-openapi/build.rs +26 -0
- package/packages/dump-openapi/src/lib.rs +1 -0
- package/packages/engine/Cargo.toml +74 -0
- package/packages/engine/src/commands/config.rs +18 -0
- package/packages/engine/src/commands/db/mod.rs +80 -0
- package/packages/engine/src/commands/mod.rs +7 -0
- package/packages/engine/src/commands/start.rs +143 -0
- package/packages/engine/src/commands/tracing.rs +86 -0
- package/packages/engine/src/commands/udb/cli.rs +562 -0
- package/packages/engine/src/commands/udb/mod.rs +132 -0
- package/packages/engine/src/commands/udb_keys.rs +200 -0
- package/packages/engine/src/commands/wf/mod.rs +125 -0
- package/packages/engine/src/commands/wf/signal.rs +80 -0
- package/packages/engine/src/keys.rs +47 -0
- package/packages/engine/src/lib.rs +55 -0
- package/packages/engine/src/main.rs +60 -0
- package/packages/engine/src/run_config.rs +53 -0
- package/packages/engine/src/util/db.rs +99 -0
- package/packages/engine/src/util/format.rs +69 -0
- package/packages/engine/src/util/mod.rs +13 -0
- package/packages/engine/src/util/udb.rs +687 -0
- package/packages/engine/src/util/wf/mod.rs +649 -0
- package/packages/engine/src/util/wf/signal.rs +126 -0
- package/packages/engine/tests/actors_create.rs +524 -0
- package/packages/engine/tests/actors_delete.rs +243 -0
- package/packages/engine/tests/actors_general.rs +191 -0
- package/packages/engine/tests/actors_get.rs +230 -0
- package/packages/engine/tests/actors_get_by_id.rs +170 -0
- package/packages/engine/tests/actors_get_or_create.rs +294 -0
- package/packages/engine/tests/actors_get_or_create_by_id.rs +147 -0
- package/packages/engine/tests/actors_lifecycle.rs +165 -0
- package/packages/engine/tests/actors_list.rs +798 -0
- package/packages/engine/tests/actors_list_names.rs +353 -0
- package/packages/engine/tests/common/actors.rs +554 -0
- package/packages/engine/tests/common/ctx.rs +201 -0
- package/packages/engine/tests/common/mod.rs +30 -0
- package/packages/engine/tests/common/ns.rs +36 -0
- package/packages/engine/tests/common/runner.rs +134 -0
- package/packages/engine/tests/common/test_helpers.rs +226 -0
- package/packages/engine/tests/runners_dupe_key.rs +27 -0
- package/packages/engine/tests/runners_version.rs +50 -0
- package/packages/env/Cargo.toml +14 -0
- package/packages/env/build.rs +8 -0
- package/packages/env/src/lib.rs +30 -0
- package/packages/epoxy/Cargo.toml +45 -0
- package/packages/epoxy/README.md +158 -0
- package/packages/epoxy/spec/KEYS.md +33 -0
- package/packages/epoxy/spec/PROPOSAL.md +125 -0
- package/packages/epoxy/spec/RECONFIGURE.md +40 -0
- package/packages/epoxy/src/consts.rs +42 -0
- package/packages/epoxy/src/errors.rs +21 -0
- package/packages/epoxy/src/http_client.rs +192 -0
- package/packages/epoxy/src/http_routes.rs +34 -0
- package/packages/epoxy/src/keys/keys.rs +99 -0
- package/packages/epoxy/src/keys/mod.rs +9 -0
- package/packages/epoxy/src/keys/replica.rs +283 -0
- package/packages/epoxy/src/lib.rs +25 -0
- package/packages/epoxy/src/ops/explicit_prepare.rs +342 -0
- package/packages/epoxy/src/ops/kv/get_local.rs +44 -0
- package/packages/epoxy/src/ops/kv/get_optimistic.rs +150 -0
- package/packages/epoxy/src/ops/kv/mod.rs +3 -0
- package/packages/epoxy/src/ops/kv/purge_local.rs +28 -0
- package/packages/epoxy/src/ops/mod.rs +4 -0
- package/packages/epoxy/src/ops/propose.rs +352 -0
- package/packages/epoxy/src/ops/read_cluster_config.rs +24 -0
- package/packages/epoxy/src/replica/ballot.rs +130 -0
- package/packages/epoxy/src/replica/commit_kv.rs +80 -0
- package/packages/epoxy/src/replica/decide_path.rs +51 -0
- package/packages/epoxy/src/replica/lead_consensus.rs +65 -0
- package/packages/epoxy/src/replica/log.rs +84 -0
- package/packages/epoxy/src/replica/message_request.rs +166 -0
- package/packages/epoxy/src/replica/messages/accept.rs +50 -0
- package/packages/epoxy/src/replica/messages/accepted.rs +35 -0
- package/packages/epoxy/src/replica/messages/commit.rs +46 -0
- package/packages/epoxy/src/replica/messages/committed.rs +41 -0
- package/packages/epoxy/src/replica/messages/download_instances.rs +69 -0
- package/packages/epoxy/src/replica/messages/mod.rs +15 -0
- package/packages/epoxy/src/replica/messages/pre_accept.rs +69 -0
- package/packages/epoxy/src/replica/messages/prepare.rs +89 -0
- package/packages/epoxy/src/replica/mod.rs +11 -0
- package/packages/epoxy/src/replica/update_config.rs +24 -0
- package/packages/epoxy/src/replica/utils.rs +111 -0
- package/packages/epoxy/src/types.rs +117 -0
- package/packages/epoxy/src/utils.rs +65 -0
- package/packages/epoxy/src/workflows/coordinator/mod.rs +121 -0
- package/packages/epoxy/src/workflows/coordinator/reconfigure.rs +291 -0
- package/packages/epoxy/src/workflows/coordinator/replica_status_change.rs +193 -0
- package/packages/epoxy/src/workflows/mod.rs +3 -0
- package/packages/epoxy/src/workflows/purger.rs +81 -0
- package/packages/epoxy/src/workflows/replica/mod.rs +39 -0
- package/packages/epoxy/src/workflows/replica/setup.rs +823 -0
- package/packages/epoxy/tests/common/api.rs +25 -0
- package/packages/epoxy/tests/common/mod.rs +301 -0
- package/packages/epoxy/tests/common/utils.rs +23 -0
- package/packages/epoxy/tests/kv.rs +187 -0
- package/packages/epoxy/tests/kv_get_optimistic.rs +179 -0
- package/packages/epoxy/tests/proposal.rs +38 -0
- package/packages/epoxy/tests/reconfigure.rs +618 -0
- package/packages/error/Cargo.toml +16 -0
- package/packages/error/src/error.rs +90 -0
- package/packages/error/src/lib.rs +13 -0
- package/packages/error/src/schema.rs +86 -0
- package/packages/error/tests/basic.rs +338 -0
- package/packages/error-macros/Cargo.toml +19 -0
- package/packages/error-macros/src/lib.rs +632 -0
- package/packages/gasoline/Cargo.toml +55 -0
- package/packages/gasoline/src/activity.rs +24 -0
- package/packages/gasoline/src/builder/common/message.rs +104 -0
- package/packages/gasoline/src/builder/common/mod.rs +5 -0
- package/packages/gasoline/src/builder/common/signal.rs +193 -0
- package/packages/gasoline/src/builder/common/workflow.rs +196 -0
- package/packages/gasoline/src/builder/mod.rs +60 -0
- package/packages/gasoline/src/builder/workflow/message.rs +147 -0
- package/packages/gasoline/src/builder/workflow/mod.rs +5 -0
- package/packages/gasoline/src/builder/workflow/signal.rs +227 -0
- package/packages/gasoline/src/builder/workflow/sub_workflow.rs +318 -0
- package/packages/gasoline/src/ctx/activity.rs +192 -0
- package/packages/gasoline/src/ctx/common.rs +153 -0
- package/packages/gasoline/src/ctx/listen.rs +121 -0
- package/packages/gasoline/src/ctx/message.rs +346 -0
- package/packages/gasoline/src/ctx/mod.rs +18 -0
- package/packages/gasoline/src/ctx/operation.rs +191 -0
- package/packages/gasoline/src/ctx/standalone.rs +228 -0
- package/packages/gasoline/src/ctx/test.rs +251 -0
- package/packages/gasoline/src/ctx/versioned_workflow.rs +198 -0
- package/packages/gasoline/src/ctx/workflow.rs +1459 -0
- package/packages/gasoline/src/db/debug.rs +199 -0
- package/packages/gasoline/src/db/kv/debug.rs +1493 -0
- package/packages/gasoline/src/db/kv/keys/history.rs +1780 -0
- package/packages/gasoline/src/db/kv/keys/metric.rs +170 -0
- package/packages/gasoline/src/db/kv/keys/mod.rs +6 -0
- package/packages/gasoline/src/db/kv/keys/signal.rs +401 -0
- package/packages/gasoline/src/db/kv/keys/wake.rs +310 -0
- package/packages/gasoline/src/db/kv/keys/worker.rs +185 -0
- package/packages/gasoline/src/db/kv/keys/workflow.rs +1175 -0
- package/packages/gasoline/src/db/kv/mod.rs +3044 -0
- package/packages/gasoline/src/db/kv/subjects.rs +13 -0
- package/packages/gasoline/src/db/kv/system.rs +33 -0
- package/packages/gasoline/src/db/mod.rs +344 -0
- package/packages/gasoline/src/error.rs +258 -0
- package/packages/gasoline/src/executable.rs +186 -0
- package/packages/gasoline/src/history/cursor.rs +779 -0
- package/packages/gasoline/src/history/event.rs +210 -0
- package/packages/gasoline/src/history/location.rs +185 -0
- package/packages/gasoline/src/history/mod.rs +8 -0
- package/packages/gasoline/src/history/removed.rs +94 -0
- package/packages/gasoline/src/lib.rs +18 -0
- package/packages/gasoline/src/listen.rs +24 -0
- package/packages/gasoline/src/message.rs +103 -0
- package/packages/gasoline/src/metrics.rs +156 -0
- package/packages/gasoline/src/operation.rs +21 -0
- package/packages/gasoline/src/prelude.rs +53 -0
- package/packages/gasoline/src/registry.rs +111 -0
- package/packages/gasoline/src/signal.rs +117 -0
- package/packages/gasoline/src/stub.rs +118 -0
- package/packages/gasoline/src/utils/mod.rs +20 -0
- package/packages/gasoline/src/utils/tags.rs +82 -0
- package/packages/gasoline/src/utils/time.rs +85 -0
- package/packages/gasoline/src/worker.rs +336 -0
- package/packages/gasoline/src/workflow.rs +64 -0
- package/packages/gasoline/tests/activity_ctx.rs +83 -0
- package/packages/gasoline/tests/workflow_ctx.rs +288 -0
- package/packages/gasoline/tests/workflows/activity_test.rs +33 -0
- package/packages/gasoline/tests/workflows/basic.rs +13 -0
- package/packages/gasoline/tests/workflows/eviction_test.rs +45 -0
- package/packages/gasoline/tests/workflows/listen_timeout.rs +27 -0
- package/packages/gasoline/tests/workflows/loop_test.rs +30 -0
- package/packages/gasoline/tests/workflows/mod.rs +11 -0
- package/packages/gasoline/tests/workflows/properties_test.rs +56 -0
- package/packages/gasoline/tests/workflows/signal_test.rs +24 -0
- package/packages/gasoline/tests/workflows/sleep_test.rs +15 -0
- package/packages/gasoline/tests/workflows/state_test.rs +69 -0
- package/packages/gasoline/tests/workflows/sub_test.rs +21 -0
- package/packages/gasoline/tests/workflows/tags_test.rs +40 -0
- package/packages/gasoline-macros/Cargo.toml +14 -0
- package/packages/gasoline-macros/src/lib.rs +527 -0
- package/packages/guard/Cargo.toml +56 -0
- package/packages/guard/src/cache/actor.rs +43 -0
- package/packages/guard/src/cache/mod.rs +69 -0
- package/packages/guard/src/errors.rs +62 -0
- package/packages/guard/src/lib.rs +58 -0
- package/packages/guard/src/middleware.rs +42 -0
- package/packages/guard/src/routing/api_public.rs +70 -0
- package/packages/guard/src/routing/mod.rs +245 -0
- package/packages/guard/src/routing/pegboard_gateway.rs +260 -0
- package/packages/guard/src/routing/runner.rs +129 -0
- package/packages/guard/src/shared_state.rs +31 -0
- package/packages/guard/src/tls.rs +224 -0
- package/packages/guard/tests/parse_actor_path.rs +240 -0
- package/packages/guard-core/Cargo.toml +58 -0
- package/packages/guard-core/src/analytics.rs +46 -0
- package/packages/guard-core/src/cert_resolver.rs +61 -0
- package/packages/guard-core/src/custom_serve.rs +52 -0
- package/packages/guard-core/src/errors.rs +113 -0
- package/packages/guard-core/src/lib.rs +25 -0
- package/packages/guard-core/src/metrics.rs +64 -0
- package/packages/guard-core/src/proxy_service.rs +2699 -0
- package/packages/guard-core/src/request_context.rs +184 -0
- package/packages/guard-core/src/server.rs +289 -0
- package/packages/guard-core/src/task_group.rs +57 -0
- package/packages/guard-core/src/types.rs +19 -0
- package/packages/guard-core/src/websocket_handle.rs +47 -0
- package/packages/guard-core/tests/common/mod.rs +678 -0
- package/packages/guard-core/tests/custom_serve.rs +392 -0
- package/packages/guard-core/tests/fixtures/tls/README.md +6 -0
- package/packages/guard-core/tests/fixtures/tls/api_cert.pem +51 -0
- package/packages/guard-core/tests/fixtures/tls/api_key.pem +7 -0
- package/packages/guard-core/tests/fixtures/tls/job_cert.pem +55 -0
- package/packages/guard-core/tests/fixtures/tls/job_key.pem +7 -0
- package/packages/guard-core/tests/https.rs +400 -0
- package/packages/guard-core/tests/metrics.rs +247 -0
- package/packages/guard-core/tests/proxy.rs +842 -0
- package/packages/guard-core/tests/simple_websocket.rs +258 -0
- package/packages/guard-core/tests/simple_websocket_echo.rs +318 -0
- package/packages/guard-core/tests/simple_websocket_test2.rs +120 -0
- package/packages/guard-core/tests/streaming_response.rs +265 -0
- package/packages/guard-core/tests/websocket.rs +1113 -0
- package/packages/internal/Cargo.toml +13 -0
- package/packages/internal/README.md +1 -0
- package/packages/internal/src/lib.rs +1 -0
- package/packages/internal/src/ops/bump_serverless_autoscaler_global.rs +64 -0
- package/packages/internal/src/ops/cache/mod.rs +1 -0
- package/packages/internal/src/ops/cache/purge_global.rs +81 -0
- package/packages/internal/src/ops/mod.rs +2 -0
- package/packages/logs/Cargo.toml +20 -0
- package/packages/logs/src/lib.rs +9 -0
- package/packages/logs/src/unix.rs +201 -0
- package/packages/logs/src/windows.rs +240 -0
- package/packages/metrics/Cargo.toml +20 -0
- package/packages/metrics/src/buckets.rs +32 -0
- package/packages/metrics/src/lib.rs +8 -0
- package/packages/metrics/src/providers.rs +183 -0
- package/packages/namespace/Cargo.toml +28 -0
- package/packages/namespace/src/errors.rs +39 -0
- package/packages/namespace/src/keys/mod.rs +190 -0
- package/packages/namespace/src/keys/runner_config.rs +211 -0
- package/packages/namespace/src/lib.rs +16 -0
- package/packages/namespace/src/ops/get_global.rs +58 -0
- package/packages/namespace/src/ops/get_local.rs +69 -0
- package/packages/namespace/src/ops/list.rs +69 -0
- package/packages/namespace/src/ops/mod.rs +6 -0
- package/packages/namespace/src/ops/resolve_for_name_global.rs +57 -0
- package/packages/namespace/src/ops/resolve_for_name_local.rs +41 -0
- package/packages/namespace/src/ops/runner_config/delete.rs +53 -0
- package/packages/namespace/src/ops/runner_config/get.rs +94 -0
- package/packages/namespace/src/ops/runner_config/list.rs +94 -0
- package/packages/namespace/src/ops/runner_config/mod.rs +4 -0
- package/packages/namespace/src/ops/runner_config/upsert.rs +148 -0
- package/packages/namespace/src/utils.rs +11 -0
- package/packages/namespace/src/workflows/mod.rs +1 -0
- package/packages/namespace/src/workflows/namespace.rs +178 -0
- package/packages/pegboard/Cargo.toml +34 -0
- package/packages/pegboard/src/errors.rs +76 -0
- package/packages/pegboard/src/keys/actor.rs +443 -0
- package/packages/pegboard/src/keys/epoxy/mod.rs +1 -0
- package/packages/pegboard/src/keys/epoxy/ns.rs +68 -0
- package/packages/pegboard/src/keys/hibernating_request.rs +72 -0
- package/packages/pegboard/src/keys/mod.rs +15 -0
- package/packages/pegboard/src/keys/ns.rs +1367 -0
- package/packages/pegboard/src/keys/runner.rs +818 -0
- package/packages/pegboard/src/lib.rs +19 -0
- package/packages/pegboard/src/metrics.rs +19 -0
- package/packages/pegboard/src/ops/actor/create.rs +159 -0
- package/packages/pegboard/src/ops/actor/get.rs +100 -0
- package/packages/pegboard/src/ops/actor/get_for_gateway.rs +70 -0
- package/packages/pegboard/src/ops/actor/get_for_key.rs +93 -0
- package/packages/pegboard/src/ops/actor/get_reservation_for_key.rs +46 -0
- package/packages/pegboard/src/ops/actor/get_runner.rs +64 -0
- package/packages/pegboard/src/ops/actor/hibernating_request/delete.rs +41 -0
- package/packages/pegboard/src/ops/actor/hibernating_request/list.rs +65 -0
- package/packages/pegboard/src/ops/actor/hibernating_request/mod.rs +3 -0
- package/packages/pegboard/src/ops/actor/hibernating_request/upsert.rs +51 -0
- package/packages/pegboard/src/ops/actor/list_for_ns.rs +207 -0
- package/packages/pegboard/src/ops/actor/list_names.rs +62 -0
- package/packages/pegboard/src/ops/actor/mod.rs +9 -0
- package/packages/pegboard/src/ops/mod.rs +2 -0
- package/packages/pegboard/src/ops/runner/find_dc_with_runner.rs +222 -0
- package/packages/pegboard/src/ops/runner/get.rs +143 -0
- package/packages/pegboard/src/ops/runner/get_by_key.rs +51 -0
- package/packages/pegboard/src/ops/runner/list_for_ns.rs +209 -0
- package/packages/pegboard/src/ops/runner/list_names.rs +60 -0
- package/packages/pegboard/src/ops/runner/mod.rs +6 -0
- package/packages/pegboard/src/ops/runner/update_alloc_idx.rs +208 -0
- package/packages/pegboard/src/pubsub_subjects.rs +80 -0
- package/packages/pegboard/src/utils.rs +29 -0
- package/packages/pegboard/src/workflows/actor/destroy.rs +264 -0
- package/packages/pegboard/src/workflows/actor/keys.rs +283 -0
- package/packages/pegboard/src/workflows/actor/mod.rs +804 -0
- package/packages/pegboard/src/workflows/actor/runtime.rs +909 -0
- package/packages/pegboard/src/workflows/actor/setup.rs +175 -0
- package/packages/pegboard/src/workflows/mod.rs +2 -0
- package/packages/pegboard/src/workflows/runner.rs +1182 -0
- package/packages/pegboard-gateway/Cargo.toml +35 -0
- package/packages/pegboard-gateway/src/keepalive_task.rs +61 -0
- package/packages/pegboard-gateway/src/lib.rs +698 -0
- package/packages/pegboard-gateway/src/metrics.rs +14 -0
- package/packages/pegboard-gateway/src/ping_task.rs +23 -0
- package/packages/pegboard-gateway/src/shared_state.rs +588 -0
- package/packages/pegboard-gateway/src/tunnel_to_ws_task.rs +85 -0
- package/packages/pegboard-gateway/src/ws_to_tunnel_task.rs +65 -0
- package/packages/pegboard-runner/Cargo.toml +38 -0
- package/packages/pegboard-runner/src/conn.rs +183 -0
- package/packages/pegboard-runner/src/errors.rs +33 -0
- package/packages/pegboard-runner/src/lib.rs +249 -0
- package/packages/pegboard-runner/src/ping_task.rs +66 -0
- package/packages/pegboard-runner/src/tunnel_to_ws_task.rs +137 -0
- package/packages/pegboard-runner/src/utils.rs +40 -0
- package/packages/pegboard-runner/src/ws_to_tunnel_task.rs +443 -0
- package/packages/pegboard-serverless/Cargo.toml +25 -0
- package/packages/pegboard-serverless/src/lib.rs +523 -0
- package/packages/pools/Cargo.toml +38 -0
- package/packages/pools/src/db/clickhouse.rs +37 -0
- package/packages/pools/src/db/mod.rs +3 -0
- package/packages/pools/src/db/udb.rs +37 -0
- package/packages/pools/src/db/ups.rs +91 -0
- package/packages/pools/src/error.rs +41 -0
- package/packages/pools/src/lib.rs +16 -0
- package/packages/pools/src/metrics.rs +32 -0
- package/packages/pools/src/pools.rs +114 -0
- package/packages/pools/src/prelude.rs +3 -0
- package/packages/pools/src/reqwest.rs +25 -0
- package/packages/runtime/Cargo.lock +1394 -0
- package/packages/runtime/Cargo.toml +29 -0
- package/packages/runtime/src/lib.rs +154 -0
- package/packages/runtime/src/metrics.rs +34 -0
- package/packages/runtime/src/term_signal.rs +113 -0
- package/packages/runtime/src/traces.rs +158 -0
- package/packages/service-manager/Cargo.toml +19 -0
- package/packages/service-manager/src/lib.rs +359 -0
- package/packages/telemetry/Cargo.toml +13 -0
- package/packages/telemetry/README.md +12 -0
- package/packages/telemetry/src/lib.rs +39 -0
- package/packages/test-deps/Cargo.toml +19 -0
- package/packages/test-deps/src/datacenter.rs +109 -0
- package/packages/test-deps/src/lib.rs +131 -0
- package/packages/test-deps-docker/Cargo.toml +14 -0
- package/packages/test-deps-docker/src/database.rs +135 -0
- package/packages/test-deps-docker/src/lib.rs +280 -0
- package/packages/test-deps-docker/src/pubsub.rs +76 -0
- package/packages/tracing-reconfigure/Cargo.toml +18 -0
- package/packages/tracing-reconfigure/src/lib.rs +78 -0
- package/packages/tracing-utils/Cargo.toml +12 -0
- package/packages/tracing-utils/src/lib.rs +91 -0
- package/packages/types/Cargo.toml +19 -0
- package/packages/types/README.md +3 -0
- package/packages/types/src/actors.rs +79 -0
- package/packages/types/src/datacenters.rs +10 -0
- package/packages/types/src/keys/mod.rs +2 -0
- package/packages/types/src/keys/namespace/mod.rs +1 -0
- package/packages/types/src/keys/namespace/runner_config.rs +28 -0
- package/packages/types/src/keys/pegboard/mod.rs +7 -0
- package/packages/types/src/keys/pegboard/ns.rs +109 -0
- package/packages/types/src/lib.rs +7 -0
- package/packages/types/src/msgs/mod.rs +1 -0
- package/packages/types/src/msgs/pegboard.rs +5 -0
- package/packages/types/src/namespaces.rs +10 -0
- package/packages/types/src/runner_configs.rs +96 -0
- package/packages/types/src/runners.rs +24 -0
- package/packages/universaldb/Cargo.toml +32 -0
- package/packages/universaldb/src/atomic.rs +190 -0
- package/packages/universaldb/src/database.rs +56 -0
- package/packages/universaldb/src/driver/mod.rs +87 -0
- package/packages/universaldb/src/driver/postgres/database.rs +244 -0
- package/packages/universaldb/src/driver/postgres/mod.rs +5 -0
- package/packages/universaldb/src/driver/postgres/transaction.rs +337 -0
- package/packages/universaldb/src/driver/postgres/transaction_task.rs +538 -0
- package/packages/universaldb/src/driver/rocksdb/database.rs +129 -0
- package/packages/universaldb/src/driver/rocksdb/mod.rs +6 -0
- package/packages/universaldb/src/driver/rocksdb/transaction.rs +354 -0
- package/packages/universaldb/src/driver/rocksdb/transaction_conflict_tracker.rs +109 -0
- package/packages/universaldb/src/driver/rocksdb/transaction_task.rs +526 -0
- package/packages/universaldb/src/error.rs +30 -0
- package/packages/universaldb/src/key_selector.rs +97 -0
- package/packages/universaldb/src/lib.rs +24 -0
- package/packages/universaldb/src/metrics.rs +27 -0
- package/packages/universaldb/src/options.rs +284 -0
- package/packages/universaldb/src/prelude.rs +8 -0
- package/packages/universaldb/src/range_option.rs +159 -0
- package/packages/universaldb/src/transaction.rs +378 -0
- package/packages/universaldb/src/tx_ops.rs +425 -0
- package/packages/universaldb/src/utils/cherry_pick.rs +88 -0
- package/packages/universaldb/src/utils/codes.rs +9 -0
- package/packages/universaldb/src/utils/ext.rs +58 -0
- package/packages/universaldb/src/utils/formal_key.rs +23 -0
- package/packages/universaldb/src/utils/keys.rs +134 -0
- package/packages/universaldb/src/utils/mod.rs +92 -0
- package/packages/universaldb/src/utils/subspace.rs +95 -0
- package/packages/universaldb/src/value.rs +159 -0
- package/packages/universaldb/src/versionstamp.rs +173 -0
- package/packages/universaldb/tests/integration.rs +2733 -0
- package/packages/universaldb/tests/integration_gas.rs +264 -0
- package/packages/universaldb/tests/rocksdb.rs +141 -0
- package/packages/universaldb/tests/versionstamp.rs +184 -0
- package/packages/universalpubsub/Cargo.toml +38 -0
- package/packages/universalpubsub/benches/simple.rs +932 -0
- package/packages/universalpubsub/src/chunking.rs +226 -0
- package/packages/universalpubsub/src/driver/memory/mod.rs +91 -0
- package/packages/universalpubsub/src/driver/mod.rs +58 -0
- package/packages/universalpubsub/src/driver/nats/mod.rs +79 -0
- package/packages/universalpubsub/src/driver/postgres/mod.rs +443 -0
- package/packages/universalpubsub/src/errors.rs +11 -0
- package/packages/universalpubsub/src/lib.rs +7 -0
- package/packages/universalpubsub/src/pubsub.rs +415 -0
- package/packages/universalpubsub/tests/integration.rs +441 -0
- package/packages/universalpubsub/tests/reconnect.rs +359 -0
- package/packages/util/Cargo.toml +41 -0
- package/packages/util/build.rs +13 -0
- package/packages/util/src/backoff.rs +109 -0
- package/packages/util/src/billing.rs +3 -0
- package/packages/util/src/build_meta.rs +33 -0
- package/packages/util/src/check.rs +222 -0
- package/packages/util/src/duration.rs +77 -0
- package/packages/util/src/faker.rs +81 -0
- package/packages/util/src/format.rs +185 -0
- package/packages/util/src/future.rs +1 -0
- package/packages/util/src/geo.rs +5 -0
- package/packages/util/src/lib.rs +40 -0
- package/packages/util/src/math.rs +35 -0
- package/packages/util/src/req.rs +41 -0
- package/packages/util/src/serde.rs +516 -0
- package/packages/util/src/size.rs +27 -0
- package/packages/util/src/sort.rs +13 -0
- package/packages/util/src/timestamp.rs +58 -0
- package/packages/util/src/url.rs +3 -0
- package/packages/util-id/Cargo.toml +13 -0
- package/packages/util-id/src/lib.rs +329 -0
- package/packages/workflow-worker/Cargo.toml +16 -0
- package/packages/workflow-worker/src/lib.rs +15 -0
- package/sdks/api/fern/fern.config.json +4 -0
- package/sdks/api/fern/generators.yml +25 -0
- package/sdks/go/api-full/client/client.go +459 -0
- package/sdks/go/api-full/client/client_test.go +43 -0
- package/sdks/go/api-full/client/options.go +39 -0
- package/sdks/go/api-full/core/client_option.go +44 -0
- package/sdks/go/api-full/core/core.go +220 -0
- package/sdks/go/api-full/core/core_test.go +219 -0
- package/sdks/go/api-full/core/stringer.go +13 -0
- package/sdks/go/api-full/datacenters/client.go +50 -0
- package/sdks/go/api-full/go.mod +8 -0
- package/sdks/go/api-full/go.sum +12 -0
- package/sdks/go/api-full/health/client.go +50 -0
- package/sdks/go/api-full/namespaces/client.go +92 -0
- package/sdks/go/api-full/namespaces.go +15 -0
- package/sdks/go/api-full/pointer.go +103 -0
- package/sdks/go/api-full/runners/client.go +111 -0
- package/sdks/go/api-full/runners.go +18 -0
- package/sdks/go/api-full/types.go +1638 -0
- package/sdks/rust/api-full/.openapi-generator/FILES +28 -0
- package/sdks/rust/api-full/.openapi-generator/VERSION +1 -0
- package/sdks/rust/api-full/.openapi-generator-ignore +23 -0
- package/sdks/rust/api-full/.travis.yml +1 -0
- package/sdks/rust/api-full/Cargo.toml +15 -0
- package/sdks/rust/api-full/README.md +53 -0
- package/sdks/rust/api-full/docs/Actor.md +19 -0
- package/sdks/rust/api-full/docs/ActorLifecycle.md +12 -0
- package/sdks/rust/api-full/docs/ActorsApi.md +37 -0
- package/sdks/rust/api-full/docs/ActorsCreateRequest.md +13 -0
- package/sdks/rust/api-full/docs/ActorsCreateResponse.md +11 -0
- package/sdks/rust/api-full/docs/Namespace.md +14 -0
- package/sdks/rust/api-full/docs/NamespacesCreateRequest.md +12 -0
- package/sdks/rust/api-full/docs/NamespacesCreateResponse.md +11 -0
- package/sdks/rust/api-full/docs/NsApi.md +37 -0
- package/sdks/rust/api-full/git_push.sh +57 -0
- package/sdks/rust/api-full/rust/.openapi-generator/FILES +140 -0
- package/sdks/rust/api-full/rust/.openapi-generator/VERSION +1 -0
- package/sdks/rust/api-full/rust/.openapi-generator-ignore +23 -0
- package/sdks/rust/api-full/rust/.travis.yml +1 -0
- package/sdks/rust/api-full/rust/Cargo.toml +15 -0
- package/sdks/rust/api-full/rust/README.md +111 -0
- package/sdks/rust/api-full/rust/docs/Actor.md +24 -0
- package/sdks/rust/api-full/rust/docs/ActorName.md +11 -0
- package/sdks/rust/api-full/rust/docs/ActorsCreateApi.md +40 -0
- package/sdks/rust/api-full/rust/docs/ActorsCreateRequest.md +16 -0
- package/sdks/rust/api-full/rust/docs/ActorsCreateResponse.md +11 -0
- package/sdks/rust/api-full/rust/docs/ActorsDeleteApi.md +40 -0
- package/sdks/rust/api-full/rust/docs/ActorsGetOrCreateApi.md +40 -0
- package/sdks/rust/api-full/rust/docs/ActorsGetOrCreateRequest.md +16 -0
- package/sdks/rust/api-full/rust/docs/ActorsGetOrCreateResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/ActorsKvGetApi.md +38 -0
- package/sdks/rust/api-full/rust/docs/ActorsKvGetResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/ActorsListApi.md +45 -0
- package/sdks/rust/api-full/rust/docs/ActorsListNamesApi.md +41 -0
- package/sdks/rust/api-full/rust/docs/ActorsListNamesResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/ActorsListResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/CrashPolicy.md +14 -0
- package/sdks/rust/api-full/rust/docs/Datacenter.md +13 -0
- package/sdks/rust/api-full/rust/docs/DatacenterHealth.md +16 -0
- package/sdks/rust/api-full/rust/docs/DatacentersApi.md +34 -0
- package/sdks/rust/api-full/rust/docs/DatacentersListResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/HealthApi.md +34 -0
- package/sdks/rust/api-full/rust/docs/HealthFanoutResponse.md +11 -0
- package/sdks/rust/api-full/rust/docs/HealthResponse.md +13 -0
- package/sdks/rust/api-full/rust/docs/HealthStatus.md +13 -0
- package/sdks/rust/api-full/rust/docs/Namespace.md +14 -0
- package/sdks/rust/api-full/rust/docs/NamespaceListResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/NamespacesApi.md +69 -0
- package/sdks/rust/api-full/rust/docs/NamespacesCreateRequest.md +12 -0
- package/sdks/rust/api-full/rust/docs/NamespacesCreateResponse.md +11 -0
- package/sdks/rust/api-full/rust/docs/Pagination.md +11 -0
- package/sdks/rust/api-full/rust/docs/Runner.md +25 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfig.md +13 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigKind.md +12 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigKindOneOf.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigKindOneOf1.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigKindOneOf1Serverless.md +17 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigVariant.md +13 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsDeleteApi.md +38 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsListApi.md +41 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsListResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsListResponseRunnerConfigsValue.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsRefreshMetadataApi.md +39 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckApi.md +38 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckRequest.md +12 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponseOneOf.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponseOneOf1.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponseOneOf1Failure.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessHealthCheckResponseOneOfSuccess.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataError.md +16 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf1.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf2.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf3.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf3NonSuccessStatus.md +12 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf4.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf4InvalidResponseJson.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf5.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsServerlessMetadataErrorOneOf5InvalidResponseSchema.md +12 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsUpsertApi.md +39 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsUpsertRequestBody.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnerConfigsUpsertResponse.md +11 -0
- package/sdks/rust/api-full/rust/docs/RunnersApi.md +75 -0
- package/sdks/rust/api-full/rust/docs/RunnersListNamesResponse.md +12 -0
- package/sdks/rust/api-full/rust/docs/RunnersListResponse.md +12 -0
- package/sdks/rust/api-full/rust/git_push.sh +57 -0
- package/sdks/rust/api-full/rust/src/apis/actors_create_api.rs +68 -0
- package/sdks/rust/api-full/rust/src/apis/actors_delete_api.rs +69 -0
- package/sdks/rust/api-full/rust/src/apis/actors_get_or_create_api.rs +68 -0
- package/sdks/rust/api-full/rust/src/apis/actors_kv_get_api.rs +65 -0
- package/sdks/rust/api-full/rust/src/apis/actors_list_api.rs +90 -0
- package/sdks/rust/api-full/rust/src/apis/actors_list_names_api.rs +74 -0
- package/sdks/rust/api-full/rust/src/apis/configuration.rs +51 -0
- package/sdks/rust/api-full/rust/src/apis/datacenters_api.rs +62 -0
- package/sdks/rust/api-full/rust/src/apis/health_api.rs +62 -0
- package/sdks/rust/api-full/rust/src/apis/mod.rs +130 -0
- package/sdks/rust/api-full/rust/src/apis/namespaces_api.rs +126 -0
- package/sdks/rust/api-full/rust/src/apis/runner_configs_delete_api.rs +66 -0
- package/sdks/rust/api-full/rust/src/apis/runner_configs_list_api.rs +81 -0
- package/sdks/rust/api-full/rust/src/apis/runner_configs_refresh_metadata_api.rs +68 -0
- package/sdks/rust/api-full/rust/src/apis/runner_configs_serverless_health_check_api.rs +67 -0
- package/sdks/rust/api-full/rust/src/apis/runner_configs_upsert_api.rs +68 -0
- package/sdks/rust/api-full/rust/src/apis/runners_api.rs +141 -0
- package/sdks/rust/api-full/rust/src/lib.rs +11 -0
- package/sdks/rust/api-full/rust/src/models/actor.rs +73 -0
- package/sdks/rust/api-full/rust/src/models/actor_name.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/actors_create_request.rs +42 -0
- package/sdks/rust/api-full/rust/src/models/actors_create_response.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/actors_get_or_create_request.rs +42 -0
- package/sdks/rust/api-full/rust/src/models/actors_get_or_create_response.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/actors_kv_get_response.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/actors_list_names_response.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/actors_list_response.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/crash_policy.rs +41 -0
- package/sdks/rust/api-full/rust/src/models/datacenter.rs +33 -0
- package/sdks/rust/api-full/rust/src/models/datacenter_health.rs +42 -0
- package/sdks/rust/api-full/rust/src/models/datacenters_list_response.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/health_fanout_response.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/health_response.rs +33 -0
- package/sdks/rust/api-full/rust/src/models/health_status.rs +38 -0
- package/sdks/rust/api-full/rust/src/models/mod.rs +100 -0
- package/sdks/rust/api-full/rust/src/models/namespace.rs +36 -0
- package/sdks/rust/api-full/rust/src/models/namespace_list_response.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/namespaces_create_request.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/namespaces_create_response.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/pagination.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner.rs +69 -0
- package/sdks/rust/api-full/rust/src/models/runner_config.rs +33 -0
- package/sdks/rust/api-full/rust/src/models/runner_config_kind.rs +26 -0
- package/sdks/rust/api-full/rust/src/models/runner_config_kind_one_of.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_config_kind_one_of_1.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_config_kind_one_of_1_serverless.rs +46 -0
- package/sdks/rust/api-full/rust/src/models/runner_config_variant.rs +38 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_list_response.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_list_response_runner_configs_value.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_request.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response.rs +26 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response_one_of.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response_one_of_1.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response_one_of_1_failure.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_health_check_response_one_of_success.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_1.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_2.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_3.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_3_non_success_status.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_4.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_4_invalid_response_json.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_5.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_serverless_metadata_error_one_of_5_invalid_response_schema.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_upsert_request_body.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runner_configs_upsert_response.rs +27 -0
- package/sdks/rust/api-full/rust/src/models/runners_list_names_response.rs +30 -0
- package/sdks/rust/api-full/rust/src/models/runners_list_response.rs +30 -0
- package/sdks/rust/api-full/src/apis/actors_api.rs +67 -0
- package/sdks/rust/api-full/src/apis/configuration.rs +48 -0
- package/sdks/rust/api-full/src/apis/mod.rs +119 -0
- package/sdks/rust/api-full/src/apis/ns_api.rs +67 -0
- package/sdks/rust/api-full/src/lib.rs +11 -0
- package/sdks/rust/api-full/src/models/actor.rs +72 -0
- package/sdks/rust/api-full/src/models/actor_lifecycle.rs +29 -0
- package/sdks/rust/api-full/src/models/actors_create_request.rs +36 -0
- package/sdks/rust/api-full/src/models/actors_create_response.rs +26 -0
- package/sdks/rust/api-full/src/models/mod.rs +14 -0
- package/sdks/rust/api-full/src/models/namespace.rs +40 -0
- package/sdks/rust/api-full/src/models/namespaces_create_request.rs +26 -0
- package/sdks/rust/api-full/src/models/namespaces_create_response.rs +26 -0
- package/sdks/rust/data/Cargo.toml +18 -0
- package/sdks/rust/data/build.rs +15 -0
- package/sdks/rust/data/src/converted.rs +137 -0
- package/sdks/rust/data/src/generated.rs +1 -0
- package/sdks/rust/data/src/lib.rs +11 -0
- package/sdks/rust/data/src/versioned/mod.rs +178 -0
- package/sdks/rust/data/src/versioned/namespace_runner_config.rs +125 -0
- package/sdks/rust/epoxy-protocol/Cargo.toml +17 -0
- package/sdks/rust/epoxy-protocol/build.rs +18 -0
- package/sdks/rust/epoxy-protocol/src/generated.rs +1 -0
- package/sdks/rust/epoxy-protocol/src/lib.rs +7 -0
- package/sdks/rust/epoxy-protocol/src/versioned.rs +206 -0
- package/sdks/rust/runner-protocol/Cargo.toml +23 -0
- package/sdks/rust/runner-protocol/build.rs +115 -0
- package/sdks/rust/runner-protocol/src/compat.rs +7 -0
- package/sdks/rust/runner-protocol/src/generated.rs +1 -0
- package/sdks/rust/runner-protocol/src/lib.rs +10 -0
- package/sdks/rust/runner-protocol/src/util.rs +14 -0
- package/sdks/rust/runner-protocol/src/uuid_compat.rs +209 -0
- package/sdks/rust/runner-protocol/src/versioned.rs +1734 -0
- package/sdks/rust/ups-protocol/Cargo.toml +17 -0
- package/sdks/rust/ups-protocol/build.rs +18 -0
- package/sdks/rust/ups-protocol/src/generated.rs +1 -0
- package/sdks/rust/ups-protocol/src/lib.rs +7 -0
- package/sdks/rust/ups-protocol/src/versioned.rs +48 -0
- package/sdks/schemas/README.md +6 -0
- package/sdks/schemas/data/namespace.runner_config.v1.bare +13 -0
- package/sdks/schemas/data/namespace.runner_config.v2.bare +23 -0
- package/sdks/schemas/data/pegboard.namespace.actor_by_key.v1.bare +6 -0
- package/sdks/schemas/data/pegboard.namespace.actor_name.v1.bare +5 -0
- package/sdks/schemas/data/pegboard.namespace.runner_alloc_idx.v1.bare +7 -0
- package/sdks/schemas/data/pegboard.namespace.runner_by_key.v1.bare +6 -0
- package/sdks/schemas/data/pegboard.runner.metadata.v1.bare +5 -0
- package/sdks/schemas/epoxy-protocol/v1.bare +260 -0
- package/sdks/schemas/runner-protocol/v1.bare +393 -0
- package/sdks/schemas/runner-protocol/v2.bare +403 -0
- package/sdks/schemas/runner-protocol/v3.bare +436 -0
- package/sdks/schemas/ups-protocol/v1.bare +23 -0
- package/sdks/typescript/api-full/.turbo/turbo-build.log +42 -0
- package/sdks/typescript/api-full/build.js +69 -0
- package/sdks/typescript/api-full/package.json +59 -0
- package/sdks/typescript/api-full/rivetkit-engine-api-full-25.5.3.tgz +0 -0
- package/sdks/typescript/api-full/src/Client.ts +984 -0
- package/sdks/typescript/api-full/src/api/client/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/client/requests/ActorsCreateRequest.ts +24 -0
- package/sdks/typescript/api-full/src/api/client/requests/ActorsDeleteRequest.ts +11 -0
- package/sdks/typescript/api-full/src/api/client/requests/ActorsGetOrCreateRequest.ts +25 -0
- package/sdks/typescript/api-full/src/api/client/requests/ActorsListNamesRequest.ts +15 -0
- package/sdks/typescript/api-full/src/api/client/requests/ActorsListRequest.ts +19 -0
- package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsDeleteRequest.ts +13 -0
- package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsListRequest.ts +19 -0
- package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsRefreshMetadataRequest.ts +19 -0
- package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsServerlessHealthCheckRequest.ts +16 -0
- package/sdks/typescript/api-full/src/api/client/requests/RunnerConfigsUpsertRequestBody.ts +19 -0
- package/sdks/typescript/api-full/src/api/client/requests/index.ts +10 -0
- package/sdks/typescript/api-full/src/api/index.ts +3 -0
- package/sdks/typescript/api-full/src/api/resources/datacenters/client/Client.ts +97 -0
- package/sdks/typescript/api-full/src/api/resources/datacenters/client/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/resources/datacenters/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/resources/health/client/Client.ts +97 -0
- package/sdks/typescript/api-full/src/api/resources/health/client/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/resources/health/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/resources/index.ts +6 -0
- package/sdks/typescript/api-full/src/api/resources/namespaces/client/Client.ts +187 -0
- package/sdks/typescript/api-full/src/api/resources/namespaces/client/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/resources/namespaces/client/requests/NamespacesCreateRequest.ts +15 -0
- package/sdks/typescript/api-full/src/api/resources/namespaces/client/requests/NamespacesListRequest.ts +14 -0
- package/sdks/typescript/api-full/src/api/resources/namespaces/client/requests/index.ts +2 -0
- package/sdks/typescript/api-full/src/api/resources/namespaces/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/resources/runners/client/Client.ts +209 -0
- package/sdks/typescript/api-full/src/api/resources/runners/client/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/resources/runners/client/requests/RunnersListNamesRequest.ts +15 -0
- package/sdks/typescript/api-full/src/api/resources/runners/client/requests/RunnersListRequest.ts +18 -0
- package/sdks/typescript/api-full/src/api/resources/runners/client/requests/index.ts +2 -0
- package/sdks/typescript/api-full/src/api/resources/runners/index.ts +1 -0
- package/sdks/typescript/api-full/src/api/types/Actor.ts +32 -0
- package/sdks/typescript/api-full/src/api/types/ActorName.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/ActorsCreateResponse.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/ActorsDeleteResponse.ts +5 -0
- package/sdks/typescript/api-full/src/api/types/ActorsGetOrCreateResponse.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/ActorsKvGetResponse.ts +8 -0
- package/sdks/typescript/api-full/src/api/types/ActorsListNamesResponse.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/ActorsListResponse.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/CrashPolicy.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/Datacenter.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/DatacenterHealth.ts +14 -0
- package/sdks/typescript/api-full/src/api/types/DatacentersListResponse.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/HealthFanoutResponse.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/HealthResponse.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/HealthStatus.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/Namespace.ts +12 -0
- package/sdks/typescript/api-full/src/api/types/NamespaceListResponse.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/NamespacesCreateResponse.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/Pagination.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RivetId.ts +5 -0
- package/sdks/typescript/api-full/src/api/types/Runner.ts +23 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfig.ts +11 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigKind.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigKindNormal.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigKindServerless.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigKindServerlessServerless.ts +14 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigServerless.ts +14 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigVariant.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsDeleteResponse.ts +5 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsListResponse.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsListResponseRunnerConfigsValue.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsRefreshMetadataRequestBody.ts +5 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsRefreshMetadataResponse.ts +5 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponse.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponseFailure.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponseFailureFailure.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponseSuccess.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessHealthCheckResponseSuccessSuccess.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataError.ts +13 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidRequest.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJson.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJsonInvalidResponseJson.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchema.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchemaInvalidResponseSchema.ts +8 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatus.ts +9 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatusNonSuccessStatus.ts +8 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorRequestFailed.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsServerlessMetadataErrorRequestTimedOut.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RunnerConfigsUpsertResponse.ts +7 -0
- package/sdks/typescript/api-full/src/api/types/RunnersListNamesResponse.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/RunnersListResponse.ts +10 -0
- package/sdks/typescript/api-full/src/api/types/index.ts +51 -0
- package/sdks/typescript/api-full/src/core/auth/BasicAuth.ts +31 -0
- package/sdks/typescript/api-full/src/core/auth/BearerToken.ts +15 -0
- package/sdks/typescript/api-full/src/core/auth/index.ts +2 -0
- package/sdks/typescript/api-full/src/core/fetcher/APIResponse.ts +12 -0
- package/sdks/typescript/api-full/src/core/fetcher/Fetcher.ts +144 -0
- package/sdks/typescript/api-full/src/core/fetcher/Supplier.ts +11 -0
- package/sdks/typescript/api-full/src/core/fetcher/createRequestUrl.ts +10 -0
- package/sdks/typescript/api-full/src/core/fetcher/getFetchFn.ts +25 -0
- package/sdks/typescript/api-full/src/core/fetcher/getHeader.ts +8 -0
- package/sdks/typescript/api-full/src/core/fetcher/getRequestBody.ts +16 -0
- package/sdks/typescript/api-full/src/core/fetcher/getResponseBody.ts +34 -0
- package/sdks/typescript/api-full/src/core/fetcher/index.ts +5 -0
- package/sdks/typescript/api-full/src/core/fetcher/makeRequest.ts +44 -0
- package/sdks/typescript/api-full/src/core/fetcher/requestWithRetries.ts +33 -0
- package/sdks/typescript/api-full/src/core/fetcher/signals.ts +38 -0
- package/sdks/typescript/api-full/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +257 -0
- package/sdks/typescript/api-full/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +107 -0
- package/sdks/typescript/api-full/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +243 -0
- package/sdks/typescript/api-full/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +34 -0
- package/sdks/typescript/api-full/src/core/index.ts +4 -0
- package/sdks/typescript/api-full/src/core/json.ts +27 -0
- package/sdks/typescript/api-full/src/core/runtime/index.ts +1 -0
- package/sdks/typescript/api-full/src/core/runtime/runtime.ts +131 -0
- package/sdks/typescript/api-full/src/core/schemas/Schema.ts +101 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/bigint/bigint.ts +55 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/bigint/index.ts +1 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/date/date.ts +65 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/date/index.ts +1 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/enum/enum.ts +43 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/enum/index.ts +1 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/index.ts +14 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/lazy/index.ts +3 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/lazy/lazy.ts +32 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/lazy/lazyObject.ts +20 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/list/index.ts +1 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/list/list.ts +73 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/literals/booleanLiteral.ts +29 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/literals/index.ts +2 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/literals/stringLiteral.ts +29 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/object/index.ts +22 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/object/object.ts +366 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts +18 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/object/property.ts +23 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/object/types.ts +58 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/object-like/getObjectLikeUtils.ts +79 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/object-like/index.ts +2 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/object-like/types.ts +11 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/primitives/any.ts +4 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/primitives/boolean.ts +25 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/primitives/index.ts +5 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/primitives/number.ts +25 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/primitives/string.ts +25 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/primitives/unknown.ts +4 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/record/index.ts +2 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/record/record.ts +129 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/record/types.ts +17 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/JsonError.ts +9 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/ParseError.ts +9 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/getSchemaUtils.ts +181 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/index.ts +4 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts +8 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/set/index.ts +1 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/set/set.ts +43 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/undiscriminated-union/index.ts +6 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/undiscriminated-union/types.ts +10 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts +60 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/union/discriminant.ts +14 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/union/index.ts +10 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/union/types.ts +26 -0
- package/sdks/typescript/api-full/src/core/schemas/builders/union/union.ts +170 -0
- package/sdks/typescript/api-full/src/core/schemas/index.ts +2 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/MaybePromise.ts +1 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts +9 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/createIdentitySchemaCreator.ts +21 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/entries.ts +3 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/filterObject.ts +13 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/getErrorMessageForIncorrectType.ts +25 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/isPlainObject.ts +17 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/keys.ts +3 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/maybeSkipValidation.ts +38 -0
- package/sdks/typescript/api-full/src/core/schemas/utils/partition.ts +12 -0
- package/sdks/typescript/api-full/src/errors/RivetError.ts +47 -0
- package/sdks/typescript/api-full/src/errors/RivetTimeoutError.ts +10 -0
- package/sdks/typescript/api-full/src/errors/index.ts +2 -0
- package/sdks/typescript/api-full/src/index.ts +4 -0
- package/sdks/typescript/api-full/src/serialization/client/index.ts +1 -0
- package/sdks/typescript/api-full/src/serialization/client/requests/ActorsCreateRequest.ts +31 -0
- package/sdks/typescript/api-full/src/serialization/client/requests/ActorsGetOrCreateRequest.ts +31 -0
- package/sdks/typescript/api-full/src/serialization/client/requests/RunnerConfigsServerlessHealthCheckRequest.ts +22 -0
- package/sdks/typescript/api-full/src/serialization/client/requests/RunnerConfigsUpsertRequestBody.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/client/requests/index.ts +4 -0
- package/sdks/typescript/api-full/src/serialization/index.ts +3 -0
- package/sdks/typescript/api-full/src/serialization/resources/index.ts +2 -0
- package/sdks/typescript/api-full/src/serialization/resources/namespaces/client/index.ts +1 -0
- package/sdks/typescript/api-full/src/serialization/resources/namespaces/client/requests/NamespacesCreateRequest.ts +22 -0
- package/sdks/typescript/api-full/src/serialization/resources/namespaces/client/requests/index.ts +1 -0
- package/sdks/typescript/api-full/src/serialization/resources/namespaces/index.ts +1 -0
- package/sdks/typescript/api-full/src/serialization/types/Actor.ts +45 -0
- package/sdks/typescript/api-full/src/serialization/types/ActorName.ts +18 -0
- package/sdks/typescript/api-full/src/serialization/types/ActorsCreateResponse.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/types/ActorsDeleteResponse.ts +16 -0
- package/sdks/typescript/api-full/src/serialization/types/ActorsGetOrCreateResponse.ts +23 -0
- package/sdks/typescript/api-full/src/serialization/types/ActorsKvGetResponse.ts +22 -0
- package/sdks/typescript/api-full/src/serialization/types/ActorsListNamesResponse.ts +24 -0
- package/sdks/typescript/api-full/src/serialization/types/ActorsListResponse.ts +24 -0
- package/sdks/typescript/api-full/src/serialization/types/CrashPolicy.ts +14 -0
- package/sdks/typescript/api-full/src/serialization/types/Datacenter.ts +22 -0
- package/sdks/typescript/api-full/src/serialization/types/DatacenterHealth.ts +32 -0
- package/sdks/typescript/api-full/src/serialization/types/DatacentersListResponse.ts +24 -0
- package/sdks/typescript/api-full/src/serialization/types/HealthFanoutResponse.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/types/HealthResponse.ts +22 -0
- package/sdks/typescript/api-full/src/serialization/types/HealthStatus.ts +14 -0
- package/sdks/typescript/api-full/src/serialization/types/Namespace.ts +25 -0
- package/sdks/typescript/api-full/src/serialization/types/NamespaceListResponse.ts +24 -0
- package/sdks/typescript/api-full/src/serialization/types/NamespacesCreateResponse.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/types/Pagination.ts +18 -0
- package/sdks/typescript/api-full/src/serialization/types/RivetId.ts +13 -0
- package/sdks/typescript/api-full/src/serialization/types/Runner.ts +46 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfig.ts +23 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigKind.ts +16 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigKindNormal.ts +20 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigKindServerless.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigKindServerlessServerless.ts +32 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigServerless.ts +32 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigVariant.ts +16 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsDeleteResponse.ts +16 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsListResponse.ts +27 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsListResponseRunnerConfigsValue.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsRefreshMetadataRequestBody.ts +16 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsRefreshMetadataResponse.ts +16 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponse.ts +23 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponseFailure.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponseFailureFailure.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponseSuccess.ts +21 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessHealthCheckResponseSuccessSuccess.ts +20 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataError.ts +35 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidRequest.ts +23 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJson.ts +24 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseJsonInvalidResponseJson.ts +20 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchema.ts +24 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorInvalidResponseSchemaInvalidResponseSchema.ts +22 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatus.ts +24 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorNonSuccessStatusNonSuccessStatus.ts +22 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorRequestFailed.ts +23 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsServerlessMetadataErrorRequestTimedOut.ts +23 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnerConfigsUpsertResponse.ts +20 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnersListNamesResponse.ts +23 -0
- package/sdks/typescript/api-full/src/serialization/types/RunnersListResponse.ts +24 -0
- package/sdks/typescript/api-full/src/serialization/types/index.ts +51 -0
- package/sdks/typescript/api-full/tsconfig.json +24 -0
- package/sdks/typescript/runner/.turbo/turbo-build.log +22 -0
- package/sdks/typescript/runner/benches/actor-lifecycle.bench.ts +190 -0
- package/sdks/typescript/runner/benches/utils.ts +143 -0
- package/sdks/typescript/runner/dist/mod.cjs +2951 -0
- package/sdks/typescript/runner/dist/mod.cjs.map +1 -0
- package/sdks/typescript/runner/dist/mod.d.cts +326 -0
- package/sdks/typescript/runner/dist/mod.d.ts +326 -0
- package/sdks/typescript/runner/dist/mod.js +2951 -0
- package/sdks/typescript/runner/dist/mod.js.map +1 -0
- package/sdks/typescript/runner/node_modules/.bin/pino +21 -0
- package/sdks/typescript/runner/node_modules/.bin/tsc +21 -0
- package/sdks/typescript/runner/node_modules/.bin/tsserver +21 -0
- package/sdks/typescript/runner/node_modules/.bin/tsup +21 -0
- package/sdks/typescript/runner/node_modules/.bin/tsup-node +21 -0
- package/sdks/typescript/runner/node_modules/.bin/tsx +21 -0
- package/sdks/typescript/runner/node_modules/.bin/uuid +21 -0
- package/sdks/typescript/runner/node_modules/.bin/vitest +21 -0
- package/sdks/typescript/runner/package.json +37 -0
- package/sdks/typescript/runner/src/actor.ts +196 -0
- package/sdks/typescript/runner/src/log.ts +11 -0
- package/sdks/typescript/runner/src/mod.ts +1755 -0
- package/sdks/typescript/runner/src/stringify.ts +354 -0
- package/sdks/typescript/runner/src/tunnel.ts +1178 -0
- package/sdks/typescript/runner/src/utils.ts +159 -0
- package/sdks/typescript/runner/src/websocket-tunnel-adapter.ts +567 -0
- package/sdks/typescript/runner/src/websocket.ts +43 -0
- package/sdks/typescript/runner/tests/lifecycle.test.ts +596 -0
- package/sdks/typescript/runner/tests/utils.test.ts +194 -0
- package/sdks/typescript/runner/tsconfig.json +11 -0
- package/sdks/typescript/runner/tsup.config.ts +4 -0
- package/sdks/typescript/runner/turbo.json +4 -0
- package/sdks/typescript/runner/vitest.config.ts +16 -0
- package/sdks/typescript/runner-protocol/.turbo/turbo-build.log +22 -0
- package/sdks/typescript/runner-protocol/dist/index.cjs +1632 -0
- package/sdks/typescript/runner-protocol/dist/index.cjs.map +1 -0
- package/sdks/typescript/runner-protocol/dist/index.d.cts +666 -0
- package/sdks/typescript/runner-protocol/dist/index.d.ts +666 -0
- package/sdks/typescript/runner-protocol/dist/index.js +1632 -0
- package/sdks/typescript/runner-protocol/dist/index.js.map +1 -0
- package/sdks/typescript/runner-protocol/node_modules/.bin/tsc +21 -0
- package/sdks/typescript/runner-protocol/node_modules/.bin/tsserver +21 -0
- package/sdks/typescript/runner-protocol/node_modules/.bin/tsup +21 -0
- package/sdks/typescript/runner-protocol/node_modules/.bin/tsup-node +21 -0
- package/sdks/typescript/runner-protocol/package.json +34 -0
- package/sdks/typescript/runner-protocol/src/index.ts +2121 -0
- package/sdks/typescript/runner-protocol/tsconfig.json +17 -0
- package/sdks/typescript/runner-protocol/tsup.config.ts +4 -0
- package/sdks/typescript/runner-protocol/turbo.json +4 -0
- package/sdks/typescript/test-runner/.turbo/turbo-build.log +17 -0
- package/sdks/typescript/test-runner/Dockerfile +26 -0
- package/sdks/typescript/test-runner/dist/index.d.ts +6 -0
- package/sdks/typescript/test-runner/dist/index.js +345 -0
- package/sdks/typescript/test-runner/dist/index.js.map +1 -0
- package/sdks/typescript/test-runner/node_modules/.bin/pino +21 -0
- package/sdks/typescript/test-runner/node_modules/.bin/tsc +21 -0
- package/sdks/typescript/test-runner/node_modules/.bin/tsserver +21 -0
- package/sdks/typescript/test-runner/node_modules/.bin/tsup +21 -0
- package/sdks/typescript/test-runner/node_modules/.bin/tsup-node +21 -0
- package/sdks/typescript/test-runner/node_modules/.bin/tsx +21 -0
- package/sdks/typescript/test-runner/node_modules/.bin/vitest +21 -0
- package/sdks/typescript/test-runner/package.json +27 -0
- package/sdks/typescript/test-runner/src/index.ts +287 -0
- package/sdks/typescript/test-runner/src/log.ts +194 -0
- package/sdks/typescript/test-runner/tsconfig.json +11 -0
- package/sdks/typescript/test-runner/tsup.config.ts +7 -0
- package/sdks/typescript/test-runner/turbo.json +4 -0
- package/sdks/typescript/test-runner/vitest.config.ts +16 -0
- package/tests/load/README.md +28 -0
- package/tests/load/actor-lifecycle/README.md +26 -0
- package/tests/load/actor-lifecycle/actor.ts +41 -0
- package/tests/load/actor-lifecycle/config.ts +14 -0
- package/tests/load/actor-lifecycle/index.ts +62 -0
- package/tests/load/actor-lifecycle/rivet_api.ts +140 -0
- package/tests/load/actor-lifecycle/types.ts +17 -0
- package/tests/load/node_modules/.bin/biome +21 -0
- package/tests/load/node_modules/.bin/tsc +21 -0
- package/tests/load/node_modules/.bin/tsserver +21 -0
- package/tests/load/package.json +15 -0
- package/tests/load/tsconfig.json +20 -0
- package/tests/smoke/README.md +32 -0
- package/tests/smoke/package.json +19 -0
- package/tests/smoke/scripts/connect.ts +41 -0
- package/tests/smoke/src/server/registry.ts +32 -0
- package/tests/smoke/src/server/server.ts +7 -0
- package/tests/smoke/src/smoke-test/index.ts +161 -0
- package/tests/smoke/src/smoke-test/spawn-actor.ts +109 -0
- package/tests/smoke/tsconfig.json +43 -0
- package/tests/smoke/turbo.json +4 -0
|
@@ -0,0 +1,1493 @@
|
|
|
1
|
+
use std::{
|
|
2
|
+
collections::HashMap,
|
|
3
|
+
ops::Deref,
|
|
4
|
+
result::Result::{Err, Ok},
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
use anyhow::{Context, Result, ensure};
|
|
8
|
+
use futures_util::{StreamExt, TryStreamExt};
|
|
9
|
+
use rivet_util::Id;
|
|
10
|
+
use tracing::Instrument;
|
|
11
|
+
use universaldb::utils::{FormalChunkedKey, FormalKey, IsolationLevel::*, end_of_key_range};
|
|
12
|
+
use universaldb::{
|
|
13
|
+
RangeOption,
|
|
14
|
+
options::{ConflictRangeType, StreamingMode},
|
|
15
|
+
tuple::{PackResult, TupleDepth, TupleUnpack},
|
|
16
|
+
value::Value,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
use super::{DatabaseKv, keys, update_metric};
|
|
20
|
+
use crate::{
|
|
21
|
+
db::{
|
|
22
|
+
BumpSubSubject,
|
|
23
|
+
debug::{
|
|
24
|
+
ActivityError, ActivityEvent, DatabaseDebug, Event, EventData, HistoryData, LoopEvent,
|
|
25
|
+
MessageSendEvent, SignalData, SignalEvent, SignalSendEvent, SignalState,
|
|
26
|
+
SubWorkflowEvent, WorkflowData, WorkflowState,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
error::{WorkflowError, WorkflowResult},
|
|
30
|
+
history::{
|
|
31
|
+
event::{EventType, RemovedEvent, SleepEvent, SleepState},
|
|
32
|
+
location::Location,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
impl DatabaseKv {
|
|
37
|
+
#[tracing::instrument(skip_all)]
|
|
38
|
+
async fn get_workflows_inner(
|
|
39
|
+
&self,
|
|
40
|
+
workflow_ids: Vec<Id>,
|
|
41
|
+
tx: &universaldb::RetryableTransaction,
|
|
42
|
+
) -> Result<Vec<WorkflowData>> {
|
|
43
|
+
let mut res = Vec::new();
|
|
44
|
+
|
|
45
|
+
// TODO: Parallelize
|
|
46
|
+
for workflow_id in workflow_ids {
|
|
47
|
+
// TODO: Do a single range read for all keys under workflow/data
|
|
48
|
+
let name_key = keys::workflow::NameKey::new(workflow_id);
|
|
49
|
+
let tags_subspace_key = keys::workflow::TagKey::subspace(workflow_id);
|
|
50
|
+
let tags_subspace = self.subspace.subspace(&tags_subspace_key);
|
|
51
|
+
let create_ts_key = keys::workflow::CreateTsKey::new(workflow_id);
|
|
52
|
+
let input_key = keys::workflow::InputKey::new(workflow_id);
|
|
53
|
+
let input_subspace = self.subspace.subspace(&input_key);
|
|
54
|
+
let state_key = keys::workflow::StateKey::new(workflow_id);
|
|
55
|
+
let state_subspace = self.subspace.subspace(&state_key);
|
|
56
|
+
let output_key = keys::workflow::OutputKey::new(workflow_id);
|
|
57
|
+
let output_subspace = self.subspace.subspace(&output_key);
|
|
58
|
+
let error_key = keys::workflow::ErrorKey::new(workflow_id);
|
|
59
|
+
let has_wake_condition_key = keys::workflow::HasWakeConditionKey::new(workflow_id);
|
|
60
|
+
let worker_id_key = keys::workflow::WorkerIdKey::new(workflow_id);
|
|
61
|
+
let silence_ts_key = keys::workflow::SilenceTsKey::new(workflow_id);
|
|
62
|
+
|
|
63
|
+
let (
|
|
64
|
+
tags,
|
|
65
|
+
name_entry,
|
|
66
|
+
create_ts_entry,
|
|
67
|
+
input_chunks,
|
|
68
|
+
state_chunks,
|
|
69
|
+
output_chunks,
|
|
70
|
+
error_entry,
|
|
71
|
+
has_wake_condition_entry,
|
|
72
|
+
worker_id_entry,
|
|
73
|
+
silence_ts_entry,
|
|
74
|
+
) = tokio::try_join!(
|
|
75
|
+
tx.get_ranges_keyvalues(
|
|
76
|
+
RangeOption {
|
|
77
|
+
mode: StreamingMode::WantAll,
|
|
78
|
+
..(&tags_subspace).into()
|
|
79
|
+
},
|
|
80
|
+
Snapshot,
|
|
81
|
+
)
|
|
82
|
+
.map(|res| {
|
|
83
|
+
let key = self.subspace.unpack::<keys::workflow::TagKey>(res?.key())?;
|
|
84
|
+
let v = serde_json::Value::String(key.v.clone());
|
|
85
|
+
|
|
86
|
+
Ok((key.k, v))
|
|
87
|
+
})
|
|
88
|
+
.try_collect::<serde_json::Map<_, _>>(),
|
|
89
|
+
tx.get(&self.subspace.pack(&name_key), Snapshot),
|
|
90
|
+
tx.get(&self.subspace.pack(&create_ts_key), Snapshot),
|
|
91
|
+
tx.get_ranges_keyvalues(
|
|
92
|
+
RangeOption {
|
|
93
|
+
mode: StreamingMode::WantAll,
|
|
94
|
+
..(&input_subspace).into()
|
|
95
|
+
},
|
|
96
|
+
Snapshot,
|
|
97
|
+
)
|
|
98
|
+
.try_collect::<Vec<_>>(),
|
|
99
|
+
tx.get_ranges_keyvalues(
|
|
100
|
+
RangeOption {
|
|
101
|
+
mode: StreamingMode::WantAll,
|
|
102
|
+
..(&state_subspace).into()
|
|
103
|
+
},
|
|
104
|
+
Snapshot,
|
|
105
|
+
)
|
|
106
|
+
.try_collect::<Vec<_>>(),
|
|
107
|
+
tx.get_ranges_keyvalues(
|
|
108
|
+
RangeOption {
|
|
109
|
+
mode: StreamingMode::WantAll,
|
|
110
|
+
..(&output_subspace).into()
|
|
111
|
+
},
|
|
112
|
+
Snapshot,
|
|
113
|
+
)
|
|
114
|
+
.try_collect::<Vec<_>>(),
|
|
115
|
+
tx.get(&self.subspace.pack(&error_key), Snapshot),
|
|
116
|
+
tx.get(&self.subspace.pack(&has_wake_condition_key), Snapshot),
|
|
117
|
+
tx.get(&self.subspace.pack(&worker_id_key), Snapshot),
|
|
118
|
+
tx.get(&self.subspace.pack(&silence_ts_key), Snapshot),
|
|
119
|
+
)?;
|
|
120
|
+
|
|
121
|
+
let Some(create_ts_entry) = &create_ts_entry else {
|
|
122
|
+
tracing::warn!(?workflow_id, "workflow not found");
|
|
123
|
+
continue;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
let create_ts = create_ts_key.deserialize(&create_ts_entry)?;
|
|
127
|
+
|
|
128
|
+
let workflow_name = name_key.deserialize(&name_entry.context("key should exist")?)?;
|
|
129
|
+
|
|
130
|
+
let input = input_key.combine(input_chunks)?;
|
|
131
|
+
|
|
132
|
+
let data = if state_chunks.is_empty() {
|
|
133
|
+
serde_json::value::RawValue::NULL.to_owned()
|
|
134
|
+
} else {
|
|
135
|
+
state_key.combine(state_chunks)?
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
let output = if output_chunks.is_empty() {
|
|
139
|
+
None
|
|
140
|
+
} else {
|
|
141
|
+
Some(output_key.combine(output_chunks)?)
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
let error = if let Some(error_entry) = error_entry {
|
|
145
|
+
Some(error_key.deserialize(&error_entry)?)
|
|
146
|
+
} else {
|
|
147
|
+
None
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
let state = if silence_ts_entry.is_some() {
|
|
151
|
+
WorkflowState::Silenced
|
|
152
|
+
} else if output.is_some() {
|
|
153
|
+
WorkflowState::Complete
|
|
154
|
+
} else if worker_id_entry.is_some() {
|
|
155
|
+
WorkflowState::Running
|
|
156
|
+
} else if has_wake_condition_entry.is_some() {
|
|
157
|
+
WorkflowState::Sleeping
|
|
158
|
+
} else {
|
|
159
|
+
WorkflowState::Dead
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
res.push(WorkflowData {
|
|
163
|
+
workflow_id,
|
|
164
|
+
workflow_name,
|
|
165
|
+
tags: serde_json::Value::Object(tags),
|
|
166
|
+
create_ts,
|
|
167
|
+
input: serde_json::from_str(input.get())?,
|
|
168
|
+
data: serde_json::from_str(data.get())?,
|
|
169
|
+
output: output.map(|x| serde_json::from_str(x.get())).transpose()?,
|
|
170
|
+
error,
|
|
171
|
+
state,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
Ok(res)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
#[tracing::instrument(skip_all)]
|
|
179
|
+
async fn get_signals_inner(
|
|
180
|
+
&self,
|
|
181
|
+
signal_ids: Vec<Id>,
|
|
182
|
+
tx: &universaldb::RetryableTransaction,
|
|
183
|
+
) -> Result<Vec<SignalData>> {
|
|
184
|
+
let mut res = Vec::new();
|
|
185
|
+
|
|
186
|
+
// TODO: Parallelize
|
|
187
|
+
for signal_id in signal_ids {
|
|
188
|
+
let name_key = keys::signal::NameKey::new(signal_id);
|
|
189
|
+
let create_ts_key = keys::signal::CreateTsKey::new(signal_id);
|
|
190
|
+
let body_key = keys::signal::BodyKey::new(signal_id);
|
|
191
|
+
let body_subspace = self.subspace.subspace(&body_key);
|
|
192
|
+
let ack_ts_key = keys::signal::AckTsKey::new(signal_id);
|
|
193
|
+
let silence_ts_key = keys::signal::SilenceTsKey::new(signal_id);
|
|
194
|
+
let workflow_id_key = keys::signal::WorkflowIdKey::new(signal_id);
|
|
195
|
+
|
|
196
|
+
let (
|
|
197
|
+
name_entry,
|
|
198
|
+
workflow_id_entry,
|
|
199
|
+
create_ts_entry,
|
|
200
|
+
body_chunks,
|
|
201
|
+
ack_ts_entry,
|
|
202
|
+
silence_ts_entry,
|
|
203
|
+
) = tokio::try_join!(
|
|
204
|
+
tx.get(&self.subspace.pack(&name_key), Snapshot),
|
|
205
|
+
tx.get(&self.subspace.pack(&workflow_id_key), Snapshot),
|
|
206
|
+
tx.get(&self.subspace.pack(&create_ts_key), Snapshot),
|
|
207
|
+
async {
|
|
208
|
+
tx.get_ranges_keyvalues(
|
|
209
|
+
RangeOption {
|
|
210
|
+
mode: StreamingMode::WantAll,
|
|
211
|
+
..(&body_subspace).into()
|
|
212
|
+
},
|
|
213
|
+
Snapshot,
|
|
214
|
+
)
|
|
215
|
+
.try_collect::<Vec<_>>()
|
|
216
|
+
.await
|
|
217
|
+
},
|
|
218
|
+
tx.get(&self.subspace.pack(&ack_ts_key), Snapshot),
|
|
219
|
+
tx.get(&self.subspace.pack(&silence_ts_key), Snapshot),
|
|
220
|
+
)?;
|
|
221
|
+
|
|
222
|
+
let Some(create_ts_entry) = &create_ts_entry else {
|
|
223
|
+
tracing::warn!(?signal_id, "signal not found");
|
|
224
|
+
continue;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
let create_ts = create_ts_key.deserialize(&create_ts_entry)?;
|
|
228
|
+
|
|
229
|
+
let signal_name = name_key.deserialize(&name_entry.context("key should exist")?)?;
|
|
230
|
+
|
|
231
|
+
let body = body_key.combine(body_chunks)?;
|
|
232
|
+
|
|
233
|
+
let workflow_id = if let Some(workflow_id_entry) = workflow_id_entry {
|
|
234
|
+
Some(workflow_id_key.deserialize(&workflow_id_entry)?)
|
|
235
|
+
} else {
|
|
236
|
+
None
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
let ack_ts = if let Some(ack_ts_entry) = ack_ts_entry {
|
|
240
|
+
Some(ack_ts_key.deserialize(&ack_ts_entry)?)
|
|
241
|
+
} else {
|
|
242
|
+
None
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
let state = if silence_ts_entry.is_some() {
|
|
246
|
+
SignalState::Silenced
|
|
247
|
+
} else if ack_ts.is_some() {
|
|
248
|
+
SignalState::Acked
|
|
249
|
+
} else {
|
|
250
|
+
SignalState::Pending
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
res.push(SignalData {
|
|
254
|
+
signal_id,
|
|
255
|
+
signal_name,
|
|
256
|
+
tags: None,
|
|
257
|
+
workflow_id,
|
|
258
|
+
create_ts,
|
|
259
|
+
ack_ts,
|
|
260
|
+
body: serde_json::from_str(body.get())?,
|
|
261
|
+
state,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
Ok(res)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// NOTE: Most of the reads here are Snapshot because we don't want this to conflict with the actual wf engine.
|
|
270
|
+
// Its just for debugging
|
|
271
|
+
#[async_trait::async_trait]
|
|
272
|
+
impl DatabaseDebug for DatabaseKv {
|
|
273
|
+
#[tracing::instrument(skip_all)]
|
|
274
|
+
async fn get_workflows(&self, workflow_ids: Vec<Id>) -> Result<Vec<WorkflowData>> {
|
|
275
|
+
self.pools
|
|
276
|
+
.udb()?
|
|
277
|
+
.run(|tx| {
|
|
278
|
+
let workflow_ids = workflow_ids.clone();
|
|
279
|
+
async move { self.get_workflows_inner(workflow_ids, &tx).await }
|
|
280
|
+
})
|
|
281
|
+
.await
|
|
282
|
+
.map_err(Into::into)
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
#[tracing::instrument(skip_all)]
|
|
286
|
+
async fn find_workflows(
|
|
287
|
+
&self,
|
|
288
|
+
tags: &[(String, String)],
|
|
289
|
+
name: Option<&str>,
|
|
290
|
+
state: Option<WorkflowState>,
|
|
291
|
+
) -> Result<Vec<WorkflowData>> {
|
|
292
|
+
// NOTE: this does a full scan of all keys under workflow/data and filters in memory
|
|
293
|
+
self.pools
|
|
294
|
+
.udb()?
|
|
295
|
+
.run(|tx| {
|
|
296
|
+
let name = name.clone();
|
|
297
|
+
async move {
|
|
298
|
+
let mut workflow_ids = Vec::new();
|
|
299
|
+
|
|
300
|
+
let data_subspace = self
|
|
301
|
+
.subspace
|
|
302
|
+
.subspace(&keys::workflow::DataSubspaceKey::new());
|
|
303
|
+
|
|
304
|
+
let mut stream = tx.get_ranges_keyvalues(
|
|
305
|
+
RangeOption {
|
|
306
|
+
mode: StreamingMode::Iterator,
|
|
307
|
+
..(&data_subspace).into()
|
|
308
|
+
},
|
|
309
|
+
Snapshot,
|
|
310
|
+
);
|
|
311
|
+
|
|
312
|
+
let mut current_workflow_id = None;
|
|
313
|
+
let mut matching_tags = 0;
|
|
314
|
+
let mut name_matches = name.is_none();
|
|
315
|
+
let mut state_matches = state.is_none() || state == Some(WorkflowState::Dead);
|
|
316
|
+
|
|
317
|
+
while let Some(entry) = stream.try_next().await? {
|
|
318
|
+
let workflow_id = *self.subspace.unpack::<JustId>(entry.key())?;
|
|
319
|
+
|
|
320
|
+
if let Some(curr) = current_workflow_id {
|
|
321
|
+
if workflow_id != curr {
|
|
322
|
+
// Save if matches query
|
|
323
|
+
if matching_tags == tags.len() && name_matches && state_matches {
|
|
324
|
+
workflow_ids.push(curr);
|
|
325
|
+
|
|
326
|
+
if workflow_ids.len() >= 100 {
|
|
327
|
+
current_workflow_id = None;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Reset state
|
|
333
|
+
matching_tags = 0;
|
|
334
|
+
name_matches = name.is_none();
|
|
335
|
+
state_matches =
|
|
336
|
+
state.is_none() || state == Some(WorkflowState::Dead);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
current_workflow_id = Some(workflow_id);
|
|
341
|
+
|
|
342
|
+
if let Ok(tag_key) =
|
|
343
|
+
self.subspace.unpack::<keys::workflow::TagKey>(entry.key())
|
|
344
|
+
{
|
|
345
|
+
if tags.iter().any(|(k, v)| &tag_key.k == k && &tag_key.v == v) {
|
|
346
|
+
matching_tags += 1;
|
|
347
|
+
}
|
|
348
|
+
} else if let Ok(name_key) =
|
|
349
|
+
self.subspace.unpack::<keys::workflow::NameKey>(entry.key())
|
|
350
|
+
{
|
|
351
|
+
if let Some(name) = &name {
|
|
352
|
+
let workflow_name = name_key.deserialize(entry.value())?;
|
|
353
|
+
|
|
354
|
+
name_matches = &workflow_name == name;
|
|
355
|
+
}
|
|
356
|
+
} else if let Ok(_) = self
|
|
357
|
+
.subspace
|
|
358
|
+
.unpack::<keys::workflow::OutputChunkKey>(entry.key())
|
|
359
|
+
{
|
|
360
|
+
// Has output
|
|
361
|
+
match state {
|
|
362
|
+
Some(WorkflowState::Complete) => state_matches = true,
|
|
363
|
+
Some(_) => state_matches = false,
|
|
364
|
+
None => {}
|
|
365
|
+
}
|
|
366
|
+
} else if let Ok(_) = self
|
|
367
|
+
.subspace
|
|
368
|
+
.unpack::<keys::workflow::WorkerIdKey>(entry.key())
|
|
369
|
+
{
|
|
370
|
+
match state {
|
|
371
|
+
Some(WorkflowState::Running) => state_matches = true,
|
|
372
|
+
Some(WorkflowState::Sleeping | WorkflowState::Dead) => {
|
|
373
|
+
state_matches = false
|
|
374
|
+
}
|
|
375
|
+
_ => {}
|
|
376
|
+
}
|
|
377
|
+
} else if let Ok(_) = self
|
|
378
|
+
.subspace
|
|
379
|
+
.unpack::<keys::workflow::HasWakeConditionKey>(entry.key())
|
|
380
|
+
{
|
|
381
|
+
match state {
|
|
382
|
+
Some(WorkflowState::Sleeping) => state_matches = true,
|
|
383
|
+
Some(WorkflowState::Dead) => state_matches = false,
|
|
384
|
+
_ => {}
|
|
385
|
+
}
|
|
386
|
+
} else if let Ok(_) = self
|
|
387
|
+
.subspace
|
|
388
|
+
.unpack::<keys::workflow::SilenceTsKey>(entry.key())
|
|
389
|
+
{
|
|
390
|
+
match state {
|
|
391
|
+
Some(WorkflowState::Silenced) => state_matches = true,
|
|
392
|
+
_ => state_matches = false,
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if let (Some(workflow_id), true) = (
|
|
398
|
+
current_workflow_id,
|
|
399
|
+
matching_tags == tags.len() && name_matches && state_matches,
|
|
400
|
+
) {
|
|
401
|
+
workflow_ids.push(workflow_id);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
let workflows = self.get_workflows_inner(workflow_ids, &tx).await?;
|
|
405
|
+
|
|
406
|
+
Ok(workflows)
|
|
407
|
+
}
|
|
408
|
+
})
|
|
409
|
+
.instrument(tracing::info_span!("find_workflows_tx"))
|
|
410
|
+
.await
|
|
411
|
+
.map_err(Into::into)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
#[tracing::instrument(skip_all)]
|
|
415
|
+
async fn silence_workflows(&self, workflow_ids: Vec<Id>) -> Result<()> {
|
|
416
|
+
self.pools
|
|
417
|
+
.udb()?
|
|
418
|
+
.run(|tx| {
|
|
419
|
+
let workflow_ids = workflow_ids.clone();
|
|
420
|
+
|
|
421
|
+
async move {
|
|
422
|
+
// TODO: Parallelize
|
|
423
|
+
for workflow_id in workflow_ids {
|
|
424
|
+
let sub_workflow_wake_subspace = self
|
|
425
|
+
.subspace
|
|
426
|
+
.subspace(&keys::wake::SubWorkflowWakeKey::subspace(workflow_id));
|
|
427
|
+
let tags_subspace = self
|
|
428
|
+
.subspace
|
|
429
|
+
.subspace(&keys::workflow::TagKey::subspace(workflow_id));
|
|
430
|
+
let name_key = keys::workflow::NameKey::new(workflow_id);
|
|
431
|
+
let worker_id_key = keys::workflow::WorkerIdKey::new(workflow_id);
|
|
432
|
+
let output_key = keys::workflow::OutputKey::new(workflow_id);
|
|
433
|
+
let output_subspace = self.subspace.subspace(&output_key);
|
|
434
|
+
let has_wake_condition_key =
|
|
435
|
+
keys::workflow::HasWakeConditionKey::new(workflow_id);
|
|
436
|
+
let silence_ts_key = keys::workflow::SilenceTsKey::new(workflow_id);
|
|
437
|
+
let wake_sub_workflow_key =
|
|
438
|
+
keys::workflow::WakeSubWorkflowKey::new(workflow_id);
|
|
439
|
+
let error_key = keys::workflow::ErrorKey::new(workflow_id);
|
|
440
|
+
|
|
441
|
+
let Some(name_entry) =
|
|
442
|
+
tx.get(&self.subspace.pack(&name_key), Serializable).await?
|
|
443
|
+
else {
|
|
444
|
+
tracing::warn!(?workflow_id, "workflow not found");
|
|
445
|
+
continue;
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
let workflow_name = name_key.deserialize(&name_entry)?;
|
|
449
|
+
|
|
450
|
+
let wake_conditions_subspace = self.subspace.subspace(
|
|
451
|
+
&keys::wake::WorkflowWakeConditionKey::subspace_without_ts(
|
|
452
|
+
workflow_name.clone(),
|
|
453
|
+
),
|
|
454
|
+
);
|
|
455
|
+
|
|
456
|
+
let (
|
|
457
|
+
sub_workflow_wake_keys,
|
|
458
|
+
tag_keys,
|
|
459
|
+
wake_condition_keys,
|
|
460
|
+
is_running,
|
|
461
|
+
has_output,
|
|
462
|
+
has_wake_condition,
|
|
463
|
+
is_silenced,
|
|
464
|
+
wake_sub_workflow_entry,
|
|
465
|
+
error_entry,
|
|
466
|
+
) = tokio::try_join!(
|
|
467
|
+
// Read sub workflow wake conditions
|
|
468
|
+
tx.get_ranges_keyvalues(
|
|
469
|
+
RangeOption {
|
|
470
|
+
mode: StreamingMode::WantAll,
|
|
471
|
+
..(&sub_workflow_wake_subspace).into()
|
|
472
|
+
},
|
|
473
|
+
Serializable,
|
|
474
|
+
)
|
|
475
|
+
.map(|res| self
|
|
476
|
+
.subspace
|
|
477
|
+
.unpack::<keys::wake::SubWorkflowWakeKey>(res?.key())
|
|
478
|
+
.map_err(Into::into))
|
|
479
|
+
.try_collect::<Vec<_>>(),
|
|
480
|
+
// Read tags
|
|
481
|
+
tx.get_ranges_keyvalues(
|
|
482
|
+
RangeOption {
|
|
483
|
+
mode: StreamingMode::WantAll,
|
|
484
|
+
..(&tags_subspace).into()
|
|
485
|
+
},
|
|
486
|
+
Serializable,
|
|
487
|
+
)
|
|
488
|
+
.map(|res| self
|
|
489
|
+
.subspace
|
|
490
|
+
.unpack::<keys::workflow::TagKey>(res?.key())
|
|
491
|
+
.map_err(Into::into))
|
|
492
|
+
.try_collect::<Vec<_>>(),
|
|
493
|
+
// Read wake conditions
|
|
494
|
+
tx.get_ranges_keyvalues(
|
|
495
|
+
RangeOption {
|
|
496
|
+
mode: StreamingMode::WantAll,
|
|
497
|
+
..(&wake_conditions_subspace).into()
|
|
498
|
+
},
|
|
499
|
+
Snapshot,
|
|
500
|
+
)
|
|
501
|
+
.map(|res| {
|
|
502
|
+
let entry = res?;
|
|
503
|
+
|
|
504
|
+
Ok((
|
|
505
|
+
entry.key().to_vec(),
|
|
506
|
+
self.subspace
|
|
507
|
+
.unpack::<keys::wake::WorkflowWakeConditionKey>(
|
|
508
|
+
entry.key(),
|
|
509
|
+
)?,
|
|
510
|
+
))
|
|
511
|
+
})
|
|
512
|
+
.try_collect::<Vec<_>>(),
|
|
513
|
+
async {
|
|
514
|
+
tx.get(&self.subspace.pack(&worker_id_key), Serializable)
|
|
515
|
+
.await
|
|
516
|
+
.map(|x| x.is_some())
|
|
517
|
+
},
|
|
518
|
+
async {
|
|
519
|
+
tx.get_ranges_keyvalues(
|
|
520
|
+
RangeOption {
|
|
521
|
+
mode: StreamingMode::WantAll,
|
|
522
|
+
limit: Some(1),
|
|
523
|
+
..(&output_subspace).into()
|
|
524
|
+
},
|
|
525
|
+
Snapshot,
|
|
526
|
+
)
|
|
527
|
+
.try_next()
|
|
528
|
+
.await
|
|
529
|
+
.map(|x| x.is_some())
|
|
530
|
+
},
|
|
531
|
+
async {
|
|
532
|
+
tx.get(&self.subspace.pack(&has_wake_condition_key), Serializable)
|
|
533
|
+
.await
|
|
534
|
+
.map(|x| x.is_some())
|
|
535
|
+
},
|
|
536
|
+
async {
|
|
537
|
+
tx.get(&self.subspace.pack(&silence_ts_key), Serializable)
|
|
538
|
+
.await
|
|
539
|
+
.map(|x| x.is_some())
|
|
540
|
+
},
|
|
541
|
+
tx.get(&self.subspace.pack(&wake_sub_workflow_key), Serializable),
|
|
542
|
+
tx.get(&self.subspace.pack(&error_key), Serializable),
|
|
543
|
+
)?;
|
|
544
|
+
|
|
545
|
+
if is_silenced {
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
ensure!(!is_running, "cannot silence a running workflow");
|
|
550
|
+
|
|
551
|
+
for key in sub_workflow_wake_keys {
|
|
552
|
+
tracing::warn!(
|
|
553
|
+
"workflow {} is being waited on by sub workflow {}, silencing anyway",
|
|
554
|
+
key.workflow_id,
|
|
555
|
+
key.sub_workflow_id
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
for key in tag_keys {
|
|
560
|
+
let by_name_and_tag_key = keys::workflow::ByNameAndTagKey::new(
|
|
561
|
+
workflow_name.clone(),
|
|
562
|
+
key.k,
|
|
563
|
+
key.v,
|
|
564
|
+
workflow_id,
|
|
565
|
+
);
|
|
566
|
+
tx.clear(&self.subspace.pack(&by_name_and_tag_key));
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// Clear null key
|
|
570
|
+
{
|
|
571
|
+
let by_name_and_tag_key = keys::workflow::ByNameAndTagKey::null(
|
|
572
|
+
workflow_name.clone(),
|
|
573
|
+
workflow_id,
|
|
574
|
+
);
|
|
575
|
+
tx.clear(&self.subspace.pack(&by_name_and_tag_key));
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// Clear wake conditions
|
|
579
|
+
for (raw_key, key) in wake_condition_keys {
|
|
580
|
+
if key.workflow_id != workflow_id {
|
|
581
|
+
continue;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
tx.add_conflict_range(
|
|
585
|
+
&raw_key,
|
|
586
|
+
&end_of_key_range(&raw_key),
|
|
587
|
+
ConflictRangeType::Read,
|
|
588
|
+
)?;
|
|
589
|
+
|
|
590
|
+
tx.clear(&raw_key);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// Clear sub workflow secondary idx
|
|
594
|
+
if let Some(entry) = wake_sub_workflow_entry {
|
|
595
|
+
let sub_workflow_id = wake_sub_workflow_key.deserialize(&entry)?;
|
|
596
|
+
|
|
597
|
+
let sub_workflow_wake_key =
|
|
598
|
+
keys::wake::SubWorkflowWakeKey::new(sub_workflow_id, workflow_id);
|
|
599
|
+
|
|
600
|
+
tx.clear(&self.subspace.pack(&sub_workflow_wake_key));
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// Clear signals secondary index
|
|
604
|
+
let wake_signals_subspace = self
|
|
605
|
+
.subspace
|
|
606
|
+
.subspace(&keys::workflow::WakeSignalKey::subspace(workflow_id));
|
|
607
|
+
tx.clear_subspace_range(&wake_signals_subspace);
|
|
608
|
+
|
|
609
|
+
// Clear "has wake condition"
|
|
610
|
+
tx.clear(&self.subspace.pack(&has_wake_condition_key));
|
|
611
|
+
|
|
612
|
+
tx.set(
|
|
613
|
+
&self.subspace.pack(&silence_ts_key),
|
|
614
|
+
&silence_ts_key.serialize(rivet_util::timestamp::now())?,
|
|
615
|
+
);
|
|
616
|
+
|
|
617
|
+
// Clear metric
|
|
618
|
+
let metric = if has_output {
|
|
619
|
+
keys::metric::GaugeMetric::WorkflowComplete(workflow_name.clone())
|
|
620
|
+
} else if has_wake_condition {
|
|
621
|
+
let error =
|
|
622
|
+
error_key.deserialize(&error_entry.context("key should exist")?)?;
|
|
623
|
+
|
|
624
|
+
keys::metric::GaugeMetric::WorkflowDead(workflow_name.clone(), error)
|
|
625
|
+
} else {
|
|
626
|
+
keys::metric::GaugeMetric::WorkflowSleeping(workflow_name.clone())
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
update_metric(&tx.with_subspace(self.subspace.clone()), Some(metric), None);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
Ok(())
|
|
633
|
+
}
|
|
634
|
+
})
|
|
635
|
+
.await
|
|
636
|
+
.map_err(Into::into)
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
#[tracing::instrument(skip_all)]
|
|
640
|
+
async fn wake_workflows(&self, workflow_ids: Vec<Id>) -> Result<()> {
|
|
641
|
+
self.pools
|
|
642
|
+
.udb()?
|
|
643
|
+
.run(|tx| {
|
|
644
|
+
let workflow_ids = workflow_ids.clone();
|
|
645
|
+
async move {
|
|
646
|
+
let tx = tx.with_subspace(self.subspace.clone());
|
|
647
|
+
|
|
648
|
+
for workflow_id in workflow_ids {
|
|
649
|
+
let name_key = keys::workflow::NameKey::new(workflow_id);
|
|
650
|
+
let worker_id_key = keys::workflow::WorkerIdKey::new(workflow_id);
|
|
651
|
+
let has_wake_condition_key =
|
|
652
|
+
keys::workflow::HasWakeConditionKey::new(workflow_id);
|
|
653
|
+
let error_key = keys::workflow::ErrorKey::new(workflow_id);
|
|
654
|
+
let silence_ts_key = keys::workflow::SilenceTsKey::new(workflow_id);
|
|
655
|
+
let output_key = keys::workflow::OutputKey::new(workflow_id);
|
|
656
|
+
let output_subspace = self.subspace.subspace(&output_key);
|
|
657
|
+
|
|
658
|
+
let (
|
|
659
|
+
workflow_name,
|
|
660
|
+
is_running,
|
|
661
|
+
has_wake_condition,
|
|
662
|
+
is_silenced,
|
|
663
|
+
has_output,
|
|
664
|
+
error,
|
|
665
|
+
) = tokio::try_join!(
|
|
666
|
+
tx.read(&name_key, Serializable),
|
|
667
|
+
tx.exists(&worker_id_key, Serializable),
|
|
668
|
+
tx.exists(&has_wake_condition_key, Serializable),
|
|
669
|
+
tx.exists(&silence_ts_key, Serializable),
|
|
670
|
+
async {
|
|
671
|
+
tx.get_ranges_keyvalues(
|
|
672
|
+
RangeOption {
|
|
673
|
+
mode: StreamingMode::WantAll,
|
|
674
|
+
limit: Some(1),
|
|
675
|
+
..(&output_subspace).into()
|
|
676
|
+
},
|
|
677
|
+
Snapshot,
|
|
678
|
+
)
|
|
679
|
+
.try_next()
|
|
680
|
+
.await
|
|
681
|
+
.map_err(Into::into)
|
|
682
|
+
.map(|x| x.is_some())
|
|
683
|
+
},
|
|
684
|
+
tx.read_opt(&error_key, Serializable),
|
|
685
|
+
)?;
|
|
686
|
+
|
|
687
|
+
if is_running || is_silenced {
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
ensure!(!has_output, "cannot wake a completed workflow");
|
|
692
|
+
|
|
693
|
+
tx.write(
|
|
694
|
+
&keys::wake::WorkflowWakeConditionKey::new(
|
|
695
|
+
workflow_name.clone(),
|
|
696
|
+
workflow_id,
|
|
697
|
+
keys::wake::WakeCondition::Immediate,
|
|
698
|
+
),
|
|
699
|
+
(),
|
|
700
|
+
)?;
|
|
701
|
+
|
|
702
|
+
tx.write(&has_wake_condition_key, ())?;
|
|
703
|
+
|
|
704
|
+
if !has_wake_condition {
|
|
705
|
+
update_metric(
|
|
706
|
+
&tx,
|
|
707
|
+
Some(keys::metric::GaugeMetric::WorkflowDead(
|
|
708
|
+
workflow_name.clone(),
|
|
709
|
+
error.context("key should exist")?,
|
|
710
|
+
)),
|
|
711
|
+
Some(keys::metric::GaugeMetric::WorkflowSleeping(workflow_name)),
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
Ok(())
|
|
717
|
+
}
|
|
718
|
+
})
|
|
719
|
+
.instrument(tracing::info_span!("wake_workflows_tx"))
|
|
720
|
+
.await?;
|
|
721
|
+
|
|
722
|
+
self.bump(BumpSubSubject::Worker);
|
|
723
|
+
|
|
724
|
+
Ok(())
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
#[tracing::instrument(skip_all)]
|
|
728
|
+
async fn get_workflow_history(
|
|
729
|
+
&self,
|
|
730
|
+
workflow_id: Id,
|
|
731
|
+
include_forgotten: bool,
|
|
732
|
+
) -> Result<Option<HistoryData>> {
|
|
733
|
+
self.pools
|
|
734
|
+
.udb()?
|
|
735
|
+
.run(|tx| {
|
|
736
|
+
async move {
|
|
737
|
+
let history_subspace =
|
|
738
|
+
self.subspace
|
|
739
|
+
.subspace(&keys::history::HistorySubspaceKey::new(
|
|
740
|
+
workflow_id,
|
|
741
|
+
if include_forgotten {
|
|
742
|
+
keys::history::HistorySubspaceVariant::All
|
|
743
|
+
} else {
|
|
744
|
+
keys::history::HistorySubspaceVariant::Active
|
|
745
|
+
},
|
|
746
|
+
));
|
|
747
|
+
|
|
748
|
+
let (wf, events) = tokio::try_join!(
|
|
749
|
+
async {
|
|
750
|
+
self.get_workflows(vec![workflow_id])
|
|
751
|
+
.await
|
|
752
|
+
.map(|wfs| wfs.into_iter().next())
|
|
753
|
+
},
|
|
754
|
+
async {
|
|
755
|
+
let mut events_by_location: HashMap<Location, Vec<Event>> =
|
|
756
|
+
HashMap::new();
|
|
757
|
+
let mut current_event =
|
|
758
|
+
WorkflowHistoryEventBuilder::new(Location::empty(), false);
|
|
759
|
+
|
|
760
|
+
let mut stream = tx.get_ranges_keyvalues(
|
|
761
|
+
RangeOption {
|
|
762
|
+
mode: StreamingMode::WantAll,
|
|
763
|
+
..(&history_subspace).into()
|
|
764
|
+
},
|
|
765
|
+
Serializable,
|
|
766
|
+
);
|
|
767
|
+
|
|
768
|
+
loop {
|
|
769
|
+
let Some(entry) = stream.try_next().await? else {
|
|
770
|
+
break;
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
// Parse only the wf id and location of the current key
|
|
774
|
+
let partial_key = self
|
|
775
|
+
.subspace
|
|
776
|
+
.unpack::<keys::history::PartialEventKey>(entry.key())?;
|
|
777
|
+
|
|
778
|
+
if current_event.location != partial_key.location {
|
|
779
|
+
if current_event.location.is_empty() {
|
|
780
|
+
current_event = WorkflowHistoryEventBuilder::new(
|
|
781
|
+
partial_key.location,
|
|
782
|
+
partial_key.forgotten,
|
|
783
|
+
);
|
|
784
|
+
} else {
|
|
785
|
+
// Insert current event builder to into wf events and
|
|
786
|
+
// reset state
|
|
787
|
+
let previous_event = std::mem::replace(
|
|
788
|
+
&mut current_event,
|
|
789
|
+
WorkflowHistoryEventBuilder::new(
|
|
790
|
+
partial_key.location,
|
|
791
|
+
partial_key.forgotten,
|
|
792
|
+
),
|
|
793
|
+
);
|
|
794
|
+
events_by_location
|
|
795
|
+
.entry(previous_event.location.root())
|
|
796
|
+
.or_default()
|
|
797
|
+
.push(Event::try_from(previous_event)?);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// Parse current key as any event key
|
|
802
|
+
if let Ok(key) = self
|
|
803
|
+
.subspace
|
|
804
|
+
.unpack::<keys::history::EventTypeKey>(entry.key())
|
|
805
|
+
{
|
|
806
|
+
let event_type = key.deserialize(entry.value())?;
|
|
807
|
+
|
|
808
|
+
current_event.event_type = Some(event_type);
|
|
809
|
+
} else if let Ok(key) = self
|
|
810
|
+
.subspace
|
|
811
|
+
.unpack::<keys::history::VersionKey>(entry.key())
|
|
812
|
+
{
|
|
813
|
+
let version = key.deserialize(entry.value())?;
|
|
814
|
+
|
|
815
|
+
current_event.version = Some(version);
|
|
816
|
+
} else if let Ok(key) = self
|
|
817
|
+
.subspace
|
|
818
|
+
.unpack::<keys::history::CreateTsKey>(entry.key())
|
|
819
|
+
{
|
|
820
|
+
let create_ts = key.deserialize(entry.value())?;
|
|
821
|
+
|
|
822
|
+
current_event.create_ts = Some(create_ts);
|
|
823
|
+
} else if let Ok(key) =
|
|
824
|
+
self.subspace.unpack::<keys::history::NameKey>(entry.key())
|
|
825
|
+
{
|
|
826
|
+
let name = key.deserialize(entry.value())?;
|
|
827
|
+
|
|
828
|
+
current_event.name = Some(name);
|
|
829
|
+
} else if let Ok(key) = self
|
|
830
|
+
.subspace
|
|
831
|
+
.unpack::<keys::history::SignalIdKey>(entry.key())
|
|
832
|
+
{
|
|
833
|
+
let signal_id = key.deserialize(entry.value())?;
|
|
834
|
+
|
|
835
|
+
current_event.signal_id = Some(signal_id);
|
|
836
|
+
} else if let Ok(key) = self
|
|
837
|
+
.subspace
|
|
838
|
+
.unpack::<keys::history::SubWorkflowIdKey>(entry.key())
|
|
839
|
+
{
|
|
840
|
+
let sub_workflow_id = key.deserialize(entry.value())?;
|
|
841
|
+
|
|
842
|
+
current_event.sub_workflow_id = Some(sub_workflow_id);
|
|
843
|
+
} else if let Ok(_key) = self
|
|
844
|
+
.subspace
|
|
845
|
+
.unpack::<keys::history::InputChunkKey>(entry.key())
|
|
846
|
+
{
|
|
847
|
+
current_event.input_chunks.push(entry);
|
|
848
|
+
} else if let Ok(_key) = self
|
|
849
|
+
.subspace
|
|
850
|
+
.unpack::<keys::history::OutputChunkKey>(entry.key())
|
|
851
|
+
{
|
|
852
|
+
current_event.output_chunks.push(entry);
|
|
853
|
+
} else if let Ok(key) =
|
|
854
|
+
self.subspace.unpack::<keys::history::ErrorKey>(entry.key())
|
|
855
|
+
{
|
|
856
|
+
if let Some(err) = current_event
|
|
857
|
+
.errors
|
|
858
|
+
.iter_mut()
|
|
859
|
+
.find(|err| err.error == key.error)
|
|
860
|
+
{
|
|
861
|
+
err.count += 1;
|
|
862
|
+
err.latest_ts = err.latest_ts.max(key.ts);
|
|
863
|
+
} else {
|
|
864
|
+
current_event.errors.push(ActivityError {
|
|
865
|
+
error: key.error,
|
|
866
|
+
count: 1,
|
|
867
|
+
latest_ts: key.ts,
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
} else if let Ok(key) = self
|
|
871
|
+
.subspace
|
|
872
|
+
.unpack::<keys::history::IterationKey>(entry.key())
|
|
873
|
+
{
|
|
874
|
+
let iteration = key.deserialize(entry.value())?;
|
|
875
|
+
|
|
876
|
+
current_event.iteration = Some(iteration);
|
|
877
|
+
} else if let Ok(key) = self
|
|
878
|
+
.subspace
|
|
879
|
+
.unpack::<keys::history::DeadlineTsKey>(entry.key())
|
|
880
|
+
{
|
|
881
|
+
let deadline_ts = key.deserialize(entry.value())?;
|
|
882
|
+
|
|
883
|
+
current_event.deadline_ts = Some(deadline_ts);
|
|
884
|
+
} else if let Ok(key) = self
|
|
885
|
+
.subspace
|
|
886
|
+
.unpack::<keys::history::SleepStateKey>(entry.key())
|
|
887
|
+
{
|
|
888
|
+
let sleep_state = key.deserialize(entry.value())?;
|
|
889
|
+
|
|
890
|
+
current_event.sleep_state = Some(sleep_state);
|
|
891
|
+
} else if let Ok(key) =
|
|
892
|
+
self.subspace
|
|
893
|
+
.unpack::<keys::history::InnerEventTypeKey>(entry.key())
|
|
894
|
+
{
|
|
895
|
+
let inner_event_type = key.deserialize(entry.value())?;
|
|
896
|
+
|
|
897
|
+
current_event.inner_event_type = Some(inner_event_type);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// We ignore keys we don't need (like tags)
|
|
901
|
+
}
|
|
902
|
+
// Insert final event
|
|
903
|
+
if !current_event.location.is_empty() {
|
|
904
|
+
events_by_location
|
|
905
|
+
.entry(current_event.location.root())
|
|
906
|
+
.or_default()
|
|
907
|
+
.push(Event::try_from(current_event)?);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
Ok(events_by_location)
|
|
911
|
+
}
|
|
912
|
+
)?;
|
|
913
|
+
|
|
914
|
+
let Some(wf) = wf else {
|
|
915
|
+
return Ok(None);
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
let mut flat_events =
|
|
919
|
+
events.into_iter().flat_map(|(_, v)| v).collect::<Vec<_>>();
|
|
920
|
+
flat_events.sort_by(|a, b| a.location.cmp(&b.location));
|
|
921
|
+
|
|
922
|
+
Ok(Some(HistoryData {
|
|
923
|
+
wf,
|
|
924
|
+
events: flat_events,
|
|
925
|
+
}))
|
|
926
|
+
}
|
|
927
|
+
})
|
|
928
|
+
.instrument(tracing::info_span!("pull_workflow_history_tx"))
|
|
929
|
+
.await
|
|
930
|
+
.map_err(Into::into)
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
#[tracing::instrument(skip_all)]
|
|
934
|
+
async fn get_signals(&self, signal_ids: Vec<Id>) -> Result<Vec<SignalData>> {
|
|
935
|
+
self.pools
|
|
936
|
+
.udb()?
|
|
937
|
+
.run(|tx| {
|
|
938
|
+
let signal_ids = signal_ids.clone();
|
|
939
|
+
async move { self.get_signals_inner(signal_ids, &tx).await }
|
|
940
|
+
})
|
|
941
|
+
.instrument(tracing::info_span!("get_signals_tx"))
|
|
942
|
+
.await
|
|
943
|
+
.map_err(Into::into)
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
#[tracing::instrument(skip_all)]
|
|
947
|
+
async fn find_signals(
|
|
948
|
+
&self,
|
|
949
|
+
_tags: &[(String, String)],
|
|
950
|
+
workflow_id: Option<Id>,
|
|
951
|
+
name: Option<&str>,
|
|
952
|
+
state: Option<SignalState>,
|
|
953
|
+
) -> Result<Vec<SignalData>> {
|
|
954
|
+
// NOTE: this does a full scan of all keys under signal/data and filters in memory
|
|
955
|
+
self.pools
|
|
956
|
+
.udb()?
|
|
957
|
+
.run(|tx| {
|
|
958
|
+
let name = name.clone();
|
|
959
|
+
let workflow_id = workflow_id.clone();
|
|
960
|
+
async move {
|
|
961
|
+
let mut signal_ids = Vec::new();
|
|
962
|
+
|
|
963
|
+
let data_subspace = self
|
|
964
|
+
.subspace
|
|
965
|
+
.subspace(&keys::signal::DataSubspaceKey::new());
|
|
966
|
+
|
|
967
|
+
let mut stream = tx.get_ranges_keyvalues(
|
|
968
|
+
RangeOption {
|
|
969
|
+
mode: StreamingMode::Iterator,
|
|
970
|
+
..(&data_subspace).into()
|
|
971
|
+
},
|
|
972
|
+
Snapshot,
|
|
973
|
+
);
|
|
974
|
+
|
|
975
|
+
let mut current_signal_id = None;
|
|
976
|
+
let mut name_matches = name.is_none();
|
|
977
|
+
let mut workflow_id_matches = workflow_id.is_none();
|
|
978
|
+
let mut state_matches = state.is_none() || state == Some(SignalState::Pending);
|
|
979
|
+
|
|
980
|
+
while let Some(entry) = stream.try_next().await? {
|
|
981
|
+
let signal_id = *self.subspace.unpack::<JustId>(entry.key())?;
|
|
982
|
+
|
|
983
|
+
if let Some(curr) = current_signal_id {
|
|
984
|
+
if signal_id != curr {
|
|
985
|
+
// Save if matches query
|
|
986
|
+
if name_matches && workflow_id_matches && state_matches {
|
|
987
|
+
signal_ids.push(curr);
|
|
988
|
+
|
|
989
|
+
if signal_ids.len() >= 100 {
|
|
990
|
+
current_signal_id = None;
|
|
991
|
+
break;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// Reset state
|
|
996
|
+
name_matches = name.is_none();
|
|
997
|
+
workflow_id_matches = workflow_id.is_none();
|
|
998
|
+
state_matches =
|
|
999
|
+
state.is_none() || state == Some(SignalState::Pending);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
current_signal_id = Some(signal_id);
|
|
1004
|
+
|
|
1005
|
+
if let Ok(name_key) =
|
|
1006
|
+
self.subspace.unpack::<keys::signal::NameKey>(entry.key())
|
|
1007
|
+
{
|
|
1008
|
+
if let Some(name) = &name {
|
|
1009
|
+
let signal_name = name_key.deserialize(entry.value())?;
|
|
1010
|
+
|
|
1011
|
+
name_matches = &signal_name == name;
|
|
1012
|
+
}
|
|
1013
|
+
} else if let Ok(workflow_id_key) = self
|
|
1014
|
+
.subspace
|
|
1015
|
+
.unpack::<keys::signal::WorkflowIdKey>(entry.key())
|
|
1016
|
+
{
|
|
1017
|
+
if let Some(workflow_id) = &workflow_id {
|
|
1018
|
+
let signal_workflow_id =
|
|
1019
|
+
workflow_id_key.deserialize(entry.value())?;
|
|
1020
|
+
|
|
1021
|
+
workflow_id_matches = &signal_workflow_id == workflow_id;
|
|
1022
|
+
}
|
|
1023
|
+
} else if let Ok(_) =
|
|
1024
|
+
self.subspace.unpack::<keys::signal::AckTsKey>(entry.key())
|
|
1025
|
+
{
|
|
1026
|
+
// Has ack timestamp
|
|
1027
|
+
match state {
|
|
1028
|
+
Some(SignalState::Acked) => state_matches = true,
|
|
1029
|
+
Some(SignalState::Pending) => state_matches = false,
|
|
1030
|
+
_ => {}
|
|
1031
|
+
}
|
|
1032
|
+
} else if let Ok(_) = self
|
|
1033
|
+
.subspace
|
|
1034
|
+
.unpack::<keys::signal::SilenceTsKey>(entry.key())
|
|
1035
|
+
{
|
|
1036
|
+
match state {
|
|
1037
|
+
Some(SignalState::Silenced) => state_matches = true,
|
|
1038
|
+
_ => state_matches = false,
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
if let (Some(signal_id), true) = (
|
|
1044
|
+
current_signal_id,
|
|
1045
|
+
name_matches && workflow_id_matches && state_matches,
|
|
1046
|
+
) {
|
|
1047
|
+
signal_ids.push(signal_id);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
let signals = self.get_signals_inner(signal_ids, &tx).await?;
|
|
1051
|
+
|
|
1052
|
+
Ok(signals)
|
|
1053
|
+
}
|
|
1054
|
+
})
|
|
1055
|
+
.instrument(tracing::info_span!("find_signals_tx"))
|
|
1056
|
+
.await
|
|
1057
|
+
.map_err(Into::into)
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
#[tracing::instrument(skip_all)]
|
|
1061
|
+
async fn silence_signals(&self, signal_ids: Vec<Id>) -> Result<()> {
|
|
1062
|
+
self.pools
|
|
1063
|
+
.udb()?
|
|
1064
|
+
.run(|tx| {
|
|
1065
|
+
let signal_ids = signal_ids.clone();
|
|
1066
|
+
|
|
1067
|
+
async move {
|
|
1068
|
+
// TODO: Parallelize
|
|
1069
|
+
for signal_id in signal_ids {
|
|
1070
|
+
let signal_name_key = keys::signal::NameKey::new(signal_id);
|
|
1071
|
+
let create_ts_key = keys::signal::CreateTsKey::new(signal_id);
|
|
1072
|
+
let workflow_id_key = keys::signal::WorkflowIdKey::new(signal_id);
|
|
1073
|
+
let silence_ts_key = keys::signal::SilenceTsKey::new(signal_id);
|
|
1074
|
+
let ack_ts_key = keys::signal::AckTsKey::new(signal_id);
|
|
1075
|
+
|
|
1076
|
+
let (
|
|
1077
|
+
signal_name_entry,
|
|
1078
|
+
create_ts_entry,
|
|
1079
|
+
workflow_id_entry,
|
|
1080
|
+
silence_ts_entry,
|
|
1081
|
+
ack_ts_entry,
|
|
1082
|
+
) = tokio::try_join!(
|
|
1083
|
+
tx.get(&self.subspace.pack(&signal_name_key), Serializable),
|
|
1084
|
+
tx.get(&self.subspace.pack(&create_ts_key), Serializable),
|
|
1085
|
+
tx.get(&self.subspace.pack(&workflow_id_key), Serializable),
|
|
1086
|
+
tx.get(&self.subspace.pack(&silence_ts_key), Serializable),
|
|
1087
|
+
tx.get(&self.subspace.pack(&ack_ts_key), Serializable),
|
|
1088
|
+
)?;
|
|
1089
|
+
|
|
1090
|
+
if silence_ts_entry.is_some() {
|
|
1091
|
+
continue;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
let Some(signal_name_entry) = signal_name_entry else {
|
|
1095
|
+
tracing::warn!(?signal_id, "signal not found");
|
|
1096
|
+
continue;
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
let signal_name = signal_name_key.deserialize(&signal_name_entry)?;
|
|
1100
|
+
|
|
1101
|
+
let create_ts = create_ts_key
|
|
1102
|
+
.deserialize(&create_ts_entry.context("key should exist")?)?;
|
|
1103
|
+
|
|
1104
|
+
let workflow_id = workflow_id_key
|
|
1105
|
+
.deserialize(&workflow_id_entry.context("key should exist")?)?;
|
|
1106
|
+
|
|
1107
|
+
let workflow_name_key = keys::workflow::NameKey::new(workflow_id);
|
|
1108
|
+
|
|
1109
|
+
let workflow_name_entry = tx
|
|
1110
|
+
.get(&self.subspace.pack(&workflow_name_key), Serializable)
|
|
1111
|
+
.await?;
|
|
1112
|
+
|
|
1113
|
+
let workflow_name = workflow_name_key
|
|
1114
|
+
.deserialize(&workflow_name_entry.context("key should exist")?)?;
|
|
1115
|
+
|
|
1116
|
+
// Clear pending key
|
|
1117
|
+
let mut pending_signal_key = keys::workflow::PendingSignalKey::new(
|
|
1118
|
+
workflow_id,
|
|
1119
|
+
signal_name.clone(),
|
|
1120
|
+
signal_id,
|
|
1121
|
+
);
|
|
1122
|
+
pending_signal_key.ts = create_ts;
|
|
1123
|
+
tx.clear(&self.subspace.pack(&pending_signal_key));
|
|
1124
|
+
|
|
1125
|
+
// Clear wake condition
|
|
1126
|
+
let mut wake_condition_key = keys::wake::WorkflowWakeConditionKey::new(
|
|
1127
|
+
workflow_name,
|
|
1128
|
+
workflow_id,
|
|
1129
|
+
keys::wake::WakeCondition::Signal { signal_id },
|
|
1130
|
+
);
|
|
1131
|
+
wake_condition_key.ts = create_ts;
|
|
1132
|
+
tx.clear(&self.subspace.pack(&wake_condition_key));
|
|
1133
|
+
|
|
1134
|
+
tx.set(
|
|
1135
|
+
&self.subspace.pack(&silence_ts_key),
|
|
1136
|
+
&silence_ts_key.serialize(rivet_util::timestamp::now())?,
|
|
1137
|
+
);
|
|
1138
|
+
|
|
1139
|
+
if ack_ts_entry.is_none() {
|
|
1140
|
+
update_metric(
|
|
1141
|
+
&tx.with_subspace(self.subspace.clone()),
|
|
1142
|
+
Some(keys::metric::GaugeMetric::SignalPending(signal_name)),
|
|
1143
|
+
None,
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
Ok(())
|
|
1149
|
+
}
|
|
1150
|
+
})
|
|
1151
|
+
.await
|
|
1152
|
+
.map_err(Into::into)
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
// Parses Id in third position, ignores the rest
|
|
1157
|
+
pub(crate) struct JustId(Id);
|
|
1158
|
+
|
|
1159
|
+
impl<'de> TupleUnpack<'de> for JustId {
|
|
1160
|
+
fn unpack(input: &[u8], tuple_depth: TupleDepth) -> PackResult<(&[u8], Self)> {
|
|
1161
|
+
let (input, (_, _, id)) = <(usize, usize, Id)>::unpack(input, tuple_depth)?;
|
|
1162
|
+
let v = JustId(id);
|
|
1163
|
+
|
|
1164
|
+
Ok((&input[0..0], v))
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
impl Deref for JustId {
|
|
1169
|
+
type Target = Id;
|
|
1170
|
+
|
|
1171
|
+
fn deref(&self) -> &Self::Target {
|
|
1172
|
+
&self.0
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
struct WorkflowHistoryEventBuilder {
|
|
1177
|
+
location: Location,
|
|
1178
|
+
event_type: Option<EventType>,
|
|
1179
|
+
version: Option<usize>,
|
|
1180
|
+
create_ts: Option<i64>,
|
|
1181
|
+
forgotten: bool,
|
|
1182
|
+
name: Option<String>,
|
|
1183
|
+
signal_id: Option<Id>,
|
|
1184
|
+
sub_workflow_id: Option<Id>,
|
|
1185
|
+
input_chunks: Vec<Value>,
|
|
1186
|
+
output_chunks: Vec<Value>,
|
|
1187
|
+
tags: Vec<(String, String)>,
|
|
1188
|
+
errors: Vec<ActivityError>,
|
|
1189
|
+
iteration: Option<usize>,
|
|
1190
|
+
deadline_ts: Option<i64>,
|
|
1191
|
+
sleep_state: Option<SleepState>,
|
|
1192
|
+
inner_event_type: Option<EventType>,
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
impl WorkflowHistoryEventBuilder {
|
|
1196
|
+
fn new(location: Location, forgotten: bool) -> Self {
|
|
1197
|
+
WorkflowHistoryEventBuilder {
|
|
1198
|
+
location,
|
|
1199
|
+
event_type: None,
|
|
1200
|
+
version: None,
|
|
1201
|
+
create_ts: None,
|
|
1202
|
+
forgotten,
|
|
1203
|
+
name: None,
|
|
1204
|
+
signal_id: None,
|
|
1205
|
+
sub_workflow_id: None,
|
|
1206
|
+
input_chunks: Vec::new(),
|
|
1207
|
+
output_chunks: Vec::new(),
|
|
1208
|
+
tags: Vec::new(),
|
|
1209
|
+
errors: Vec::new(),
|
|
1210
|
+
iteration: None,
|
|
1211
|
+
deadline_ts: None,
|
|
1212
|
+
sleep_state: None,
|
|
1213
|
+
inner_event_type: None,
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for Event {
|
|
1219
|
+
type Error = WorkflowError;
|
|
1220
|
+
|
|
1221
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1222
|
+
let event_type = value
|
|
1223
|
+
.event_type
|
|
1224
|
+
.ok_or(WorkflowError::MissingEventData("event_type"))?;
|
|
1225
|
+
|
|
1226
|
+
Ok(Event {
|
|
1227
|
+
location: value.location.clone(),
|
|
1228
|
+
version: value
|
|
1229
|
+
.version
|
|
1230
|
+
.ok_or(WorkflowError::MissingEventData("version"))?,
|
|
1231
|
+
create_ts: value
|
|
1232
|
+
.create_ts
|
|
1233
|
+
.ok_or(WorkflowError::MissingEventData("create_ts"))?,
|
|
1234
|
+
forgotten: value.forgotten,
|
|
1235
|
+
data: match event_type {
|
|
1236
|
+
EventType::Activity => EventData::Activity(value.try_into()?),
|
|
1237
|
+
EventType::Signal => EventData::Signal(value.try_into()?),
|
|
1238
|
+
EventType::SignalSend => EventData::SignalSend(value.try_into()?),
|
|
1239
|
+
EventType::MessageSend => EventData::MessageSend(value.try_into()?),
|
|
1240
|
+
EventType::SubWorkflow => EventData::SubWorkflow(value.try_into()?),
|
|
1241
|
+
EventType::Loop => EventData::Loop(value.try_into()?),
|
|
1242
|
+
EventType::Sleep => EventData::Sleep(value.try_into()?),
|
|
1243
|
+
EventType::Branch => EventData::Branch,
|
|
1244
|
+
EventType::Removed => EventData::Removed(value.try_into()?),
|
|
1245
|
+
EventType::VersionCheck => EventData::VersionCheck,
|
|
1246
|
+
},
|
|
1247
|
+
})
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for ActivityEvent {
|
|
1252
|
+
type Error = WorkflowError;
|
|
1253
|
+
|
|
1254
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1255
|
+
Ok(ActivityEvent {
|
|
1256
|
+
name: value.name.ok_or(WorkflowError::MissingEventData("name"))?,
|
|
1257
|
+
input: {
|
|
1258
|
+
if value.input_chunks.is_empty() {
|
|
1259
|
+
return Err(WorkflowError::MissingEventData("input"));
|
|
1260
|
+
} else {
|
|
1261
|
+
// workflow_id not needed
|
|
1262
|
+
let input_key = keys::history::InputKey::new(Id::nil(), value.location.clone());
|
|
1263
|
+
let v = input_key
|
|
1264
|
+
.combine(value.input_chunks)
|
|
1265
|
+
.map_err(WorkflowError::DeserializeEventData)?;
|
|
1266
|
+
|
|
1267
|
+
serde_json::from_str(v.get())
|
|
1268
|
+
.map_err(Into::into)
|
|
1269
|
+
.map_err(WorkflowError::DeserializeEventData)?
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1272
|
+
output: {
|
|
1273
|
+
if value.output_chunks.is_empty() {
|
|
1274
|
+
None
|
|
1275
|
+
} else {
|
|
1276
|
+
// workflow_id not needed
|
|
1277
|
+
let output_key =
|
|
1278
|
+
keys::history::OutputKey::new(Id::nil(), value.location.clone());
|
|
1279
|
+
let v = output_key
|
|
1280
|
+
.combine(value.output_chunks)
|
|
1281
|
+
.map_err(WorkflowError::DeserializeEventData)?;
|
|
1282
|
+
|
|
1283
|
+
Some(
|
|
1284
|
+
serde_json::from_str(v.get())
|
|
1285
|
+
.map_err(Into::into)
|
|
1286
|
+
.map_err(WorkflowError::DeserializeEventData)?,
|
|
1287
|
+
)
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
errors: value.errors,
|
|
1291
|
+
})
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for SignalEvent {
|
|
1296
|
+
type Error = WorkflowError;
|
|
1297
|
+
|
|
1298
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1299
|
+
Ok(SignalEvent {
|
|
1300
|
+
signal_id: value
|
|
1301
|
+
.signal_id
|
|
1302
|
+
.ok_or(WorkflowError::MissingEventData("signal_id"))?,
|
|
1303
|
+
name: value.name.ok_or(WorkflowError::MissingEventData("name"))?,
|
|
1304
|
+
body: {
|
|
1305
|
+
if value.input_chunks.is_empty() {
|
|
1306
|
+
return Err(WorkflowError::MissingEventData("input"));
|
|
1307
|
+
} else {
|
|
1308
|
+
// workflow_id not needed
|
|
1309
|
+
let input_key = keys::history::InputKey::new(Id::nil(), value.location);
|
|
1310
|
+
let v = input_key
|
|
1311
|
+
.combine(value.input_chunks)
|
|
1312
|
+
.map_err(WorkflowError::DeserializeEventData)?;
|
|
1313
|
+
|
|
1314
|
+
serde_json::from_str(v.get())
|
|
1315
|
+
.map_err(Into::into)
|
|
1316
|
+
.map_err(WorkflowError::DeserializeEventData)?
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
})
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for SignalSendEvent {
|
|
1324
|
+
type Error = WorkflowError;
|
|
1325
|
+
|
|
1326
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1327
|
+
Ok(SignalSendEvent {
|
|
1328
|
+
signal_id: value
|
|
1329
|
+
.signal_id
|
|
1330
|
+
.ok_or(WorkflowError::MissingEventData("signal_id"))?,
|
|
1331
|
+
name: value.name.ok_or(WorkflowError::MissingEventData("name"))?,
|
|
1332
|
+
workflow_id: value.sub_workflow_id,
|
|
1333
|
+
tags: None,
|
|
1334
|
+
body: {
|
|
1335
|
+
if value.input_chunks.is_empty() {
|
|
1336
|
+
return Err(WorkflowError::MissingEventData("input"));
|
|
1337
|
+
} else {
|
|
1338
|
+
// workflow_id not needed
|
|
1339
|
+
let input_key = keys::history::InputKey::new(Id::nil(), value.location);
|
|
1340
|
+
let v = input_key
|
|
1341
|
+
.combine(value.input_chunks)
|
|
1342
|
+
.map_err(WorkflowError::DeserializeEventData)?;
|
|
1343
|
+
|
|
1344
|
+
serde_json::from_str(v.get())
|
|
1345
|
+
.map_err(Into::into)
|
|
1346
|
+
.map_err(WorkflowError::DeserializeEventData)?
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
1349
|
+
})
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for MessageSendEvent {
|
|
1354
|
+
type Error = WorkflowError;
|
|
1355
|
+
|
|
1356
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1357
|
+
Ok(MessageSendEvent {
|
|
1358
|
+
name: value.name.ok_or(WorkflowError::MissingEventData("name"))?,
|
|
1359
|
+
tags: serde_json::Value::Object(
|
|
1360
|
+
value
|
|
1361
|
+
.tags
|
|
1362
|
+
.into_iter()
|
|
1363
|
+
.map(|(k, v)| (k, serde_json::Value::String(v)))
|
|
1364
|
+
.collect(),
|
|
1365
|
+
),
|
|
1366
|
+
body: {
|
|
1367
|
+
if value.input_chunks.is_empty() {
|
|
1368
|
+
return Err(WorkflowError::MissingEventData("input"));
|
|
1369
|
+
} else {
|
|
1370
|
+
// workflow_id not needed
|
|
1371
|
+
let input_key = keys::history::InputKey::new(Id::nil(), value.location);
|
|
1372
|
+
let v = input_key
|
|
1373
|
+
.combine(value.input_chunks)
|
|
1374
|
+
.map_err(WorkflowError::DeserializeEventData)?;
|
|
1375
|
+
|
|
1376
|
+
serde_json::from_str(v.get())
|
|
1377
|
+
.map_err(Into::into)
|
|
1378
|
+
.map_err(WorkflowError::DeserializeEventData)?
|
|
1379
|
+
}
|
|
1380
|
+
},
|
|
1381
|
+
})
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for SubWorkflowEvent {
|
|
1386
|
+
type Error = WorkflowError;
|
|
1387
|
+
|
|
1388
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1389
|
+
Ok(SubWorkflowEvent {
|
|
1390
|
+
sub_workflow_id: value
|
|
1391
|
+
.sub_workflow_id
|
|
1392
|
+
.ok_or(WorkflowError::MissingEventData("sub_workflow_id"))?,
|
|
1393
|
+
name: value.name.ok_or(WorkflowError::MissingEventData("name"))?,
|
|
1394
|
+
tags: serde_json::Value::Object(
|
|
1395
|
+
value
|
|
1396
|
+
.tags
|
|
1397
|
+
.into_iter()
|
|
1398
|
+
.map(|(k, v)| (k, serde_json::Value::String(v)))
|
|
1399
|
+
.collect(),
|
|
1400
|
+
),
|
|
1401
|
+
input: {
|
|
1402
|
+
if value.input_chunks.is_empty() {
|
|
1403
|
+
return Err(WorkflowError::MissingEventData("input"));
|
|
1404
|
+
} else {
|
|
1405
|
+
// workflow_id not needed
|
|
1406
|
+
let input_key = keys::history::InputKey::new(Id::nil(), value.location);
|
|
1407
|
+
let v = input_key
|
|
1408
|
+
.combine(value.input_chunks)
|
|
1409
|
+
.map_err(WorkflowError::DeserializeEventData)?;
|
|
1410
|
+
|
|
1411
|
+
serde_json::from_str(v.get())
|
|
1412
|
+
.map_err(Into::into)
|
|
1413
|
+
.map_err(WorkflowError::DeserializeEventData)?
|
|
1414
|
+
}
|
|
1415
|
+
},
|
|
1416
|
+
})
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for LoopEvent {
|
|
1421
|
+
type Error = WorkflowError;
|
|
1422
|
+
|
|
1423
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1424
|
+
Ok(LoopEvent {
|
|
1425
|
+
state: {
|
|
1426
|
+
if value.input_chunks.is_empty() {
|
|
1427
|
+
return Err(WorkflowError::MissingEventData("input"));
|
|
1428
|
+
} else {
|
|
1429
|
+
// workflow_id not needed
|
|
1430
|
+
let input_key = keys::history::InputKey::new(Id::nil(), value.location.clone());
|
|
1431
|
+
let v = input_key
|
|
1432
|
+
.combine(value.input_chunks)
|
|
1433
|
+
.map_err(WorkflowError::DeserializeEventData)?;
|
|
1434
|
+
|
|
1435
|
+
serde_json::from_str(v.get())
|
|
1436
|
+
.map_err(Into::into)
|
|
1437
|
+
.map_err(WorkflowError::DeserializeEventData)?
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
output: {
|
|
1441
|
+
if value.output_chunks.is_empty() {
|
|
1442
|
+
None
|
|
1443
|
+
} else {
|
|
1444
|
+
// workflow_id not needed
|
|
1445
|
+
let output_key =
|
|
1446
|
+
keys::history::OutputKey::new(Id::nil(), value.location.clone());
|
|
1447
|
+
let v = output_key
|
|
1448
|
+
.combine(value.output_chunks)
|
|
1449
|
+
.map_err(WorkflowError::DeserializeEventData)?;
|
|
1450
|
+
|
|
1451
|
+
Some(
|
|
1452
|
+
serde_json::from_str(v.get())
|
|
1453
|
+
.map_err(Into::into)
|
|
1454
|
+
.map_err(WorkflowError::DeserializeEventData)?,
|
|
1455
|
+
)
|
|
1456
|
+
}
|
|
1457
|
+
},
|
|
1458
|
+
iteration: value
|
|
1459
|
+
.iteration
|
|
1460
|
+
.ok_or(WorkflowError::MissingEventData("iteration"))?
|
|
1461
|
+
.try_into()
|
|
1462
|
+
.map_err(|_| WorkflowError::IntegerConversion)?,
|
|
1463
|
+
})
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for SleepEvent {
|
|
1468
|
+
type Error = WorkflowError;
|
|
1469
|
+
|
|
1470
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1471
|
+
Ok(SleepEvent {
|
|
1472
|
+
deadline_ts: value
|
|
1473
|
+
.deadline_ts
|
|
1474
|
+
.ok_or(WorkflowError::MissingEventData("deadline_ts"))?,
|
|
1475
|
+
state: value
|
|
1476
|
+
.sleep_state
|
|
1477
|
+
.ok_or(WorkflowError::MissingEventData("sleep_state"))?,
|
|
1478
|
+
})
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
impl TryFrom<WorkflowHistoryEventBuilder> for RemovedEvent {
|
|
1483
|
+
type Error = WorkflowError;
|
|
1484
|
+
|
|
1485
|
+
fn try_from(value: WorkflowHistoryEventBuilder) -> WorkflowResult<Self> {
|
|
1486
|
+
Ok(RemovedEvent {
|
|
1487
|
+
name: value.name,
|
|
1488
|
+
event_type: value
|
|
1489
|
+
.inner_event_type
|
|
1490
|
+
.ok_or(WorkflowError::MissingEventData("inner_event_type"))?,
|
|
1491
|
+
})
|
|
1492
|
+
}
|
|
1493
|
+
}
|