GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Adding a registry that maps command names to their flags by uglide · Pull Request #4332 · redis/jedis Conversation
|
| File | Description |
|---|---|
| src/test/java/redis/clients/jedis/codegen/README.md | Documentation for the command flags registry generator tool |
| src/test/java/redis/clients/jedis/codegen/CommandFlagsRegistryGenerator.java | Code generator that retrieves Redis command metadata and updates the static registry |
| src/main/java/redis/clients/jedis/CommandObject.java | Core implementation with CommandFlag enum, static registry, and getFlags() method |
| pom.xml | Maven configuration to exclude code generators from test execution |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
e8157fa to
51c62d5
Compare
There was an error while loading. Please reload this page.
Test Results 281 files +1 281 suites +1 11m 41s ⏱️ -6s Results for commit fdf00b5. ± Comparison against base commit 4776709. This pull request skips 600 tests.♻️ This comment has been updated with latest results. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
For better traceability, I would suggest placing the generated code in a dedicated file.
Additionally, wrapping command metadata in in an interface (CommandMetadataRegistry.getFlag()) and providing it as an configurabel instance within CommandObject would be beneficial. The auto-generated registry can serve as the default, but users could replace it with a custom implementation if needed — for example, dynamically loading it from the server or providing a user-defined version.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Adding the version of server - the generator running against- as part of generated content would be nice as well.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| public class CommandObject<T> { | ||
|
|
||
| /** |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lets not do this and put everything into a seperate completely auto-generate class like CommandFlagRegistry or some provider class,, and use generated content at once without need of regex or any other searching/parsing. Then just consume it from CommandObject as needed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- Add new interface and move CommandFlag enum there - Generate StaticCommandFlagsRegistry instead of embedding generated code into CommandObject - Allow passing custom CommandFlagsRegistry to ClusterClientBuilder
| public EnumSet<CommandFlag> getFlags(ProtocolCommand cmd) { | ||
| byte[] raw = cmd.getRaw(); | ||
| String commandName = SafeEncoder.encode(raw).toUpperCase(); | ||
| return COMMAND_FLAGS_REGISTRY.getOrDefault(commandName, EMPTY_FLAGS); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to work for subcommands like "CLUSTER INFO", "CONFIG GET" ...
In this case, ProtocolCommand is actually only "CLUSTER"
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've addressed this problem. See my latest commit ff09e22
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… im/introduce-command-flags
… im/introduce-command-flags
|
@uglide |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…rom actual implementation (#4345) * (clean up) Extract generated registry initialization * regenerate after clean up * reformat
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.