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

Document new wait option to next in Ruby and Python #664

Closed
danielmewes opened this issue Mar 3, 2015 · 1 comment
Closed

Document new wait option to next in Ruby and Python #664

danielmewes opened this issue Mar 3, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@danielmewes
Copy link
Member

See rethinkdb/rethinkdb#3529

@Tryneus can you briefly sum up the syntax of the option here and mention which terms are accepting it exactly?

@danielmewes danielmewes added the api label Mar 3, 2015
@danielmewes danielmewes added this to the 2.0 milestone Mar 3, 2015
@Tryneus
Copy link
Member

Tryneus commented Mar 3, 2015

In python:

These exists a function Cursor::next() which accepts an optional argument wait, which may be a bool, None, or a number type.

cursor.next(wait=True) (default):
Wait indefinitely for the next row of the cursor.

cursor.next(wait=False), cursor.next(wait=None), cursor.next(wait=0):
No wait will be performed. If data is immediately available, it will be returned normally, or if data is not immediately available, RqlDriverError("Timed out waiting for cursor response.") will be raised.

If wait is any number greater than 0, the same behavior will occur except that we will wait up to wait seconds for data to become available before raising the RqlDriverError.

If the cursor is empty or completely exhausted and next is called, a StopIteration error will be raised.

In ruby:

There exists a function Cursor::next() which accepts an optional argument, which may be true, false, nil, or a number type.

cursor.next(true) (default):
Wait indefinitely for the next row of the cursor.

cursor.next(false), cursor.next(nil), cursor.next(0):
No wait will be performed. If data is immediately available, it will be returned normally, or if data is not immediately available, Timeout::Error("Timed out waiting for cursor response.") will be raised.

If the argument is any number greater than 0, the same behavior will occur except that we will wait up to that many seconds for data to become available before raising the Timeout::Error.

If the cursor is empty or completely exhausted and next is called, a StopIteration error will be raised.

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

No branches or pull requests

3 participants