| 471 | |
| 472 | public: |
| 473 | SparsePageSource(DataIterProxy<DataIterResetCallback, XGDMatrixCallbackNext> iter, |
| 474 | DMatrixProxy* proxy, float missing, int nthreads, bst_feature_t n_features, |
| 475 | bst_idx_t n_batches, std::shared_ptr<Cache> cache) |
| 476 | : SparsePageSourceImpl(missing, nthreads, n_features, cache), |
| 477 | iter_{std::move(iter)}, |
| 478 | proxy_{proxy}, |
| 479 | n_batches_{n_batches} { |
| 480 | if (!cache_info_->written) { |
| 481 | iter_.Reset(); |
| 482 | CHECK(iter_.Next()) << "Must have at least 1 batch."; |
| 483 | } |
| 484 | this->Fetch(); |
| 485 | } |
| 486 | |
| 487 | SparsePageSource& operator++() final { |
| 488 | TryLockGuard guard{single_threaded_}; |