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

Add KeyValue callback handlers for get and scan. #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lzheng
Copy link

@lzheng lzheng commented May 23, 2013

@tsuna @canoeberry @jasonculverhouse
This is a merge back of what Jonathan created at: Flipboard@ef2c07b
I did several touch-ups to make sure the change can be integrated back to OpenTSDB/asynchbase.

The change will enable callers for scanner and get to specify a callback handler to process KeyValue as they are coming. Thus caller can decide if the value should be saved or discarded. It is a great way to save some memories and avoid too much GCs.

I still have a couple of questions:

  1. Is there a way to stop/cancel the get/scan when the Callback returns false? E.g.: if the caller of get/scanner decides he gets enough data already, he could cancel the request thus avoid unnecessary traffics.
  2. In this implementation, when the callback is not null, we return an deferred empty array list. We could also return deferred long or list of longs. However, I found it is not very straight forward to do so. Please let me know if you have got suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants