Repository navigation
Conversation
Every caller runs the inflation IO under its own config, so timeout, wait and cancellation are per caller and hypercore dedups the fetches. Decoded blocks land in slots on ptr.inflating shared by all callers, so the first to wake decodes and a late caller only fetches what is still missing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
This risks parallel walks of the tree to inflate the node but most the actual work is shared so the cost should be minimal. It also respects the 'wait' option that is difficult to handle with a simple lock as proposed in #94. Seems like a good idea to me. |
|
I ran this through |
|
I also ran this with a large database and tested memory usage. It is comparable to |
caolan-tether
left a comment
There was a problem hiding this comment.
Looks good to me. I believe @lejeunerenard also wants to take a look before merging.
Ports the two context APIs from #105 so the invalidation check in getBlock resolves the owning context synchronously. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* Add invalidation pointer to blocks Block-1 gains an optional invalidation uint. Every decode path returns it (0 for block-0 and bee1 compat blocks), and the writer carries the last loaded value forward into new blocks. The core context tracks the pointer it loaded its table with and reloads the table when a block carries a newer one, in addition to the existing reload when a referenced core is missing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Split getBlock into getBlockBuffer and add getLoadedContext Ports the two context APIs from #105 so the invalidation check in getBlock resolves the owning context synchronously. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Every caller runs the inflation IO under its own config, so timeout, wait and cancellation are per caller and hypercore dedups the fetches. Decoded blocks land in slots on ptr.inflating shared by all callers, so the first to wake decodes and a late caller only fetches what is still missing.