-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When no more records will fit in the current chunk after adding the c…
…urrent record (most likely a single record exceeds the desired chunk size), write the chunk after adding the record instead of keeping a large chunk in memory. This required redesigning `LastPos()`, because after a successful `WriteRecord()` the chunk encoder no longer necessarily holds the last record. As a bonus, `LastPos()` remains valid after `Flush()` and `Close()`. A side effect, besides writing the chunk earlier, is that `Pos()` in such case points after that chunk, having `record_index() == 0`, rather than at the end of the chunk. In other words, in more cases `Pos()` will happen to be the canonical position of the next record, OTOH still not always. Cosmetics: let `RecordWriterBase::WriteRecordImpl()` cover also `WriteRecord(MessageLite)` by making the parameters variadic. This reduces source code duplication. Cosmetics: skip overflow protection when a chunk in memory would exceed `uint64_t` range. PiperOrigin-RevId: 604212432
- Loading branch information
Showing
4 changed files
with
82 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters