Reserved keyword registry#333
Open
RiSKeD wants to merge 4 commits into
Open
Conversation
Contributor
Author
|
Only thing i am not sure about or happy with is that we need to expose the global keywords and their handlers as global vars. Another approach would be to hide these behind functions, which in my opinion is even more cumbersome though... |
Merged
f8b6613 to
6893ee5
Compare
Single source of truth for names reserved by dutctl client-side dispatch, shared by the dutctl client and dutagent config validation. Each keyword carries its description and dispatch handler. Handlers operate through a small Client interface so the package stays free of client-binary internals, letting both binaries import it without a cycle. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
Devlist/command decoding now rejects any device or command named with a reserved keyword (keyword.IsReservedDeviceName / IsReservedCommandName), returning keyword.ErrReservedName so a colliding config fails at load. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
Replace the hardcoded lock/unlock switch and help check with registry lookups (keyword.CommandHandler / DeviceHandler). The application implements keyword.Client, so handlers live in pkg/keyword and stay in sync with config validation without a separate dispatch table. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
Point the doc links at pkg/keyword.CommandKeywords / DeviceKeywords. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
6893ee5 to
8bbc2f8
Compare
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.
resolves #84