SquidDev opened PR #4152 from feature/trap-hook
to main
:
Adds Store::epoch_deadline_callback. This accepts a callback which, when invoked, can mutate the store's contents. The callback can either return an error (in which case we trap) or return a delta which we'll use to set the new epoch deadline.
As discussed with @alexcrichton on Zulip. I'm not very happy with the tests here - happy to improve those if people have ideas.
SquidDev edited PR #4152 from feature/trap-hook
to main
:
Adds Store::epoch_deadline_callback. This accepts a callback which, when invoked, can mutate the store's contents. The callback can either return an error (in which case we trap) or return a delta which we'll use to set the new epoch deadline.
As discussed with @alexcrichton on Zulip. I'm not very happy with the tests here - happy to improve those if people have ideas.
It might be desirable to reimplement the trap and yield behaviours in terms of this callback. Happy to do that if preferred.
alexcrichton submitted PR review.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
As a small nit, this can probably use
?
to remove the error handling perhaps
alexcrichton created PR review comment:
As a small nit the leading
&mut
here can be removed
alexcrichton created PR review comment:
For symmetry with above this
&mut
can also be removed although you'll need to dolet delta = *delta
below I think
SquidDev updated PR #4152 from feature/trap-hook
to main
.
alexcrichton merged PR #4152.
Last updated: Nov 22 2024 at 17:03 UTC