Expand description
#3562 (slice G1): the Worker groups of bynk.toml.
Under the workers target a context is one Worker. A group puts several
contexts in one Worker, so a handful of contexts that belong together need
not each cost a Worker and a network hop:
[deploy.workers.core]
contexts = ["shop.orders", "shop.catalogue", "shop.pricing"]
[deploy.workers.payments]
contexts = ["shop.payment"]
name = "acme-payments" # the Cloudflare script name; default is the key
routes = ["pay.example.com/*"]The key is the group’s identity (its ledger entry, its --worker
selector, its workers/<key>/ directory); name only overrides the
script’s name on Cloudflare. A context named in no group stays one Worker
under its dashed name, so a project with no [deploy.workers] is unchanged.
This module reads the table and checks everything that needs no project
model: shapes, the grammar of names, a context in two groups, two groups
sharing a script name, a route or domain claimed twice. What needs the
project’s contexts (an unknown context, a context that is not deployable,
a key that collides with an implicit Worker’s name) is checked against them
by validate_against.
Structs§
- Group
Issue - A rule the groups break against the project’s contexts.
- Project
Units - The units of a project, by kind, as
validate_againstneeds them. - Worker
Group - One group’s
[deploy.workers.<key>]entry.
Constants§
- GROUP_
KEYS - The keys of a
[deploy.workers.<key>]entry.
Functions§
- deploy_
workers_ from - The
[deploy]table’sworkersentries. - is_
qualified_ name - Whether
nameis a qualified context name: dot-separated segments, each an identifier (letters, digits and_, not starting with a digit). - is_
worker_ name - Whether
namecan be a Worker’s key or script name: Cloudflare’s own grammar, 1 to 63 lowercase letters, digits and-, not starting or ending with one. It becomes a directory, a command-line argument and a ledger key, so nothing else may reach them. - try_
read_ worker_ groups try_read_worker_groups_with, readingbynk.tomlfrom disk.- try_
read_ worker_ groups_ with - Read
bynk.toml’s[deploy.workers]groups, honouringoverlay(an open, unsaved buffer) and otherwise reading the manifest from disk, asread_package_configdoes. No manifest, or none of the table, is empty. - validate_
against - Check
groupsagainst the project’s units: every member exists and is a context, and no group’s key or script name is an implicit Worker’s (a context in no group is a Worker named by its dashed name).
Type Aliases§
- Worker
Groups - The
[deploy.workers]groups, by key.