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

Added finished callback to iterator.forRange() #33

Closed
wants to merge 2 commits into from
Closed

Added finished callback to iterator.forRange() #33

wants to merge 2 commits into from

Conversation

ulikoehler
Copy link

This pull request adds an additional, optional argument to iterator.forRange() which is a callback without argument.

This callback is called when the iterator has reached limitKey.

In any case, the finished callback is not called if any error occurs and the "normal" callback is guaranteed not to be called after the finished callback.

As the finished callback is optional, any call to forRange() not using the finished callback works exactly as before.

Currently there are no unit tests for this, but I tested the new feature in an expressjs app.

I think this feature is extremely important to node-leveldb - in my use case it is absolutely essential.

Also see Issue #28 for another request for this feature which should be fixed after merging this pull request.

if typeof(args[args.length - 1]) is 'function' and typeof(args[args.length - 2]) is 'function'
finishedCallback = args.pop()
else
finishedCallback = ->{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need to set finishedCallback

my8bird added a commit that referenced this pull request Jul 13, 2012
@my8bird my8bird closed this Jul 13, 2012
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.

3 participants