Skip to content
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

Better handle regex in pcli query watch #4361

Merged
merged 1 commit into from
May 9, 2024
Merged

Better handle regex in pcli query watch #4361

merged 1 commit into from
May 9, 2024

Conversation

zbuc
Copy link
Member

@zbuc zbuc commented May 9, 2024

Describe your changes

This changes the pcli query watch command to fix a bug and improve usability.

Previously, the nv_key_regex was implemented incorrectly. This PR also makes the watch command disable watching the other storage type if only a single regex is supplied.

There is a slight drawback in the current implementation in that you cannot enable filtering the watch command for one of the regexes while supplying an empty regex for the other to view all matches, however changing this would require a change to the proto interface: rpc Watch(WatchRequest) returns (stream WatchResponse);

Issue ticket number and link

Closes #4360

Checklist before requesting a review

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    Only affects RPC return

@zbuc zbuc temporarily deployed to smoke-test May 9, 2024 00:43 — with GitHub Actions Inactive
@cratelyn cratelyn added this to the Sprint 6 milestone May 9, 2024
@cratelyn cratelyn added the A-client Area: Design and implementation for client functionality label May 9, 2024
Copy link
Contributor

@cratelyn cratelyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have a question about the changes to the watch_changes signature below!

_ => Some(
regex::bytes::RegexBuilder::new(&request.nv_key_regex)
.size_limit(MAX_REGEX_LEN)
.unicode(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should add a comment here, remarking why the non-verifiable storage keys may not be valid unicode, compared to the verifiable storage keys?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i see this was already there, so this is not blocking)

crates/cnidarium/src/rpc.rs Show resolved Hide resolved
Copy link
Contributor

@cratelyn cratelyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving, modulo a question about the regex size limit mentioned in the original issue. nice! ✨

@zbuc zbuc merged commit e0276d7 into main May 9, 2024
13 checks passed
@zbuc zbuc deleted the 4360_regex_watch branch May 9, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-client Area: Design and implementation for client functionality
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Fix regex handling in pcli query watch
2 participants