| 150 | } |
| 151 | |
| 152 | void TableBuilder::Flush() { |
| 153 | Rep* r = rep_; |
| 154 | assert(!r->closed); |
| 155 | if (!ok()) return; |
| 156 | if (r->data_block.empty()) return; |
| 157 | assert(!r->pending_index_entry); |
| 158 | WriteBlock(&r->data_block, &r->pending_handle); |
| 159 | if (ok()) { |
| 160 | r->pending_index_entry = true; |
| 161 | // We don't flush the underlying file as that can be slow. |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | void TableBuilder::WriteBlock(BlockBuilder* block, BlockHandle* handle) { |
| 166 | // File format contains a sequence of blocks where each block has: |