workerd 1.20261120.1 → 1.20261122.2
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/bin/workerd +1 -1
- package/install.js +4 -4
- package/lib/main.js +3 -3
- package/package.json +6 -6
- package/worker.mjs +187 -2
- package/workerd.capnp +35 -6
package/workerd.capnp
CHANGED
|
@@ -282,8 +282,11 @@ struct ClusterConfig {
|
|
|
282
282
|
# then go where it runs next. While a Durable Object serves a call of a handoff's work, all the
|
|
283
283
|
# calls it makes count as that work. Then the instance leaves the cluster, keeps accepting
|
|
284
284
|
# requests until at least five seconds after SIGTERM (or until the handoff deadline, if that comes
|
|
285
|
-
# sooner), as load balancers take a while to stop sending them, lets its connections finish,
|
|
286
|
-
# stops its containers' Docker containers.
|
|
285
|
+
# sooner), as load balancers take a while to stop sending them, lets its connections finish, its
|
|
286
|
+
# peers' last, and then stops its containers' Docker containers. Once its other connections have
|
|
287
|
+
# finished, it starts none of its peers' requests, and closes each peer's connection once the
|
|
288
|
+
# requests it started on that connection have ended, so that the peer sends those it did not
|
|
289
|
+
# start where their Durable Objects run next.
|
|
287
290
|
#
|
|
288
291
|
# The time is spent in order: until half of it, requests in flight on an object being handed off
|
|
289
292
|
# may finish, and are then cancelled, failing as requests that may have run, which are not sent
|
|
@@ -295,6 +298,11 @@ struct ClusterConfig {
|
|
|
295
298
|
# itself that way ends only with the requests in flight. Stopping an object's Docker container
|
|
296
299
|
# takes one of the few handoffs that run at once.
|
|
297
300
|
#
|
|
301
|
+
# A request to a Durable Object stays in flight until the body of its response is read, so a
|
|
302
|
+
# caller that checks `res.ok` and drops the response keeps the object busy, and its handoff waits
|
|
303
|
+
# for half of this timeout before it cancels the request. Read or cancel a body you don't use
|
|
304
|
+
# (`await res.body?.cancel()`).
|
|
305
|
+
#
|
|
298
306
|
# The default fits within the 10 seconds that `docker stop` and Docker Compose give a container,
|
|
299
307
|
# and the 30 seconds that Kubernetes gives a pod (`terminationGracePeriodSeconds`). Raising this,
|
|
300
308
|
# raise the supervisor's grace period too (`docker stop -t`, `stop_grace_period`,
|
|
@@ -486,6 +494,9 @@ struct Service {
|
|
|
486
494
|
|
|
487
495
|
assets @7 :AssetsService;
|
|
488
496
|
# A directory of static assets, served as Cloudflare serves a Worker's `assets`.
|
|
497
|
+
cache @8 :CacheDirectory;
|
|
498
|
+
# The Cache API's backend, which a Worker's `cacheApiOutbound` names, its entries in a
|
|
499
|
+
# directory on disk.
|
|
489
500
|
}
|
|
490
501
|
|
|
491
502
|
# TODO(someday): Allow defining a list of middlewares to stack on top of the service. This would
|
|
@@ -557,6 +568,23 @@ struct AssetsService {
|
|
|
557
568
|
# as a Worker's are.
|
|
558
569
|
}
|
|
559
570
|
|
|
571
|
+
struct CacheDirectory {
|
|
572
|
+
# Serves `caches.default` and `caches.open()` for the Workers whose `cacheApiOutbound` names
|
|
573
|
+
# it: a response is stored for as long as its `Cache-Control`, `Expires` or `Last-Modified`
|
|
574
|
+
# allows, and a match answers `Range`, `If-None-Match` and `If-Modified-Since`. Each entry is a
|
|
575
|
+
# file, so entries survive a restart, in a directory per cache: `default/` for `caches.default`,
|
|
576
|
+
# and for `caches.open(name)` the SHA-256 of `name` in lowercase hex, so that one cache can be
|
|
577
|
+
# removed by itself. With `Config.cluster`, the instances share one cache instead, which every
|
|
578
|
+
# instance must name the same: an entry lives on one instance, and the directory holds this
|
|
579
|
+
# instance's in `cluster-<instance>/`, emptied as it starts. While an instance drains, the keys
|
|
580
|
+
# it is home to, about 1/N, miss, and puts to them are not stored. Experimental: requires
|
|
581
|
+
# `--experimental`.
|
|
582
|
+
|
|
583
|
+
path @0 :Text;
|
|
584
|
+
# The directory, as in `DiskDirectory`: relative to the current directory, and if not
|
|
585
|
+
# specified, given on the command line with `--directory-path <service-name>=<path>`.
|
|
586
|
+
}
|
|
587
|
+
|
|
560
588
|
struct ServiceDesignator {
|
|
561
589
|
# A reference to a service from elsewhere in the config file, e.g. from a service binding in a
|
|
562
590
|
# Worker.
|
|
@@ -703,10 +731,11 @@ struct Worker {
|
|
|
703
731
|
bundled @11 :Text;
|
|
704
732
|
# An ES module whose source is bundled with workerd, by name: `/workerd/kv.js`, the KV
|
|
705
733
|
# Worker, `/workerd/cron.js`, cron triggers, `/workerd/queues.js`, the Queues Worker,
|
|
706
|
-
# `/workerd/r2.js`, the R2 Worker, `/workerd/workflows.js`, a Workflows engine,
|
|
707
|
-
# `/workerd/d1.js`, D1 databases
|
|
708
|
-
#
|
|
709
|
-
#
|
|
734
|
+
# `/workerd/r2.js`, the R2 Worker, `/workerd/workflows.js`, a Workflows engine,
|
|
735
|
+
# `/workerd/d1.js`, D1 databases, `/workerd/ratelimit.js`, rate limiting, or
|
|
736
|
+
# `/workerd/secrets-store.js`, Secrets Store secrets (see each one's header for the config
|
|
737
|
+
# it takes). Unlike built-in modules such as `node:` ones, user code cannot import it; it is
|
|
738
|
+
# a Worker's source. Experimental.
|
|
710
739
|
}
|
|
711
740
|
|
|
712
741
|
namedExports @10 :List(Text);
|