Internal RPC contract
Bind GeoRead with props: { caller: "paryatech-platform", environment: "staging" } in the same account. Proposals uses caller: "paryatech-proposals"; the operational scheduled Worker uses caller: "geonames-warmup". Other callers are refused. The service is geonames-global-service, shared by every environment and preview. No token, tenant id, public HTTP endpoint or admin method.
The copyable contract and fake are plain TypeScript plus JSON. Paryatech validates actual responses with its own Zod boundary. Region lookup, validation, resolution, ancestors, children, datasetVersion, bulk export and purpose search are implemented.
Types publish get/getMany, validate/resolve, ancestors/children, version-pinned region export, results-only purpose search and datasetVersion. Region ids are positive safe integers, stored as bigint by v2. Bad inputs throw TypeError. GeoRead has no settings write, admin snapshot or release/import method.
| Method | Result |
|---|---|
| get/getMany | Region/tombstone or null; getMany max 100, unknown omitted, duplicates retained |
| validate/resolve | One status per input; resolve includes the active terminal successor |
| ancestors | Root-first parent walk, excluding self |
| children(id, version, afterId?, limit?) | Active immediate children; increasing id, max 100 |
| regions(version, afterId?, limit?) | All statuses; increasing id, max 100; source for region_level |
| datasetVersion | Snapshot date, source checksums, load instant, cache prefix, total row count |
| search(query, purpose, limit?, options?) | Region[]; region/coverage/city/overnight/transfer presets; optional cache bypass |
First read datasetVersion, pass its exact version to every export page, and discard partial output on GEO_DATASET_CHANGED. No offset paging or cross-release mixing. Carry current ids/statuses into the main app, refresh place ancestors and DST/ITN rollups after each release. get preserves original lifecycle state; use resolve when selecting a current successor.
Read caching
Section titled “Read caching”All consumer data reads check KV before D1. Nonempty results remain stored until explicitly deleted; empty results, missing ids and unknown-only validation/resolution results expire after 30 minutes. Export pin checks read cached dataset metadata, not D1 on every request. Keys are stable method/argument identities without generation or dataset-version labels; public dataset versions still prevent mixed-version exports.
The KV read TTL is 2,147,483,647 seconds, the highest value accepted by the installed runtime. This is edge read caching, not stored-result expiration or Worker memory. KV is eventually consistent; a purge does not synchronously invalidate every edge copy. Data/index refreshes require coordinated owner deployment and cache purge as described in the repository’s DEPLOY.md. First-ever cache misses still use D1; this policy does not keep D1 awake.