aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-07-18 14:13:53 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-07-18 14:13:53 +0000
commit570ab08f83b98783b9a18338df29f78ecaeb729a (patch)
tree859a2a5c8fbda6aba6e7a527bb1ed9dea8c15159 /searchlib
parent1d980cc63e8dc30dbd4ce4b4faaf04e420a90882 (diff)
Drop non ancient non const GetSize/GetPosition
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/apps/docstore/documentstoreinspect.cpp2
-rw-r--r--searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp2
-rw-r--r--searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp8
-rw-r--r--searchlib/src/tests/transactionlog/translogclient_test.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/fileheader.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/diskindex/zcposting.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/docstore/filechunk.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/docstore/logdatastore.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/docstore/randread.h4
-rw-r--r--searchlib/src/vespa/searchlib/docstore/randreaders.cpp17
-rw-r--r--searchlib/src/vespa/searchlib/docstore/randreaders.h8
-rw-r--r--searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp32
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp54
-rw-r--r--searchlib/src/vespa/searchlib/util/comprfile.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/util/file_with_header.cpp2
22 files changed, 91 insertions, 92 deletions
diff --git a/searchlib/src/apps/docstore/documentstoreinspect.cpp b/searchlib/src/apps/docstore/documentstoreinspect.cpp
index f19a128535f..f0ae2c67998 100644
--- a/searchlib/src/apps/docstore/documentstoreinspect.cpp
+++ b/searchlib/src/apps/docstore/documentstoreinspect.cpp
@@ -35,7 +35,7 @@ int DocumentStoreInspectApp::dumpIdxFile(const vespalib::string & file)
idxFile.enableMemoryMap(0);
if (idxFile.OpenReadOnly()) {
if (idxFile.IsMemoryMapped()) {
- int64_t fileSize = idxFile.GetSize();
+ int64_t fileSize = idxFile.getSize();
uint32_t docIdLimit = std::numeric_limits<uint32_t>::max();
uint64_t idxHeaderLen = FileChunk::readIdxHeader(idxFile, docIdLimit);
vespalib::nbostream is(static_cast<const char *>
diff --git a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
index b0abfee4ab8..4391cfe6525 100644
--- a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
+++ b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp
@@ -318,7 +318,7 @@ FileChecksum::FileChecksum(const vespalib::string &file_name)
LOG(error, "Could not open %s for sha256 checksum", full_file_name.c_str());
LOG_ABORT("should not be reached");
}
- int64_t flen = f.GetSize();
+ int64_t flen = f.getSize();
int64_t remainder = flen;
EvpMdCtxPtr md_ctx(EVP_MD_CTX_new());
const EVP_MD* md = EVP_get_digestbyname("SHA256");
diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
index 1d7bd9b8504..3b023ed3bc8 100644
--- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
+++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
@@ -184,15 +184,15 @@ TEST("test that DirectIOPadding works accordng to spec") {
EXPECT_FALSE(file.DirectIOPadding(FILE_SIZE-1, 4_Ki, padBefore, padAfter));
EXPECT_EQUAL(0u, padBefore);
EXPECT_EQUAL(0u, padAfter);
- EXPECT_EQUAL(FILE_SIZE, file.GetSize());
+ EXPECT_EQUAL(FILE_SIZE, file.getSize());
FastOS_File file2("directio.test");
file2.EnableDirectIO();
EXPECT_TRUE(file2.OpenWriteOnlyExisting(true));
- EXPECT_TRUE(file2.SetPosition(file2.GetSize()));
- EXPECT_EQUAL(FILE_SIZE, file2.GetSize());
+ EXPECT_TRUE(file2.SetPosition(file2.getSize()));
+ EXPECT_EQUAL(FILE_SIZE, file2.getSize());
EXPECT_EQUAL(FILE_SIZE, file2.Write2(buf.get(), FILE_SIZE));
- EXPECT_EQUAL(FILE_SIZE*2, file2.GetSize());
+ EXPECT_EQUAL(FILE_SIZE*2, file2.getSize());
EXPECT_TRUE(file2.Close());
EXPECT_TRUE(file.DirectIOPadding(4097, 4_Ki, padBefore, padAfter));
diff --git a/searchlib/src/tests/transactionlog/translogclient_test.cpp b/searchlib/src/tests/transactionlog/translogclient_test.cpp
index af277ecbc68..0f19a0b233b 100644
--- a/searchlib/src/tests/transactionlog/translogclient_test.cpp
+++ b/searchlib/src/tests/transactionlog/translogclient_test.cpp
@@ -935,7 +935,7 @@ TEST("test truncate on version mismatch") {
}
FastOS_File f((testDir.getDir() + "/sync/sync-0000000000000000").c_str());
EXPECT_TRUE(f.OpenWriteOnlyExisting());
- EXPECT_TRUE(f.SetPosition(f.GetSize()));
+ EXPECT_TRUE(f.SetPosition(f.getSize()));
char tmp[100];
memset(tmp, 0, sizeof(tmp));
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
index efdbedd0941..700bd82da78 100644
--- a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp
@@ -51,7 +51,7 @@ BitVectorDictionary::open(const vespalib::string &pathPrefix,
_entries.resize(numEntries);
size_t bufSize = sizeof(WordSingleKey) * numEntries;
- assert(idxFile.GetSize() >= static_cast<int64_t>(idxHeaderLen + bufSize));
+ assert(idxFile.getSize() >= static_cast<int64_t>(idxHeaderLen + bufSize));
if (bufSize > 0) {
ssize_t has_read = idxFile.Read(&_entries[0], bufSize);
assert(has_read == ssize_t(bufSize));
@@ -75,7 +75,7 @@ BitVectorDictionary::open(const vespalib::string &pathPrefix,
}
vespalib::FileHeader datHeader(64);
_datHeaderLen = datHeader.readFile(*_datFile);
- assert(_datFile->GetSize() >=
+ assert(_datFile->getSize() >=
static_cast<int64_t>(_vectorSize * _entries.size() + _datHeaderLen));
return true;
}
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp
index f4d129bfc58..bcde4a17ea7 100644
--- a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.cpp
@@ -73,13 +73,13 @@ BitVectorFileWrite::open(const vespalib::string &name,
pos = static_cast<int64_t>(_numKeys) *
static_cast<int64_t>(bitmapbytes) + _datHeaderLen;
- int64_t olddatsize = _datFile->GetSize();
+ int64_t olddatsize = _datFile->getSize();
assert(olddatsize >= pos);
(void) olddatsize;
_datFile->SetSize(pos);
- assert(pos == _datFile->GetPosition());
+ assert(pos == _datFile->getPosition());
}
@@ -157,7 +157,7 @@ BitVectorFileWrite::close()
if (_datFile != nullptr) {
if (_datFile->IsOpened()) {
- uint64_t pos = _datFile->GetPosition();
+ uint64_t pos = _datFile->getPosition();
assert(pos == static_cast<uint64_t>(_numKeys) *
static_cast<uint64_t>(bitmapbytes) + _datHeaderLen);
(void) bitmapbytes;
diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp
index 0caf89a0730..ba7f19b4b0b 100644
--- a/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/bitvectoridxfile.cpp
@@ -75,13 +75,13 @@ BitVectorIdxFileWrite::open(const vespalib::string &name,
int64_t pos = idxSize();
- int64_t oldidxsize = _idxFile->GetSize();
+ int64_t oldidxsize = _idxFile->getSize();
assert(oldidxsize >= pos);
(void) oldidxsize;
_idxFile->SetSize(pos);
- assert(pos == _idxFile->GetPosition());
+ assert(pos == _idxFile->getPosition());
}
void
@@ -138,7 +138,7 @@ BitVectorIdxFileWrite::flush()
{
_idxFile->Flush();
- uint64_t pos = _idxFile->GetPosition();
+ uint64_t pos = _idxFile->getPosition();
assert(pos == idxSize());
(void) pos;
}
@@ -162,7 +162,7 @@ BitVectorIdxFileWrite::close()
{
if (_idxFile) {
if (_idxFile->IsOpened()) {
- uint64_t pos = _idxFile->GetPosition();
+ uint64_t pos = _idxFile->getPosition();
assert(pos == idxSize());
_idxFile->alignEndForDirectIO();
updateIdxHeader(pos * 8);
diff --git a/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp b/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp
index 432651278e0..02ae7b714bc 100644
--- a/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp
@@ -47,7 +47,7 @@ FileHeader::taste(const vespalib::string &name,
return false;
}
- fileSize = file.GetSize();
+ fileSize = file.getSize();
try {
headerLen = header.readFile(file);
assert(headerLen >= header.getSize());
diff --git a/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp b/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp
index b90fdbe329f..0e2b4032689 100644
--- a/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/pagedict4file.cpp
@@ -83,7 +83,7 @@ PageDict4FileSeqRead::DictFileReadContext::DictFileReadContext(vespalib::stringr
LOG(error, "could not open %s: %s", _file.GetFileName(), getLastErrorString().c_str());
return;
}
- uint64_t fileSize = _file.GetSize();
+ uint64_t fileSize = _file.getSize();
_readContext.setFile(&_file);
_readContext.setFileSize(fileSize);
if (read_all_upfront) {
@@ -257,11 +257,11 @@ PageDict4FileSeqWrite::DictFileContext::DictFileContext(bool extended, vespalib:
assertOpenWriteOnly(ok, name);
_writeContext.setFile(&_file);
_writeContext.allocComprBuf(64_Ki, 32_Ki);
- uint64_t fileSize = _file.GetSize();
+ uint64_t fileSize = _file.getSize();
uint64_t bufferStartFilePos = _writeContext.getBufferStartFilePos();
assert(fileSize >= bufferStartFilePos);
_file.SetSize(bufferStartFilePos);
- assert(bufferStartFilePos == static_cast<uint64_t>(_file.GetPosition()));
+ assert(bufferStartFilePos == static_cast<uint64_t>(_file.getPosition()));
_ec.setupWrite(_writeContext);
assert(_ec.getWriteOffset() == 0);
diff --git a/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp b/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp
index c8374610dea..c3192f303b6 100644
--- a/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/pagedict4randread.cpp
@@ -84,7 +84,7 @@ PageDict4RandRead::readSPHeader()
d.setReadContext(&rc);
rc.setFile(_spfile.get());
- rc.setFileSize(_spfile->GetSize());
+ rc.setFileSize(_spfile->getSize());
rc.allocComprBuf(512, 32768u);
d.emptyBuffer(0);
rc.readComprBuffer();
@@ -117,7 +117,7 @@ PageDict4RandRead::readPHeader()
d.setReadContext(&rc);
rc.setFile(_pfile.get());
- rc.setFileSize(_pfile->GetSize());
+ rc.setFileSize(_pfile->getSize());
rc.allocComprBuf(512, 32768u);
d.emptyBuffer(0);
rc.readComprBuffer();
@@ -228,7 +228,7 @@ PageDict4RandRead::open(const vespalib::string &name,
return false;
}
- uint64_t fileSize = _ssfile->GetSize();
+ uint64_t fileSize = _ssfile->getSize();
_ssReadContext.setFile(_ssfile.get());
_ssReadContext.setFileSize(fileSize);
_ssReadContext.allocComprBuf((fileSize + sizeof(uint64_t) - 1) / sizeof(uint64_t), 32768u);
diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp
index 3c74ab5ff07..7b21349b6c3 100644
--- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp
@@ -24,7 +24,7 @@ WordNumMapping::readMappingFile(const vespalib::string &name,
}
// XXX no checking for success
old2newwordfile.ReadOpen(name.c_str());
- int64_t tempfilesize = old2newwordfile.GetSize();
+ int64_t tempfilesize = old2newwordfile.getSize();
uint64_t tempfileentries = static_cast<uint64_t>(tempfilesize /
sizeof(uint64_t));
Array &map = _old2newwords;
diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp b/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp
index 8a987c49544..5d4f1e2f785 100644
--- a/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/zcposoccrandread.cpp
@@ -165,7 +165,7 @@ open(const vespalib::string &name, const TuneFileRandRead &tuneFileRead)
LOG(error, "could not open %s: %s", _file->GetFileName(), getLastErrorString().c_str());
return false;
}
- _fileSize = _file->GetSize();
+ _fileSize = _file->getSize();
readHeader();
return true;
@@ -187,7 +187,7 @@ ZcPosOccRandRead::readHeader(const vespalib::string &identifier)
ComprFileReadContext drc(d);
drc.setFile(_file.get());
- drc.setFileSize(_file->GetSize());
+ drc.setFileSize(_file->getSize());
drc.allocComprBuf(512, 32768u);
d.emptyBuffer(0);
drc.readComprBuffer();
diff --git a/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp b/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp
index c9a1563a8e3..ad262fef794 100644
--- a/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp
+++ b/searchlib/src/vespa/searchlib/diskindex/zcposting.cpp
@@ -74,7 +74,7 @@ Zc4PostingSeqRead::open(const vespalib::string &name,
if (res) {
auto &readContext = _reader.get_read_context();
readContext.setFile(&_file);
- readContext.setFileSize(_file.GetSize());
+ readContext.setFileSize(_file.getSize());
auto &d = _reader.get_decode_features();
readContext.allocComprBuf(65536u, 32768u);
d.emptyBuffer(0);
diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp
index 98541dba646..71dfed86fdb 100644
--- a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp
@@ -92,13 +92,13 @@ FileChunk::FileChunk(FileId fileId, NameId nameId, const vespalib::string & base
if (!dataFile.Sync()) {
throw SummaryException("Failed syncing dat file", dataFile, VESPA_STRLOC);
}
- _diskFootprint.fetch_add(dataFile.GetSize(), std::memory_order_relaxed);
+ _diskFootprint.fetch_add(dataFile.getSize(), std::memory_order_relaxed);
FastOS_File idxFile(_idxFileName.c_str());
if (idxFile.OpenReadOnly()) {
if (!idxFile.Sync()) {
throw SummaryException("Failed syncing idx file", idxFile, VESPA_STRLOC);
}
- _diskFootprint.fetch_add(idxFile.GetSize(), std::memory_order_relaxed);
+ _diskFootprint.fetch_add(idxFile.getSize(), std::memory_order_relaxed);
_modificationTime = FileKit::getModificationTime(_idxFileName);
} else {
throw SummaryException("Failed opening idx file", idxFile, VESPA_STRLOC);
@@ -162,7 +162,7 @@ FileChunk::updateLidMap(const unique_lock &guard, ISetLid &ds, uint64_t serialNu
idxFile.enableMemoryMap(0);
if (idxFile.OpenReadOnly()) {
if (idxFile.IsMemoryMapped()) {
- const int64_t fileSize = idxFile.GetSize();
+ const int64_t fileSize = idxFile.getSize();
if (_idxHeaderLen == 0) {
_idxHeaderLen = readIdxHeader(idxFile, _docIdLimit);
}
@@ -436,7 +436,7 @@ FileChunk::readDataHeader(FileRandRead &datFile)
uint64_t
FileChunk::readIdxHeader(FastOS_FileInterface &idxFile, uint32_t &docIdLimit)
{
- int64_t fileSize = idxFile.GetSize();
+ int64_t fileSize = idxFile.getSize();
uint32_t hl = GenericHeader::getMinSize();
uint64_t idxHeaderLen = 0;
if (fileSize >= hl) {
diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
index 7f63cb4c2d4..05f3413cdd8 100644
--- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp
@@ -694,7 +694,7 @@ hasNonHeaderData(const vespalib::string &name)
FastOS_File file(name.c_str());
if (!file.OpenReadOnly())
return false;
- int64_t fSize(file.GetSize());
+ int64_t fSize(file.getSize());
uint32_t headerLen = 0;
uint32_t minHeaderLen = vespalib::GenericHeader::getMinSize();
if (fSize < minHeaderLen)
diff --git a/searchlib/src/vespa/searchlib/docstore/randread.h b/searchlib/src/vespa/searchlib/docstore/randread.h
index 63e615e2b23..6f47e625e48 100644
--- a/searchlib/src/vespa/searchlib/docstore/randread.h
+++ b/searchlib/src/vespa/searchlib/docstore/randread.h
@@ -16,9 +16,9 @@ class FileRandRead
{
public:
using FSP = std::shared_ptr<FastOS_FileInterface>;
- virtual ~FileRandRead() { }
+ virtual ~FileRandRead() = default;
virtual FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) = 0;
- virtual int64_t getSize() = 0;
+ virtual int64_t getSize() const = 0;
};
}
diff --git a/searchlib/src/vespa/searchlib/docstore/randreaders.cpp b/searchlib/src/vespa/searchlib/docstore/randreaders.cpp
index 0d1485891d6..337ae1f95d1 100644
--- a/searchlib/src/vespa/searchlib/docstore/randreaders.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/randreaders.cpp
@@ -49,9 +49,8 @@ DirectIORandRead::read(size_t offset, vespalib::DataBuffer & buffer, size_t sz)
int64_t
-DirectIORandRead::getSize()
-{
- return _file->GetSize();
+DirectIORandRead::getSize() const {
+ return _file->getSize();
}
@@ -85,8 +84,8 @@ MMapRandRead::read(size_t offset, vespalib::DataBuffer & buffer, size_t sz)
}
int64_t
-MMapRandRead::getSize() {
- return _file->GetSize();
+MMapRandRead::getSize() const {
+ return _file->getSize();
}
const void *
@@ -147,8 +146,8 @@ MMapRandReadDynamic::contains(const FastOS_FileInterface & file, size_t sz) {
int64_t
-MMapRandReadDynamic::getSize() {
- return _holder.get()->GetSize();
+MMapRandReadDynamic::getSize() const {
+ return _holder.get()->getSize();
}
FileRandRead::FSP
@@ -162,9 +161,9 @@ NormalRandRead::read(size_t offset, vespalib::DataBuffer & buffer, size_t sz)
}
int64_t
-NormalRandRead::getSize()
+NormalRandRead::getSize() const
{
- return _file->GetSize();
+ return _file->getSize();
}
}
diff --git a/searchlib/src/vespa/searchlib/docstore/randreaders.h b/searchlib/src/vespa/searchlib/docstore/randreaders.h
index b672116ca6d..d7fe655dc7a 100644
--- a/searchlib/src/vespa/searchlib/docstore/randreaders.h
+++ b/searchlib/src/vespa/searchlib/docstore/randreaders.h
@@ -15,7 +15,7 @@ class DirectIORandRead : public FileRandRead
public:
DirectIORandRead(const vespalib::string & fileName);
FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) override;
- int64_t getSize() override;
+ int64_t getSize() const override;
private:
std::unique_ptr<FastOS_FileInterface> _file;
size_t _alignment;
@@ -28,7 +28,7 @@ class MMapRandRead : public FileRandRead
public:
MMapRandRead(const vespalib::string & fileName, int mmapFlags, int fadviseOptions);
FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) override;
- int64_t getSize() override;
+ int64_t getSize() const override;
const void * getMapping();
private:
std::unique_ptr<FastOS_FileInterface> _file;
@@ -39,7 +39,7 @@ class MMapRandReadDynamic : public FileRandRead
public:
MMapRandReadDynamic(const vespalib::string & fileName, int mmapFlags, int fadviseOptions);
FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) override;
- int64_t getSize() override;
+ int64_t getSize() const override;
private:
static bool contains(const FastOS_FileInterface & file, size_t sz);
void remap(size_t end);
@@ -55,7 +55,7 @@ class NormalRandRead : public FileRandRead
public:
NormalRandRead(const vespalib::string & fileName);
FSP read(size_t offset, vespalib::DataBuffer & buffer, size_t sz) override;
- int64_t getSize() override;
+ int64_t getSize() const override;
private:
std::unique_ptr<FastOS_FileInterface> _file;
};
diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
index 84bad6b65ac..7102b80d7d0 100644
--- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
@@ -122,7 +122,7 @@ WriteableFileChunk(vespalib::Executor &executor,
if (_dataHeaderLen == 0) {
writeDataHeader(fileHeaderContext);
}
- _dataFile.SetPosition(_dataFile.GetSize());
+ _dataFile.SetPosition(_dataFile.getSize());
if (tune._write.getWantDirectIO()) {
if (!_dataFile.GetDirectIORestrictions(_alignment, _granularity, _maxChunkSize)) {
LOG(debug, "Direct IO setup failed for file %s due to %s",
@@ -134,7 +134,7 @@ WriteableFileChunk(vespalib::Executor &executor,
if (_idxHeaderLen == 0) {
_idxHeaderLen = writeIdxHeader(fileHeaderContext, _docIdLimit, *idxFile);
}
- _idxFileSize.store(idxFile->GetSize(), std::memory_order_relaxed);
+ _idxFileSize.store(idxFile->getSize(), std::memory_order_relaxed);
if ( ! idxFile->Sync()) {
throw SummaryException("Failed syncing idx file", *idxFile, VESPA_STRLOC);
}
@@ -335,8 +335,8 @@ const std::vector<char> Padding(Alignment, '\0');
size_t
getAlignedStartPos(FastOS_File & file)
{
- ssize_t startPos(file.GetPosition());
- assert(startPos == file.GetSize());
+ ssize_t startPos(file.getPosition());
+ assert(startPos == file.getSize());
if (startPos & (Alignment-1)) {
FastOS_File align(file.GetFileName());
if (align.OpenWriteOnly()) {
@@ -345,8 +345,8 @@ getAlignedStartPos(FastOS_File & file)
ssize_t written = align.Write2(&Padding[0], toWrite);
if (written == toWrite) {
if ( align.Sync() ) {
- file.SetPosition(align.GetSize());
- startPos = file.GetPosition();
+ file.SetPosition(align.getSize());
+ startPos = file.getPosition();
} else {
throw SummaryException(
make_string("Failed syncing dat file."),
@@ -744,7 +744,7 @@ WriteableFileChunk::append(uint64_t serialNum, uint32_t lid, const void * buffer
void
WriteableFileChunk::readDataHeader()
{
- int64_t fSize(_dataFile.GetSize());
+ int64_t fSize(_dataFile.getSize());
try {
FileHeader h;
_dataHeaderLen = h.readFile(_dataFile);
@@ -763,8 +763,8 @@ WriteableFileChunk::readDataHeader()
// header length, or if header has been truncated.
_dataFile.SetPosition(0);
_dataFile.SetSize(0);
- assert(_dataFile.GetSize() == 0);
- assert(_dataFile.GetPosition() == 0);
+ assert(_dataFile.getSize() == 0);
+ assert(_dataFile.getPosition() == 0);
LOG(warning,
"Truncated file chunk data %s due to truncated file header",
_dataFile.GetFileName());
@@ -776,7 +776,7 @@ WriteableFileChunk::readDataHeader()
void
WriteableFileChunk::readIdxHeader(FastOS_FileInterface & idxFile)
{
- int64_t fSize(idxFile.GetSize());
+ int64_t fSize(idxFile.getSize());
try {
FileHeader h;
_idxHeaderLen = h.readFile(idxFile);
@@ -797,8 +797,8 @@ WriteableFileChunk::readIdxHeader(FastOS_FileInterface & idxFile)
// header length, or if header has been truncated.
idxFile.SetPosition(0);
idxFile.SetSize(0);
- assert(idxFile.GetSize() == 0);
- assert(idxFile.GetPosition() == 0);
+ assert(idxFile.getSize() == 0);
+ assert(idxFile.getPosition() == 0);
LOG(warning, "Truncated file chunk index %s due to truncated file header", idxFile.GetFileName());
}
}
@@ -812,7 +812,7 @@ WriteableFileChunk::writeDataHeader(const FileHeaderContext &fileHeaderContext)
FileHeader h(FileSettings::DIRECTIO_ALIGNMENT);
assert(_dataFile.IsOpened());
assert(_dataFile.IsWriteMode());
- assert(_dataFile.GetPosition() == 0);
+ assert(_dataFile.getPosition() == 0);
fileHeaderContext.addTags(h, _dataFile.GetFileName());
h.putTag(Tag("desc", "Log data store chunk data"));
_dataHeaderLen = h.writeFile(_dataFile);
@@ -826,7 +826,7 @@ WriteableFileChunk::writeIdxHeader(const FileHeaderContext &fileHeaderContext, u
FileHeader h;
assert(file.IsOpened());
assert(file.IsWriteMode());
- assert(file.GetPosition() == 0);
+ assert(file.getPosition() == 0);
fileHeaderContext.addTags(h, file.GetFileName());
h.putTag(Tag("desc", "Log data store chunk index"));
writeDocIdLimit(h, docIdLimit);
@@ -911,7 +911,7 @@ WriteableFileChunk::unconditionallyFlushPendingChunks(const unique_lock &flushGu
}
vespalib::system_time timeStamp(vespalib::system_clock::now());
auto idxFile = openIdx();
- idxFile->SetPosition(idxFile->GetSize());
+ idxFile->SetPosition(idxFile->getSize());
ssize_t wlen = idxFile->Write2(os.data(), os.size());
updateCurrentDiskFootprint();
@@ -921,7 +921,7 @@ WriteableFileChunk::unconditionallyFlushPendingChunks(const unique_lock &flushGu
if ( ! idxFile->Sync()) {
throw SummaryException("Failed fsync of idx file", *idxFile, VESPA_STRLOC);
}
- _idxFileSize.store(idxFile->GetSize(), std::memory_order_relaxed);
+ _idxFileSize.store(idxFile->getSize(), std::memory_order_relaxed);
if (_lastPersistedSerialNum.load(std::memory_order_relaxed) < lastSerial) {
_lastPersistedSerialNum.store(lastSerial, std::memory_order_relaxed);
}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
index aaf361b65ca..97ca6ad613e 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
@@ -55,7 +55,7 @@ handleSync(FastOS_FileInterface &file)
int osError = errno;
throw runtime_error(fmt("Failed to synchronize file '%s' of size %" PRId64 " due to '%s'. "
"Does not know how to handle this so throwing an exception.",
- file.GetFileName(), file.GetSize(), FastOS_File::getErrorString(osError).c_str()));
+ file.GetFileName(), file.getSize(), FastOS_File::getErrorString(osError).c_str()));
}
}
@@ -66,13 +66,13 @@ handleWriteError(const char *text, FastOS_FileInterface &file, int64_t lastKnown
string last(FastOS_File::getLastErrorString());
string e(fmt("%s. File '%s' at position %" PRId64 " for entries [%" PRIu64 ", %" PRIu64 "] of length %u. "
"OS says '%s'. Rewind to last known good position %" PRId64 ".",
- text, file.GetFileName(), file.GetPosition(), range.from(), range.to(), bufLen,
+ text, file.GetFileName(), file.getPosition(), range.from(), range.to(), bufLen,
last.c_str(), lastKnownGoodPos));
LOG(error, "%s", e.c_str());
if ( ! file.SetPosition(lastKnownGoodPos) ) {
last = FastOS_File::getLastErrorString();
throw runtime_error(fmt("Failed setting position %" PRId64 " of file '%s' of size %" PRId64 " : OS says '%s'",
- lastKnownGoodPos, file.GetFileName(), file.GetSize(), last.c_str()));
+ lastKnownGoodPos, file.GetFileName(), file.getSize(), last.c_str()));
}
handleSync(file);
return e;
@@ -82,13 +82,13 @@ string
getError(FastOS_FileInterface & f)
{
return fmt("File '%s' of size %" PRId64 " has last error of '%s'.",
- f.GetFileName(), f.GetSize(), FastOS_File::getLastErrorString().c_str());
+ f.GetFileName(), f.getSize(), FastOS_File::getLastErrorString().c_str());
}
bool
tailOfFileIsZero(FastOS_FileInterface &file, int64_t lastKnownGoodPos)
{
- ssize_t rest(file.GetSize() - lastKnownGoodPos);
+ ssize_t rest(file.getSize() - lastKnownGoodPos);
if (rest < 0 || rest > 0x100000) {
return false;
}
@@ -111,10 +111,10 @@ handleReadError(const char *text, FastOS_FileInterface &file, ssize_t len, ssize
string e;
if (len == rlen) {
e = fmt("Error in data read of size %zd bytes at pos %" PRId64 " trying to read %s. ",
- len, file.GetPosition() - rlen, text);
+ len, file.getPosition() - rlen, text);
} else {
e = fmt("Short Read. Got only %zd of %zd bytes at pos %" PRId64 " trying to read %s. ",
- rlen, len, file.GetPosition() - rlen, text);
+ rlen, len, file.getPosition() - rlen, text);
}
e += getError(file);
if (!allowTruncate) {
@@ -154,7 +154,7 @@ handleReadError(const char *text, FastOS_FileInterface &file, ssize_t len, ssize
string errString = FastOS_File::getLastErrorString();
throw runtime_error(fmt("IO error when reading %zd bytes at pos %" PRId64 "trying to read %s."
" Last known good position is %" PRId64 ": %s",
- len, file.GetPosition(), text, lastKnownGoodPos, getError(file).c_str()));
+ len, file.getPosition(), text, lastKnownGoodPos, getError(file).c_str()));
}
return retval;
}
@@ -165,8 +165,8 @@ Packet
DomainPart::readPacket(FastOS_FileInterface & transLog, SerialNumRange wanted, size_t targetSize, bool allowTruncate) {
Alloc buf;
Packet packet(targetSize);
- int64_t fSize(transLog.GetSize());
- int64_t currPos(transLog.GetPosition());
+ int64_t fSize(transLog.getSize());
+ int64_t currPos(transLog.getPosition());
while ((packet.sizeBytes() < targetSize) && (currPos < fSize) && (packet.range().to() < wanted.to())) {
IChunk::UP chunk;
if (read(transLog, chunk, buf, allowTruncate)) {
@@ -179,21 +179,21 @@ DomainPart::readPacket(FastOS_FileInterface & transLog, SerialNumRange wanted, s
}
} catch (const std::exception & ex) {
throw runtime_error(fmt("%s : Failed creating packet for list %s(%" PRIu64 ") at pos(%" PRIu64 ", %" PRIu64 ")",
- ex.what(), transLog.GetFileName(), fSize, currPos, transLog.GetPosition()));
+ ex.what(), transLog.GetFileName(), fSize, currPos, transLog.getPosition()));
}
} else {
throw runtime_error(fmt("Invalid entry reading file %s(%" PRIu64 ") at pos(%" PRIu64 ", %" PRIu64 ")",
- transLog.GetFileName(), fSize, currPos, transLog.GetPosition()));
+ transLog.GetFileName(), fSize, currPos, transLog.getPosition()));
}
} else {
- if (transLog.GetSize() != fSize) {
- fSize = transLog.GetSize();
+ if (transLog.getSize() != fSize) {
+ fSize = transLog.getSize();
} else {
throw runtime_error(fmt("Failed reading file %s(%" PRIu64 ") at pos(%" PRIu64 ", %" PRIu64 ")",
- transLog.GetFileName(), fSize, currPos, transLog.GetPosition()));
+ transLog.GetFileName(), fSize, currPos, transLog.getPosition()));
}
}
- currPos = transLog.GetPosition();
+ currPos = transLog.getPosition();
}
return packet;
}
@@ -206,7 +206,7 @@ DomainPart::buildPacketMapping(bool allowTruncate)
if ( ! transLog.OpenReadOnly(_transLog->GetFileName())) {
throw runtime_error(fmt("Failed opening '%s' for buffered readinf with direct io.", transLog.GetFileName()));
}
- int64_t fSize(transLog.GetSize());
+ int64_t fSize(transLog.getSize());
int64_t currPos(0);
try {
FileHeader header;
@@ -242,9 +242,9 @@ DomainPart::buildPacketMapping(bool allowTruncate)
// Called only from constructor so no need to hold lock
_skipList.emplace_back(firstSerial, firstPos);
} else {
- fSize = transLog.GetSize();
+ fSize = transLog.getSize();
}
- currPos = transLog.GetPosition();
+ currPos = transLog.getPosition();
}
return currPos;
}
@@ -292,15 +292,15 @@ DomainPart::DomainPart(const string & name, const string & baseDir, SerialNum s,
writeHeader(fileHeaderContext);
_byteSize = _headerLen;
}
- if ( ! _transLog->SetPosition(_transLog->GetSize()) ) {
+ if ( ! _transLog->SetPosition(_transLog->getSize()) ) {
throw runtime_error(fmt("Failed moving write pointer to the end of the file %s(%" PRIu64 ").",
- _transLog->GetFileName(), _transLog->GetSize()));
+ _transLog->GetFileName(), _transLog->getSize()));
}
handleSync(*_transLog);
_writtenSerial = get_range_to();
_syncedSerial = _writtenSerial;
- assert(int64_t(byteSize()) == _transLog->GetSize());
- assert(int64_t(byteSize()) == _transLog->GetPosition());
+ assert(int64_t(byteSize()) == _transLog->getSize());
+ assert(int64_t(byteSize()) == _transLog->getPosition());
}
DomainPart::~DomainPart()
@@ -315,7 +315,7 @@ DomainPart::writeHeader(const FileHeaderContext &fileHeaderContext)
FileHeader header;
assert(_transLog->IsOpened());
assert(_transLog->IsWriteMode());
- assert(_transLog->GetPosition() == 0);
+ assert(_transLog->getPosition() == 0);
fileHeaderContext.addTags(header, _transLog->GetFileName());
header.putTag(Tag("desc", "Transaction log domain part file"));
_headerLen = header.writeFile(*_transLog);
@@ -340,7 +340,7 @@ DomainPart::close()
}
if ( ! retval ) {
throw runtime_error(fmt("Failed closing file '%s' of size %" PRId64 ".",
- _transLog->GetFileName(), _transLog->GetSize()));
+ _transLog->GetFileName(), _transLog->getSize()));
}
return retval;
}
@@ -448,7 +448,7 @@ bool
DomainPart::read(FastOS_FileInterface &file, IChunk::UP & chunk, Alloc & buf, bool allowTruncate)
{
char tmp[5];
- int64_t lastKnownGoodPos(file.GetPosition());
+ int64_t lastKnownGoodPos(file.getPosition());
size_t rlen = file.Read(tmp, sizeof(tmp));
nbostream his(tmp, sizeof(tmp));
uint8_t encoding(-1);
@@ -484,7 +484,7 @@ DomainPart::read(FastOS_FileInterface &file, IChunk::UP & chunk, Alloc & buf, bo
chunk->decode(is);
} catch (const std::exception & e) {
throw runtime_error(fmt("Got exception during decoding of packet '%s' from file '%s' (pos=%" PRId64 ", len=%d)",
- e.what(), file.GetFileName(), file.GetPosition() - len - sizeof(len), static_cast<int>(len)));
+ e.what(), file.GetFileName(), file.getPosition() - len - sizeof(len), static_cast<int>(len)));
}
return true;
}
diff --git a/searchlib/src/vespa/searchlib/util/comprfile.cpp b/searchlib/src/vespa/searchlib/util/comprfile.cpp
index bde246a1239..f284e562b3d 100644
--- a/searchlib/src/vespa/searchlib/util/comprfile.cpp
+++ b/searchlib/src/vespa/searchlib/util/comprfile.cpp
@@ -222,7 +222,7 @@ ComprFileReadBase::SetPosition(uint64_t newPosition,
assert(pos <= static_cast<int64_t>(fileSize));
file->SetPosition(pos);
- assert(pos == file->GetPosition());
+ assert(pos == file->getPosition());
decodeContext.emptyBuffer(newPosition);
assert(decodeContext.getBitPos(bitOffset,
diff --git a/searchlib/src/vespa/searchlib/util/file_with_header.cpp b/searchlib/src/vespa/searchlib/util/file_with_header.cpp
index 569babab6fa..d3aa435b0eb 100644
--- a/searchlib/src/vespa/searchlib/util/file_with_header.cpp
+++ b/searchlib/src/vespa/searchlib/util/file_with_header.cpp
@@ -15,7 +15,7 @@ bool
extract_file_size(const vespalib::GenericHeader& header,
FastOS_FileInterface& file, uint64_t& file_size)
{
- file_size = file.GetSize();
+ file_size = file.getSize();
return FileSizeCalculator::extractFileSize(header, header.getSize(),file.GetFileName(), file_size);
}