Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Optional expiry for persisted demand coverage

未关闭
#2,211 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
活跃
技术栈
sqlite, typescript
领域
backend, database

调研方向

Start with the persisted demand coverage proposal in issue #2102 and compare its behavior with the persistedGcTime control discussed in #1380 and #1400. The issue leaves the expiry start time, its relationship to row retention, and the implementation deferred until a user asks; first clarify those design decisions. Done would mean defining the optional expiry behavior and adding a settlement timestamp to the coverage record, as described here.

由索引模型根据 Issue 内容生成。

描述

Problem

The persisted demand coverage proposal (#2102, item 1) lets the persisted wrapper settle an on-demand load from SQLite when that exact demand finished loading in an earlier session. Coverage stays valid until its persisted cache generation ends, or until a later load of the same demand settles.

After a demand is released, its source stops sending changes for it. A deleted or moved row keeps appearing in that demand's offline result until the demand loads again online. For many offline-first apps, the last complete result is the right answer. Others may want a bound on how old a covered result can be before the app stops trusting it offline.

Query DB already has this control for its own retention: persistedGcTime keeps a released Query's persisted rows for a TTL or until revalidated (#1380, #1400).

Proposal

Add an optional expiry to persisted demand coverage. Its shape should follow persistedGcTime:

  • a finite duration measured from when the covered load settled, or from when the demand was released (to be decided);
  • an "until revalidated" value, which is the default and today's proposed behavior.

An expired demand counts as uncovered. It waits for the network and is reported the same way as any uncovered demand.

Not doing yet

Do not implement this until a user asks for it. The default (valid until revalidated or until the generation ends) needs no option. This issue records the design so the coverage record keeps room for a timestamp.

Design notes

  • Store the settlement time with the coverage record now, so that expiry can be added later without a storage migration.
  • Decide whether Query DB's persistedGcTime should drive this expiry for Query Collections, or stay a separate row-retention control.
  • An oracle law would add a clock to the persisted-readiness model: a covered demand settles from SQLite only while its coverage is unexpired at the load's start.

Related: #2102, #1380, #1955.

主要语言
TypeScript
星标
3.9k
派生
277
平均合并
18 小时 12 分钟
30 天内合并 PR
229

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/db 的其他 Issue

查看 TanStack/db 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。