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

Adding _seek to SubIterator #65

Closed
MeirionHughes opened this issue Jun 21, 2019 · 4 comments
Closed

Adding _seek to SubIterator #65

MeirionHughes opened this issue Jun 21, 2019 · 4 comments

Comments

@MeirionHughes
Copy link
Member

So I've been trying to add support for _seek on SubIterator. In principle the change is simply the added lines:

SubIterator.prototype._seek = function (key) {
  this.iterator.seek(concat(this.prefix, key))
}

but this never gets called.

If I do:

    var db = levelup(memdown())
    var sub = subdb(db, 'sub')

    db.once('open', function () {
     var it = sub.iterator({ keyAsBuffer: false, valueAsBuffer: false })
   
     console.log(it)

I get...

Iterator {
...
  it:
   SubIterator {
     iterator:
      MemIterator {
       ...

It seems clear Iterator is not calling this.it.seek, but I have no idea where this Iterator prototype is. Any ideas?

@MeirionHughes MeirionHughes added the help wanted Extra attention is needed label Jun 21, 2019
@vweevers
Copy link
Member

That's because the iterator created with sub.iterator() is an encoding-down iterator which doesn't expose seek (yet).

@vweevers
Copy link
Member

To be precise, it doesn't forward it yet.

@MeirionHughes
Copy link
Member Author

dam... I didn't bother to check there as it wasn't in my chain. cheers.

@MeirionHughes MeirionHughes removed the help wanted Extra attention is needed label Jun 21, 2019
@MeirionHughes
Copy link
Member Author

oh balls... I pushed to the wrong origin. will revert.

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

No branches or pull requests

2 participants