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

Add kv::keys with filters #1280

Open
Jarema opened this issue Jun 20, 2024 · 4 comments
Open

Add kv::keys with filters #1280

Jarema opened this issue Jun 20, 2024 · 4 comments
Labels
accepted The defect or proposal as been accepted good first issue Good for newcomers help wanted

Comments

@Jarema
Copy link
Member

Jarema commented Jun 20, 2024

Proposed change

Add two new methods:

pub async fn keys_with_filters(&self, F) -> Result<Keys, HistoryError>

keys_with_fitlters require a feature flag server_2_10. That is also the reason why they are separated, instead of one method taking interator of sorts.

https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-8.md?plain=1#L139
Reference ADR issue: nats-io/nats-architecture-and-design#289

Use case

nats-io/nats-architecture-and-design#289

Contribution

No response

@Jarema Jarema added good first issue Good for newcomers accepted The defect or proposal as been accepted help wanted labels Jun 20, 2024
@Jarema Jarema changed the title Add Add kv::keys with filters Jun 20, 2024
@TheGhoul21
Copy link

Can I try to work on this? I'm a noobie on rust though!

@Jarema
Copy link
Member Author

Jarema commented Jun 20, 2024

Sure, go ahead!
It should be pretty simple, like normal keys, just with filter(s) passed to the underlying ordered consumer.

@TheGhoul21
Copy link

TheGhoul21 commented Jun 20, 2024

are unit test working? I tried to run cargo test (both on the whole project and only on keys() and get errors.

running 1 test
test kv::keys ... FAILED

failures:

---- kv::keys stdout ----
thread 'kv::keys' panicked at nats-server/src/lib.rs:268:29:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    kv::keys

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 19 filtered out; finished in 0.01s

error: test failed, to rerun pass `-p async-nats --test kv_tests`

EDIT: Sorry, I got where the error comes from.

@Jarema
Copy link
Member Author

Jarema commented Jun 20, 2024

As we updated the ADR to have just one method, please re-check the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted The defect or proposal as been accepted good first issue Good for newcomers help wanted
Projects
None yet
Development

No branches or pull requests

2 participants