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

Range + If-Range support, end-to-end

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

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
go

调研方向

从 internal/strategy/apiv1.go 和 internal/cache/api.go 开始,然后检查 s3_parallel_get.go 以及 disk、memory、tiered 和 remote 后端,以了解现有的读取路径。跟踪 client/ 和 remote 的连接逻辑,了解 Range 和 If-Range 的处理。完成的标准是:每个后端都能在返回 206 和 Content-Range 的同时返回正确的范围字节,过期的 If-Range 返回 200,而无法满足的范围返回 416。

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

描述

etag-range-followup

Follow-up from the ETag support assessment (label: etag-range-followup).

The strong content-hash ETag is already a suitable, tier-stable If-Range validator (a range continuation served from a different tier/pod validates correctly; a changed object correctly forces a full 200). The validator value is fine; the surrounding machinery is entirely missing.

Current gaps
  • apiv1.getObject (internal/strategy/apiv1.go) does io.Copy(w, cr) — always 200, never honours Range, never sets Accept-Ranges, never returns 206/Content-Range/416.
  • The cache.Cache interface (internal/cache/api.go) only exposes a whole-object Open returning an io.ReadCloser; there is no partial-read / seek capability. Only the disk backend reader happens to be seekable.
  • checkConditionals does not evaluate If-Range.
Work
  • Add a partial-read capability to the cache interface — either a range-aware open (offset + length) or a documented seekable-reader contract — and implement it for disk, memory, s3 (S3 already does parallel range GETs internally, see s3_parallel_get.go), tiered, and remote.
  • Implement server-side range handling in apiv1.getObject: parse Range, emit Accept-Ranges: bytes, return 206 with Content-Range for satisfiable ranges and 416 for unsatisfiable ones.
  • Evaluate If-Range (against the strong ETag; fall back to full 200 when the validator does not match) before serving a partial response.
  • Plumb Range/If-Range through the client (client/) and remote backend as needed so a tiered remote tier can serve ranges.
Acceptance

Ranged GET against each backend returns the correct bytes with 206/Content-Range; If-Range with a stale ETag returns the full object with 200; unsatisfiable ranges return 416.

主要语言
Go
星标
42
派生
15
平均合并
4 小时 23 分钟
30 天内合并 PR
3

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

block/cachew 的其他 Issue

查看 block/cachew 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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