fixup! diigo-cache: the caches take their clock as a constructor argument

Past the transitional idiom: the cache logic (DiigoCacheLogic,
PublicCacheLogic in cache.ts) requires its Clock, with no default, so
cache.ts reaches no ambient time. The worker's entry module is the
edge: it makes the live clock and exports the runtime-constructed
DiigoCache/PublicCache as (ctx, env) subclasses that supply it (the
Cloudflare constraint: the runtime constructs DOs with ctx and env
only). Binding class names are unchanged, so stored state is too. The
tests' FixedClockCache extends the logic class.

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 04:39:29 -05:00
1 parent cf901ded5f
commit 961515d8db
6 files changed
+53 -31

No files matched your search

+3 -3
View File
@@ -14,13 +14,13 @@
*/
import { RpcTarget } from "capnweb";
import type { DiigoCache, FillStatus, PublicCache } from "./cache.js";
import type { DiigoCacheLogic, FillStatus, PublicCacheLogic } from "./cache.js";
import { idFromWebkey, isWebkey, shashKey } from "./webkeys.js";
/** the bindings the API reaches (structural) */
export type ApiEnv = {
CACHE_DO: DurableObjectNamespace<DiigoCache>;
PUBLIC_DO: DurableObjectNamespace<PublicCache>;
CACHE_DO: DurableObjectNamespace<DiigoCacheLogic>;
PUBLIC_DO: DurableObjectNamespace<PublicCacheLogic>;
};
/** the fill-job surface of one cache (private or public) */