| 2218 | class DataFetcher { |
| 2219 | public: |
| 2220 | DataFetcher(const std::string& taskId, int32_t destination, int64_t maxBytes) |
| 2221 | : taskId_{taskId}, destination_{destination}, maxBytes_{maxBytes} {} |
| 2222 | |
| 2223 | /// Starts fetching data for the task and destination specified in the |
| 2224 | /// constructor. Returns a future that gets completes once all the data has |
| 2225 | /// been fetched. |
| 2226 | ContinueFuture fetch() { |
| 2227 | auto [p, f] = makeBoltContinuePromiseContract("DataFetcher"); |
| 2228 | promise_ = std::move(p); |
| 2229 | doFetch(kInitialSequence); |
| 2230 | return std::move(f); |
| 2231 | } |
| 2232 | |
| 2233 | struct Stats { |
| 2234 | /// Number of possibly multi-page packets received. |
| 2235 | int32_t numPackets; |
| 2236 | /// Number of pages received. Includes the last null page. |
| 2237 | int32_t numPages; |
| 2238 | /// Total number of bytes received across all pages. |
| 2239 | int64_t totalBytes; |
| 2240 | |
| 2241 | /// Average number of bytes per packet. |
| 2242 | int64_t averagePacketBytes() const { |
nothing calls this directly
no test coverage detected