Reading and writing CBOR documents in pieces
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- c
- 领域
- embedded-iot
调研方向
检查 decoder/parser API 以及 issue 中描述的 CborErrorAdvancePastEOF 和 CborErrorOutOfMemory 路径。确定利用现有的 read pointer 和 buffer 行为是否可以支持可恢复的读取和写入;完成的标准是提供有文档说明且经过测试的流式处理方案,或明确的 API 设计。
由索引模型根据 Issue 内容生成。
描述
Hi,
Is it possible to parse and and emit a CBOR document in parts? The use case here is where I might have a CBOR file that's in the order of 2kB in size, but I don't want to allocate a 2kB buffer to read the whole thing in one go (I've allocated 4kB for a stack and don't have a lot of heap space available).
The thinking is when reading, I might allocate a 256 or 512-byte buffer (on the stack), read the first buffer-full worth of data, then call the parser on that. As I get near the end, I watch for CborErrorAdvancePastEOF… when this happens, I obtain a copy of TinyCBOR's read pointer, do a memmove to move the unread data to the start of my buffer, read some more in, then tell TinyCBOR to move back to the start of the buffer to resume reading whatever CBOR value was being pointed to at the time.
Likewise writing; when CborErrorOutOfMemory is encountered, I can do a write of the buffer, then tell TinyCBOR to continue from the start of the buffer and resume writing the output.
Such a feature would really work well with CoAP block-wise transfers, as the data could be effectively "streamed" instead of having to buffer the lot.
I tried looking around for whether there was a flag I could specify on the decoder, but couldn't see any flags in the documentation.
Regards,
Stuart Longland
- 主要语言
- C
- 星标
- 641
- 派生
- 222
- 平均合并
- 21 小时 33 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
intel/tinycbor 的其他 Issue
-
CborValidateTagUse rejects valid tag 1 (epoch) with a floating-point value, and restricts tags 21-23 too much可能已有人在做 @thiagomacieira 于 13 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
-
难度 4/5 3-5 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 38/100
相似的 Issue
-
Symlink in release archive attempts traversal可能已有人在做 @Tiancheng-Xu 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
[BUG] Small issues on iMXRT found by Claude可能已有人在做 @Sarthak-Pandey 今天认领。 未关闭Arch: arm Area: Networking OS: Linux Type: Bug
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
eclipse-cyclonedds/cyclonedds#2474 ·
-
area: docs eco: cpp good first issue help wanted lane: free-agent roadmap size: XS type: docs
难度 2/5 1-3 小时 新手友好度 70/100
arminazimi/evergreen#475 ·
维护者通常 1 天内回复
-
[Issue]: hipsparselt.h C API as shipped now requires C23 -- ONLY because of missing include or guard未关闭
难度 2/5 1-3 小时 新手友好度 62/100
ROCm/rocm-libraries#13736 ·
维护者通常 2 天内回复