| 83 | } |
| 84 | |
| 85 | size_t TChunkedOutputStream::DoNext(void** ptr) |
| 86 | { |
| 87 | if (CurrentChunk_.Size() == CurrentChunk_.Capacity()) { |
| 88 | if (CurrentChunk_.Capacity() == 0) { |
| 89 | CurrentChunk_.Reserve(CurrentReserveSize_); |
| 90 | } else { |
| 91 | ReserveNewChunk(0); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | auto spaceAvailable = CurrentChunk_.Capacity() - CurrentChunk_.Size(); |
| 96 | YT_ASSERT(spaceAvailable > 0); |
| 97 | *ptr = CurrentChunk_.End(); |
| 98 | CurrentChunk_.Resize(CurrentChunk_.Capacity(), /*initializeStorage*/ false); |
| 99 | UpdateCurrentChunkMemoryUsage(); |
| 100 | return spaceAvailable; |
| 101 | } |
| 102 | |
| 103 | void TChunkedOutputStream::DoUndo(size_t len) |
| 104 | { |