-
Notifications
You must be signed in to change notification settings - Fork 3
Backport to branch(3) : Add namespace-creation feature #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @feeblefakie, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request backports a significant feature that enables the creation of namespaces within the system. It involves a full-stack implementation, from new RPC definitions and client-side service methods to robust server-side logic for managing namespace persistence and validation. The changes ensure that users can programmatically define and utilize isolated environments for their data and contracts, enhancing the system's multi-tenancy and organizational capabilities. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request backports the namespace creation feature. The changes are extensive, touching client, server, and common components, and appear to be well-structured. The introduction of TableMetadataProvider and the use of Guice's Multibinder for dynamic table creation is a solid design. The code is clean and includes new tests for the added functionality. I have one suggestion to improve the robustness of the new NamespaceManager.
| public void create(@Nonnull String namespace) { | ||
| if (!isValidNamespaceName(namespace)) { | ||
| throw new LedgerException(CommonError.INVALID_NAMESPACE_NAME, namespace); | ||
| } | ||
| registry.create(namespace); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The create method is a public API and should validate its arguments. While the @Nonnull annotation is present, it doesn't provide a runtime guarantee. A null value for namespace would cause a NullPointerException in isValidNamespaceName when matcher(namespace) is called. It's a good practice to add a checkNotNull(namespace) at the beginning of the method to ensure robustness, especially since checkNotNull is already used in the constructor of this class.
For example:
public void create(@Nonnull String namespace) {
checkNotNull(namespace);
if (!isValidNamespaceName(namespace)) {
throw new LedgerException(CommonError.INVALID_NAMESPACE_NAME, namespace);
}
registry.create(namespace);
}
This is an automated backport of the following:
Please merge this PR after all checks have passed.