Skip to content

Prefix bloom filters #97

Open
@marvin-j97

Description

@marvin-j97

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).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions