HomePhabricator

util: add CBufferedFile::SkipTo() to move ahead in the stream

Description

util: add CBufferedFile::SkipTo() to move ahead in the stream

Summary:
SkipTo() reads data from the file into the CBufferedFile object
(memory), but, unlike this object's read() method, SkipTo() doesn't
transfer data into a caller's memory buffer. This is useful because
after skipping forward in the stream in this way, the user can, if
needed, rewind the stream (SetPos()) and access the object's memory
buffer including ranges that were skipped over (without needing to
read from the disk file).

This is a partial backport of core#16981
https://github.com/bitcoin/bitcoin/pull/16981/commits/db929893ef0bc86ea2708cdbcf41152240cd7c73

Depends on D15959

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15960

Details

Provenance
Larry Ruane <larryruane@gmail.com>Authored on Jul 13 2020, 23:11
PiRKCommitted on Apr 12 2024, 14:28
PiRKPushed on Apr 12 2024, 14:28
Reviewer
Restricted Project
Differential Revision
D15960: util: add CBufferedFile::SkipTo() to move ahead in the stream
Parents
rABCbbba97aeab3a: Add LoadExternalBlockFile() benchmark
Branches
Unknown
Tags
Unknown