ENT-14195 1. Refactored cf-reactor event handling with one unified interface - #6353
Open
victormlg wants to merge 1 commit into
Open
ENT-14195 1. Refactored cf-reactor event handling with one unified interface#6353victormlg wants to merge 1 commit into
victormlg wants to merge 1 commit into
Conversation
Signed-off-by: Victor Moene <victor.moene@northern.tech>
larsewi
reviewed
Sep 14, 2026
larsewi
left a comment
Contributor
There was a problem hiding this comment.
What if we stored FDs in a dynamic list instead (e.g., Seq)? Furthermore, maybe the FD itself could be wrapped in a struct with flags to tell what type of FD it is, and whether or not it is owned by any external plugin.
| * `all_fds` is a single flat array shared by every event source the daemon | ||
| * watches. Nova's fds always occupy the first `num_nova_fds` slots (Nova | ||
| * owns that sub-range and is the only thing allowed to populate it); any | ||
| * other event source (currently just the watcher subsystem, see watcher.h) |
Contributor
There was a problem hiding this comment.
Did we not recently remove the watcher code you are referencing here?
| * No other file needs to know how many event sources exist or in what | ||
| * order their fds appear. | ||
| */ | ||
| typedef struct ReactorContext |
Contributor
There was a problem hiding this comment.
Seems like this belongs in reactor_context.h. What is the reason for having it here?
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.
Rather than exposing the raw file-descriptor bookkeeping required for
select(2), we introduce a unified interface that serves both the reactor-plugin and event-driven code paths. This is achieved by encapsulating all relevant state in a context struct,ReactorContext:ReactorContextInitialize(): initializes the reactor-plugin and event-driven code. WrapsReactorNovaInitialize()ReactorContextSetupFileDescriptors(): populates readfds with the file descriptors to monitor, prior to the select() call.ReactorContextHandleEvents(): iterates over the file descriptors and dispatches the appropriate action based on which ones were signaled as ready. WrapsReactorNovaHandleTimeoutandReactorNovaHandleEvents().ReactorContextFinalize(): releases the daemon's associated resources. WrapsReactorNovaFinalize().