-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
Suggested API: void onWuowEnd(std::invocable<void(OpCtx*, bool commited)> auto cb) (onCommitOrAbort() would also be an acceptable, if wordy, name)
This would allow code that needs to take an action at either commit or abort time to do so without registering two callback (which duplicates the state captured by lambdas, doubles the allocations of underlying Changes, and requires two virtual calls at commit/abort time) as is done here, or using the more cumbersome registerChange() api which is both less discoverable (doesn't follow the pattern of onCommit()/onAbort()) and requires the syntactic overhead of defining a type and creating an instance of it rather than using a lambda. Also there is often common code between commit and abort, so passing a bool to a combined function makes it easier to not repeat that common code.