immutables._map.MapMutation is not iterable / does not implement items()
还没有人认领这个 Issue。
评估
调研方向
从 issue 中描述的 mutate 和 finish 入口点开始,然后追踪嵌套 MapMutation 值是如何暴露的。确定受支持的 traversal 或 lazy-finish 设计是否合适;完成意味着所请求的嵌套更新工作流具有清晰的 API 和有文档记录的行为。
由索引模型根据 Issue 内容生成。
描述
I am wondering if this is by design or because it hasn't been useful up till now.
My use-case is implementing a middleware type of cache. The cache subscribes to some external data that gets updated and tracks it, and it allows clients to get an immutable view of the cache. The cache can be a nested immutables.Map dictionary. What works is to call mutate and finish for each new piece of data that comes in (N times each if the updated key is at depth N), but this can be too slow when the cache receives a large batch of updates. Using a profiler, I see my code spending ~35% of the time processing the incoming data to be added to the cache and ~65% of the time in the mutate/finish calls.
What I would like to implement is a lazy-finish protocol that calls mutate on updates as needed but not finish. Instead, we traverse the cache and make any needed finish calls when the client requests a view into the cache. What is preventing me from realizing this implementation (I think) is that the immutables._map.MapMutation objects that are returned by the un-finished mutate calls, are not iterable and they don't implement items(), but I need to finish the inner MapMutation objects before I finish the outer ones.
As a nasty hack, I can finish() an outer MapMutation to get its keys and use them to find and recurse into any inner MapMutation values to finish those, before I call finish() a second time on the outer MapMutation to really finish it this time.
- 主要语言
- C
- 星标
- 1.2k
- 派生
- 60
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MagicStack/immutables 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 38/100
MagicStack/immutables#121 · 6 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
MagicStack/immutables#107 ·
-
难度 3/5 1-2 天 新手友好度 32/100
MagicStack/immutables#102 ·
-
难度 5/5 一周以上 新手友好度 20/100
MagicStack/immutables#82 ·
-
难度 5/5 一周以上 新手友好度 25/100
MagicStack/immutables#75 · 1 条评论 ·
查看 MagicStack/immutables 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
corazawaf/coraza-nginx#140 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
BasedHardware/omi#15662 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
-
level/task module/gcp type/bug
难度 2/5 1-3 小时 新手友好度 85/100