MCPcopy Create free account
hub / github.com/couchbase/couchbase-python-client / stream_next

Function stream_next

couchbase/logic/streaming.py:78–105  ·  view source on GitHub ↗

**INTERNAL** Drive a single synchronous streaming iteration for ``req`` and apply uniform teardown/error handling. Shared by the blocking (``couchbase``) and Twisted (``txcouchbase``) row iterators.

(req)

Source from the content-addressed store, hash-verified

76
77
78def stream_next(req):
79 """
80 **INTERNAL**
81
82 Drive a single synchronous streaming iteration for ``req`` and apply uniform teardown/error
83 handling. Shared by the blocking (``couchbase``) and Twisted (``txcouchbase``) row iterators.
84 """
85 try:
86 row = req._get_next_row()
87 # See stream_anext for why the span is ended here (idempotent, ends on the first row).
88 req._process_core_span()
89 return row
90 except StopIteration:
91 req._done_streaming = True
92 req._process_core_span()
93 req._get_metadata()
94 raise
95 except CouchbaseException as ex:
96 req._process_core_span(exc_val=ex)
97 raise
98 except Exception as ex:
99 excptn = _internal_exception(str(ex))
100 req._process_core_span(exc_val=excptn)
101 raise excptn
102 except BaseException as ex:
103 # KeyboardInterrupt / SystemExit -- see module note above.
104 req._process_core_span(exc_val=ex)
105 raise

Calls 4

_internal_exceptionFunction · 0.85
_get_next_rowMethod · 0.45
_process_core_spanMethod · 0.45
_get_metadataMethod · 0.45