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

support iterator #78

Closed
Tracked by #140
roseduan opened this issue Jul 26, 2023 · 4 comments
Closed
Tracked by #140

support iterator #78

roseduan opened this issue Jul 26, 2023 · 4 comments
Labels
release plan something in next release

Comments

@roseduan
Copy link
Contributor

No description provided.

@roseduan roseduan added the icebox do it later label Jul 26, 2023
@akiozihao
Copy link
Contributor

+1

@amityahav
Copy link

Hey team, i was thinking about keeping track of all memtables iterators and bbolt cursors when creating a new iterator and when iterating, making sure to always get the smaller element returned from all the iterators.

@amityahav
Copy link

@roseduan @akiozihao lemme know your thoughts about this approach as i would like to take this

@amityahav
Copy link

More thoughts:
im thinking about creating 2 sub-iterators: 1. DiskIndexIterator, 2. MemoryIterator both will implement the Iterator interface. the reason for doing that is that the disk index is an interface itself and in order to be generic, one should implement iterator function for it.
** clients should not use those sub iterators since they will present partially correct sequence of data.

high level for DiskIndexIterator/ MemoryIterator:
the iterator will maintain a min heap (max heap if reversed) that will hold all current keys among all the internal iterators (all boltdb trees cursors/ all skiplist iterators). when calling for Key() / Value() , it will be simply returned from heap with O(1) complexitiy.

after doing that, a dbIterator struct will implement the Iterator interface as well and will contain the both sub iterators.
the dbIterator will implement all the needed logic to decide among the 2 iterators what is the next kv pair that needed to be returned.

@roseduan roseduan mentioned this issue Dec 18, 2023
3 tasks
@roseduan roseduan added release plan something in next release and removed icebox do it later labels Dec 20, 2023
This was referenced Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release plan something in next release
Projects
Status: Done
Development

No branches or pull requests

3 participants