|
Couchbase C++ SDK 1.4.0 (rev. 59aa900)
|
A streaming result handle for analytics queries. More...
#include <couchbase/analytics_stream_result.hxx>
Classes | |
| struct | end_sentinel |
| Sentinel returned by end(). More... | |
| class | iterator |
| A single-pass input iterator that synchronously fetches rows one at a time. More... | |
Public Member Functions | |
| analytics_stream_result ()=default | |
| Constructs an empty (no-op) result handle. | |
| analytics_stream_result (std::shared_ptr< internal_analytics_stream_result > internal) | |
| Constructs an analytics stream result from an internal result. | |
| void | next (analytics_row_handler &&handler) const |
| Fetches the next row asynchronously, invoking the handler when ready. | |
| auto | next () const -> std::future< std::pair< error, std::optional< analytics_row > > > |
| Fetches the next row, returning a future. | |
| auto | signature () const -> std::optional< codec::binary > |
| Returns the analytics signature captured from the response metadata, if present. | |
| auto | meta_data () const -> std::future< std::pair< error, analytics_meta_data > > |
| Returns the analytics metadata. | |
| void | cancel () const |
| Cancels the stream and closes the underlying HTTP connection. | |
| auto | begin () const -> iterator |
| Returns an iterator to the beginning. | |
| auto | end () const -> end_sentinel |
| Returns the end sentinel. | |
A streaming result handle for analytics queries.
Rows are fetched one at a time via next(). The stream must be fully drained (or cancel() called) before meta_data() resolves. Only a single next() call may be outstanding at a time.
|
default |
|
explicit |
Constructs an analytics stream result from an internal result.
| internal | the internal result handle |
|
nodiscard |
Returns an iterator to the beginning.
| void cancel | ( | ) | const |
Cancels the stream and closes the underlying HTTP connection.
Simply dropping the last handle before the stream is fully drained also tears the stream down, but if a pull is in flight the underlying connection is not released until that pull settles (up to the inter-read idle timeout). Call cancel() explicitly for prompt, deterministic teardown of the connection and its timers.
|
nodiscard |
|
nodiscard |
Returns the analytics metadata.
The returned future resolves only after the stream has been fully drained (all rows consumed or the stream cancelled). May be called more than once; each call returns its own future and all of them resolve together once the metadata becomes available.
|
nodiscard |
Fetches the next row, returning a future.
Only one outstanding call is allowed at a time.
| void next | ( | analytics_row_handler && | handler | ) | const |
Fetches the next row asynchronously, invoking the handler when ready.
The handler receives ({}, row) for a real row, ({}, {}) at clean end-of-stream, or (error, {}) if the stream ended with an error.
Only one outstanding call is allowed at a time.
| handler | callable that implements analytics_row_handler |
|
nodiscard |
Returns the analytics signature captured from the response metadata, if present.
The signature is part of the response preamble, so — unlike meta_data() — it is available as soon as the stream has started, without draining it first: