01 / DECISION
何時值得加入這個 primitive
當 per-room、per-user、per-resource 或 per-workflow coordination 需要 strongly consistent ownership 時使用 Durable Object。
02 / ARCHITECTURE
建立最小且站得住腳的路徑
先寫 invariant、推導 stable object ID、限制 method 範圍、只保存必要 state,並定義 alarm 或 cleanup。
- 01先命名 contract
當 per-room、per-user、per-resource 或 per-workflow coordination 需要 strongly consistent ownership 時使用 Durable Object。
- 02只加入一個 primitive
先寫 invariant、推導 stable object ID、限制 method 範圍、只保存必要 state,並定義 alarm 或 cleanup。
- 03保留 failure evidence
對同一 object 發出 concurrent requests、在操作間重啟,並證明 invariant、persistence 與 cleanup 行為。
03 / REPRODUCE
有證據,再有信心
對同一 object 發出 concurrent requests、在操作間重啟,並證明 invariant、persistence 與 cleanup 行為。
npx wrangler types 04 / BOUNDARY
Production boundary
單一 object 可能成為 hot key。Durable Objects 負責協調 state,不會讓無界 workload 免費或無限平行。
05 / FIRST-PARTY SOURCES
讓第一方來源保持權威
產品行為、限制、價格與供應狀態會改變;採取行動前請重新核對這些來源。