You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#157620 - Daniel-B-Smith:smithdb3/fileencoder-strategy, r=cjgillot
Add a strategy FnMut to inject behavior into the flush cycle
This PR adds the interface needed to avoid forking FileEncoder in rust-lang#154724.
This adds a FnMut used as a strategy/observer to see the bytes being flushed to disk. For rust-lang#154724, that would be used to calculate the metadata hash on the raw metadata bytes.
The 'static hack is pretty ugly, but otherwise, the FileEncoder lifetime goes exceptionally viral and requires some very unfortunate workarounds to avoid self referential lifetimes. That's a bit of a timebomb if the wrong FileEncoder client tries to use the new API, but the worst case outcome is a wild goose chase of lifetime chasing.
Full disclosure: I used Claude Code to generate much of the PR. I have fully reviewed the code and stand behind it.
r? @cjgillot
0 commit comments