Make BufferedFile to be a CAutoFile wrapper

This refactor allows to forward some calls to the underlying CAutoFile,
instead of re-implementing the logic in the buffered file.
This commit is contained in:
MarcoFalke
2023-07-04 17:09:13 +02:00
parent fa389d902f
commit 9999b89cd3
9 changed files with 23 additions and 27 deletions

View File

@@ -56,7 +56,7 @@ static void LoadExternalBlockFile(benchmark::Bench& bench)
// "rb" is "binary, O_RDONLY", positioned to the start of the file.
// The file will be closed by LoadExternalBlockFile().
CAutoFile file{fsbridge::fopen(blkfile, "rb"), CLIENT_VERSION};
testing_setup->m_node.chainman->LoadExternalBlockFile(file.Get(), &pos, &blocks_with_unknown_parent);
testing_setup->m_node.chainman->LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent);
});
fs::remove(blkfile);
}

View File

@@ -20,7 +20,7 @@ static void FindByte(benchmark::Bench& bench)
data[file_size-1] = 1;
file << data;
std::rewind(file.Get());
BufferedFile bf{file.Get(), /*nBufSize=*/file_size + 1, /*nRewindIn=*/file_size, 0};
BufferedFile bf{file, /*nBufSize=*/file_size + 1, /*nRewindIn=*/file_size};
bench.run([&] {
bf.SetPos(0);