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

feat: topic secondary index #19

Merged
merged 6 commits into from
Oct 28, 2024
Merged

Conversation

marvin-j97
Copy link
Collaborator

@marvin-j97 marvin-j97 commented Oct 28, 2024

  • Added secondary index partition for topics
  • Write to index in Store::append as well, using write batch
  • Index key uses topic + 0xFF + frame ID as encoding
  • Removed mut condition from Store::append
  • Use topic index in Store::head
  • Added basic head test
  • Change Store::head to only need topic as &str (no heap allocation)

}
})
pub fn head(&self, topic: &str) -> Option<Frame> {
let mut prefix = Vec::with_capacity(topic.len() + 1);
Copy link
Collaborator Author

@marvin-j97 marvin-j97 Oct 28, 2024

Choose a reason for hiding this comment

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

In a future fjall version this will be possible to do with 1 less heap allocation (or heapless if the topic is short enough), because fjall::Slices will have a constructor for fixed size with Arc::get_mut-like semantics.

@cablehead cablehead merged commit 691902a into cablehead:main Oct 28, 2024
2 checks passed
@marvin-j97 marvin-j97 deleted the topic-index branch October 28, 2024 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants