View source on GitHub |
Like QueueFuture but maintains the order of insertion.
Inherits From: Future
, expected_type
google.appengine.ext.ndb.SerialQueueFuture(
info=None
)
This class is used by Query operations.
Invariants:
- At least one of _queue and _waiting is empty.
- The Futures in _waiting are always pending.
(The Futures in _queue may be pending or completed.)
In the discussion below, add_dependent() is treated the same way as putq().
If putq() is ahead of getq(), the situation is like this:
putq()
v
_queue: [f1, f2, ...]; _waiting: [] ^ getq()
Here, putq() appends a Future to the right of _queue, and getq() removes one from the left.
If getq() is ahead of putq(), it's like this:
putq()
v
_queue: []; _waiting: [f1, f2, ...] ^ getq()
Here, putq() removes a Future from the left of _waiting, and getq() appends one to the right.
When both are empty, putq() appends a Future to the right of _queue, while getq() appends one to the right of _waiting.
The _full flag means that no more calls to putq() will be made; it is set by calling either complete() or set_exception().
Calling complete() signals that no more putq() calls will be made. If getq() is behind, subsequent getq() calls will eat up _queue until it is empty, and after that will return a Future that passes EOFError (note that getq() itself never raises EOFError). If getq() is ahead when complete() is called, the Futures in _waiting are all passed an EOFError exception (thereby eating up _waiting).
If, instead of complete(), set_exception() is called, the exception and traceback set there will be used instead of EOFError.
Attributes | |
---|---|
state
|
Methods
add_callback
add_callback(
callback, *args, **kwds
)
add_dependent
add_dependent(
fut
)
add_immediate_callback
add_immediate_callback(
callback, *args, **kwds
)
check_success
check_success()
complete
complete()
done
done()
dump
dump()
dump_stack
dump_stack()
get_exception
get_exception()
get_result
get_result()
get_traceback
get_traceback()
getq
getq()
putq
putq(
value
)
set_exception
set_exception(
exc, tb=None
)
set_result
set_result(
result
)
wait
wait()
wait_all
@classmethod
wait_all( futures )
wait_any
@classmethod
wait_any( futures )
Class Variables | |
---|---|
FINISHING |
2
|
IDLE |
0
|
RUNNING |
1
|