FEAT: streamed upload with checksum in `StorageBackend.put_file`
维护者通常 5 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in src/datajoint/storage.py at StorageBackend.put_file and the companion safe_copy path to see how the file and s3 stores currently copy bytes. The issue leaves the API shape open, so first settle whether checksum returns a digest or takes an expected value, then trace how each backend writes and moves files. Done means a single-read streamed copy with mismatch rejection, no leftover file, and tests covering both the file and s3 backends.
由索引模型根据 Issue 内容生成。
描述
Feature Request
Problem
We keep large raw recordings (often tens of GB) in a <filepath@store> column, at a content-addressed
path sha256/ab/<sha256>. The same code writes to a file store on lab servers and an s3 store
centrally. With StorageBackend.put_file we must read each file twice (hash it, then copy it) and
cannot check that the stored bytes are the ones we hashed: if the source changes between the two reads,
the store holds other bytes under that hash. DataJoint's hash-addressed codecs avoid this only by
holding the whole value in memory (<attach@> reads the full file), which does not work for large files.
Requirements
put_filecan compute a checksum while it copies, reading the source once, and return it, e.g.
digest = backend.put_file(src, dest, checksum="sha256").- It can check an expected checksum and refuse a mismatch without leaving the file in place, e.g.
backend.put_file(src, dest, checksum=("sha256", expected_hex)). fileprotocol: write to a unique temp file and move it into place only when the checksum matches.s3: send the checksum as an S3 additional checksum (x-amz-checksum-sha256) so the server
rejects a mismatch, or upload to a temp key and copy it into place.
Justification
- Large files go into a store once, checked, without reading them twice.
- Content-addressed layouts (any path derived from a hash) become safe with DataJoint's own backend,
instead of each project writing its own copy-and-check code. <attach@>and<hash@>could then stream large files instead of reading them into memory.
Alternative Considerations
Our workaround: hash the file, put_file it, compare the stored size, and audit later by re-reading
the stored copy. This misses a same-size change between the two reads. Writing our own streamed copy
on fsspec works, but duplicates what StorageBackend is for.
Related Errors
None: without the feature, a mismatch goes unnoticed.
Screenshots
n/a
Additional Research and Context
StorageBackend.put_file:src/datajoint/storage.py(v2.3.6 andmaster); no checksum option.- The
filepath goes throughsafe_copy, see the companion issue onsafe_copy/os.replace. - No open issue or PR found for checksums in
put_file. - Would a PR along these lines be welcome, and which API shape do you prefer?
- 主要语言
- Python
- 星标
- 198
- 派生
- 107
- 平均合并
- 4 天 7 小时
- 30 天内合并 PR
- 12
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
datajoint/datajoint-python 的其他 Issue
-
bug triage
难度 2/5 1-3 小时 新手友好度 76/100
datajoint/datajoint-python#1775 ·
维护者通常 5 天内回复
-
MySQL: with use_tls=False, 2.3.6 needs the cryptography package to log in to MySQL 8可能已有人在做 @dimitri-yatsenko 于 5 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 74/100
datajoint/datajoint-python#1750 ·
维护者通常 5 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
datajoint/datajoint-python#1747 ·
维护者通常 5 天内回复
-
Reject constant defaults on primary-key attributes可能已有人在做 @godara-alt 于 4 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
datajoint/datajoint-python#1712 ·
维护者通常 5 天内回复
-
Decoding a <blob> value in an unknown format returns None instead of raising an error可能已有人在做 @godara-alt 于 9 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
datajoint/datajoint-python#1703 ·
维护者通常 5 天内回复
查看 datajoint/datajoint-python 的全部 Issue
相似的 Issue
-
[Bug]: test_remote_realpath_uses_argument_vector fails on Windows with Python 3.13+ (ntpath.isabs)可能已有人在做 @gouyu-hou 今天认领。 未关闭triage/confirmed
难度 1/5 1 小时以内 新手友好度 90/100
agentscope-ai/agentscope#4397 ·
维护者通常 2 天内回复
-
area/profiles area/sessions comp/desktop desktop/chat desktop/sessions P2 type/bug
难度 2/5 1-3 小时 新手友好度 75/100
NousResearch/hermes-agent#161712 ·
维护者通常 1 天内回复
-
[New Check]: postgresql_flexible_server_public_network_access_disabled可能已有人在做 @pouria-l 今天认领。 未关闭feature-request status/needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
prowler-cloud/prowler#13615 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
SACGF/variantgrid#2941 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
linkedin/Liger-Kernel#1730 ·
维护者通常 3 天内回复