Locally committed handlers are set like other Endpoint properties#7487
Merged
eddyashton merged 11 commits intomicrosoft:mainfrom Nov 28, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the API for setting local commit handlers on endpoints by introducing a new .set_locally_committed_function() setter method, replacing the previous make_endpoint_with_local_commit_handler() and make_read_only_endpoint_with_local_commit_handler() factory functions. This change reduces code duplication and makes the API more consistent with how other endpoint properties are configured.
Key changes:
- Added
set_locally_committed_function()method to theEndpointclass for setting local commit handlers - Removed
make_[read_only_]endpoint_with_local_commit_handler()factory methods fromEndpointRegistry - Updated the sample logging application to use the new API pattern with fluent chaining
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| include/ccf/endpoint.h | Adds declaration for new set_locally_committed_function() setter method |
| src/endpoints/endpoint.cpp | Implements set_locally_committed_function() following the existing setter pattern |
| include/ccf/endpoint_registry.h | Removes deprecated make_*_with_local_commit_handler() factory method declarations |
| src/endpoints/endpoint_registry.cpp | Removes implementations of the deprecated factory methods |
| samples/apps/logging/logging.cpp | Refactors to use new API with .set_locally_committed_function() in fluent chain |
| CHANGELOG.md | Documents the breaking API change with migration instructions |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…com/eddyashton/CCF into locally_committed_is_not_so_special
…committed_is_not_so_special
achamayou
approved these changes
Nov 26, 2025
…committed_is_not_so_special
…com/eddyashton/CCF into locally_committed_is_not_so_special
…committed_is_not_so_special
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change, so warrants discussion, but I think this is better.
Previously:
Now:
Branching at the top-level
make_function causes unnecessary duplication. We already hadmake_andmake_read_only_variants, with the requirement that any implementer overrode both consistently and correctly. I'm looking at adding a similar-lookingglobally_committed_functionoption to each endpoint as well, but putting that at the same level would multiply the number ofmake_functions.I think that's totally unnecessary - we deliberately avoid this proliferation of
make_functions by having theseset_functions on the resultingEndpoint, so that only the (usually small number of) endpoints which care about the special behaviour have to consider it. I think the size of the internal diff supports this - the actual functionality is identical, populating thelocally_committed_funcfield, but we delete a lot of surrounding boilerplate.