| 347 | } |
| 348 | |
| 349 | void WriteCache() { |
| 350 | CHECK(!cache_info_->written); |
| 351 | common::Timer timer; |
| 352 | timer.Start(); |
| 353 | auto fmt{this->CreatePageFormat(this->param_)}; |
| 354 | |
| 355 | auto name = cache_info_->ShardName(); |
| 356 | std::unique_ptr<typename FormatStreamPolicy::WriterT> fo{ |
| 357 | this->CreateWriter(StringView{name}, this->Iter())}; |
| 358 | auto bytes = fmt->Write(*page_, fo.get()); |
| 359 | |
| 360 | timer.Stop(); |
| 361 | if (bytes != InvalidPageSize()) { |
| 362 | // Not entirely accurate, the kernel doesn't have to flush the data. |
| 363 | LOG(INFO) << common::HumanMemUnit(bytes) << " written in " << timer.ElapsedSeconds() |
| 364 | << " seconds."; |
| 365 | cache_info_->Push(bytes); |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | virtual void Fetch() = 0; |
| 370 |
no test coverage detected