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

Prefix bloom filters #97

Open
marvin-j97 opened this issue Dec 14, 2024 · 0 comments
Open

Prefix bloom filters #97

marvin-j97 opened this issue Dec 14, 2024 · 0 comments
Labels
api enhancement New feature or request epic good first issue Good for newcomers help wanted Extra attention is needed performance test

Comments

@marvin-j97
Copy link
Contributor

marvin-j97 commented Dec 14, 2024

While prefix bloom filters are pretty simple in theory, they need a Trait the user needs to implement.

Possible API:

trait PrefixExtractor {
  fn extract(&self, key: &[u8]) -> impl Iterator<Item = &[u8]>;
}

With the prefix extractor returning an iterator, we can implement both normal prefix extraction (e.g. the first 8 characters of all keys):

fn extract(&self, key: &[u8]) -> impl Iterator<Item = &[u8]> {
  std::iter::once(key.get(0..8).unwrap())
}

or segmented prefixes (e.g. <account_id>#<user_id>, that could index both the hashes of <account_id>#<user_id> and <account_id>, which would allow filtering for queries on both account ID and account ID + user ID).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api enhancement New feature or request epic good first issue Good for newcomers help wanted Extra attention is needed performance test
Projects
None yet
Development

No branches or pull requests

1 participant