summaryrefslogtreecommitdiffstats
path: root/memfilepersistence
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-05-02 14:41:55 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-05-02 14:41:55 +0200
commitda590ae7996814e8e4633d3c96caec276f9a2746 (patch)
tree4c3629b2b4113f9562249e55ad4f0d9352c1189d /memfilepersistence
parent0f646f10b377b90fc37e9911f9fe383d112ff157 (diff)
Fix warnings hidden earlier due to including application headers as system includes
Diffstat (limited to 'memfilepersistence')
-rw-r--r--memfilepersistence/src/tests/spi/logginglazyfile.h15
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/common/exceptions.cpp20
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/common/exceptions.h24
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.cpp8
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.h13
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp8
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.h2
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp4
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.h7
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp8
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/init/filescanner.h4
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp9
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h1
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.cpp11
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h1
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp5
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.h84
17 files changed, 94 insertions, 130 deletions
diff --git a/memfilepersistence/src/tests/spi/logginglazyfile.h b/memfilepersistence/src/tests/spi/logginglazyfile.h
index 6379a8d9597..5c163862e64 100644
--- a/memfilepersistence/src/tests/spi/logginglazyfile.h
+++ b/memfilepersistence/src/tests/spi/logginglazyfile.h
@@ -4,15 +4,13 @@
#include <vespa/vespalib/io/fileutil.h>
#include <sstream>
-namespace storage {
-
-namespace memfile {
+namespace storage::memfile {
class LoggingLazyFile : public vespalib::LazyFile {
public:
class Factory : public Environment::LazyFileFactory {
public:
- vespalib::LazyFile::UP createFile(const std::string& fileName) const {
+ vespalib::LazyFile::UP createFile(const std::string& fileName) const override {
return vespalib::LazyFile::UP(
new LoggingLazyFile(fileName, vespalib::File::DIRECTIO));
}
@@ -47,7 +45,7 @@ public:
return operations.size();
}
- virtual off_t write(const void *buf, size_t bufsize, off_t offset) {
+ off_t write(const void *buf, size_t bufsize, off_t offset) override {
Entry e;
e.opType = WRITE;
e.bufsize = bufsize;
@@ -58,7 +56,7 @@ public:
return vespalib::LazyFile::write(buf, bufsize, offset);
}
- virtual size_t read(void *buf, size_t bufsize, off_t offset) const {
+ size_t read(void *buf, size_t bufsize, off_t offset) const override {
Entry e;
e.opType = READ;
e.bufsize = bufsize;
@@ -78,11 +76,6 @@ public:
return ost.str();
}
-
-
};
}
-
-}
-
diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/exceptions.cpp b/memfilepersistence/src/vespa/memfilepersistence/common/exceptions.cpp
index 65715f8b2b6..a714d4fae89 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/common/exceptions.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/common/exceptions.cpp
@@ -2,8 +2,7 @@
#include "exceptions.h"
-namespace storage {
-namespace memfile {
+namespace storage::memfile {
VESPA_IMPLEMENT_EXCEPTION_SPINE(TimestampExistException);
VESPA_IMPLEMENT_EXCEPTION_SPINE(InconsistentSlotException);
@@ -19,12 +18,12 @@ VESPA_IMPLEMENT_MEMFILE_EXCEPTION(InconsistentException);
MemFileException::MemFileException(const FileSpecification& file)
: _file(file)
-{
-}
+{ }
-MemFileException::~MemFileException()
-{
-}
+MemFileException::~MemFileException() {}
+
+TimestampExistException::TimestampExistException(const TimestampExistException &) = default;
+TimestampExistException::~TimestampExistException() {}
TimestampExistException::TimestampExistException(
const vespalib::string& message, const FileSpecification& file,
@@ -43,6 +42,9 @@ InconsistentSlotException::InconsistentSlotException(
{
}
+InconsistentSlotException::InconsistentSlotException(const InconsistentSlotException &) = default;
+InconsistentSlotException::~InconsistentSlotException() {}
+
MemFileIoException::MemFileIoException(
const vespalib::string& msg, const FileSpecification& file,
Type type, const vespalib::string& location, int skipStack)
@@ -51,5 +53,7 @@ MemFileIoException::MemFileIoException(
{
}
+MemFileIoException::MemFileIoException(const MemFileIoException &) = default;
+MemFileIoException::~MemFileIoException() {}
+
} // memfile
-} // storage
diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/exceptions.h b/memfilepersistence/src/vespa/memfilepersistence/common/exceptions.h
index d4bbfe1b621..4fd7e116523 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/common/exceptions.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/common/exceptions.h
@@ -23,7 +23,11 @@
struct name : public vespalib::Exception, public MemFileException { \
name(const vespalib::string& message, const FileSpecification& file, \
const vespalib::string& location, int skipStack = 0); \
- ~name() throw(); \
+ name(const name &); \
+ name & operator = (const name &); \
+ name(name &&) = default; \
+ name & operator = (name &&) = default; \
+ ~name(); \
VESPA_DEFINE_EXCEPTION_SPINE(name); \
};
@@ -32,11 +36,12 @@
const vespalib::string& location, int skipStack) \
: vespalib::Exception(message, location, skipStack + 1), \
MemFileException(file) {} \
- name::~name() throw() {} \
+ name::name(const name &) = default; \
+ name & name::operator = (const name &) = default; \
+ name::~name() {} \
VESPA_IMPLEMENT_EXCEPTION_SPINE(name);
-namespace storage {
-namespace memfile {
+namespace storage::memfile {
VESPA_DEFINE_EXCEPTION(NoDisksException, vespalib::Exception);
@@ -84,7 +89,8 @@ public:
TimestampExistException(const vespalib::string& message,
const FileSpecification&, Timestamp ts,
const vespalib::string& location, int skipstack = 0);
- virtual ~TimestampExistException() throw() {}
+ TimestampExistException(const TimestampExistException &);
+ ~TimestampExistException();
VESPA_DEFINE_EXCEPTION_SPINE(TimestampExistException);
@@ -104,7 +110,8 @@ public:
InconsistentSlotException(const vespalib::string& message,
const FileSpecification&, const MemSlot& slot,
const vespalib::string& location, int skipstack = 0);
- virtual ~InconsistentSlotException() throw() {}
+ InconsistentSlotException(const InconsistentSlotException &);
+ ~InconsistentSlotException();
VESPA_DEFINE_EXCEPTION_SPINE(InconsistentSlotException);
};
@@ -116,11 +123,10 @@ public:
MemFileIoException(const vespalib::string& msg, const FileSpecification&,
Type type, const vespalib::string& location,
int skipStack = 0);
- virtual ~MemFileIoException() throw() {}
+ MemFileIoException(const MemFileIoException &);
+ ~MemFileIoException();
VESPA_DEFINE_EXCEPTION_SPINE(MemFileIoException);
};
} // memfile
-} // storage
-
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.cpp
index 37c93368c03..2ae27f06671 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.cpp
@@ -3,9 +3,7 @@
#include "devicemanager.h"
#include <vespa/vespalib/util/exceptions.h>
-namespace storage {
-
-namespace memfile {
+namespace storage::memfile {
DeviceManager::DeviceManager(DeviceMapper::UP mapper,
const framework::Clock& clock)
@@ -20,6 +18,8 @@ DeviceManager::DeviceManager(DeviceMapper::UP mapper,
{
}
+DeviceManager::~DeviceManager() {}
+
void
DeviceManager::setPartitionMonitorPolicy(
vespa::config::storage::StorDevicesConfig::StatfsPolicy policy, uint32_t period)
@@ -207,5 +207,3 @@ DeviceManager::printXml(vespalib::XmlOutputStream& xos) const
}
} // memfile
-
-} // storage
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.h b/memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.h
index 2b283984c0b..79022a46854 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/device/devicemanager.h
@@ -18,9 +18,7 @@
#include <vespa/storageframework/generic/clock/clock.h>
#include <set>
-namespace storage {
-
-namespace memfile {
+namespace storage::memfile {
class DeviceManager : public vespalib::XmlSerializable {
using StatfsPolicy = vespa::config::storage::StorDevicesConfig::StatfsPolicy;
@@ -33,15 +31,14 @@ class DeviceManager : public vespalib::XmlSerializable {
uint32_t _statPeriod;
const framework::Clock& _clock;
- DeviceManager(const DeviceManager&);
- DeviceManager& operator=(const DeviceManager&);
-
void setFindDeviceFunction();
-
public:
using UP = std::unique_ptr<DeviceManager>;
DeviceManager(DeviceMapper::UP mapper, const framework::Clock& clock);
+ DeviceManager(const DeviceManager&) = delete;
+ DeviceManager& operator=(const DeviceManager&) = delete;
+ ~DeviceManager();
void setPartitionMonitorPolicy(StatfsPolicy, uint32_t period = 0);
@@ -69,5 +66,3 @@ public:
};
} // memfile
-
-} // storage
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp
index e7ac0e473e6..b3751cddbed 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.cpp
@@ -1,19 +1,13 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "mountpointlist.h"
-#include "devicemanager.h"
#include <vespa/memfilepersistence/common/exceptions.h>
#include <vespa/persistence/spi/exceptions.h>
#include <vespa/vdslib/state/nodestate.h>
#include <vespa/config/helper/configfetcher.h>
#include <vespa/vespalib/io/fileutil.h>
-#include <vespa/vespalib/util/xmlserializable.h>
#include <vespa/vespalib/util/guard.h>
-#include <vespa/vespalib/text/stringtokenizer.h>
-#include <cerrno>
#include <fstream>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <vespa/log/log.h>
LOG_SETUP(".persistence.mountpointlist");
@@ -36,6 +30,8 @@ MountPointList::MountPointList(const std::string& vdsRoot,
{
}
+MountPointList::~MountPointList() {}
+
spi::PartitionStateList
MountPointList::getPartitionStates() const
{
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.h b/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.h
index d4ba15529f9..f80829e8aed 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/device/mountpointlist.h
@@ -22,7 +22,6 @@
#include <vespa/persistence/spi/persistenceprovider.h>
#include <vespa/vespalib/util/printable.h>
-
namespace storage {
namespace lib {
class NodeState;
@@ -37,6 +36,7 @@ struct MountPointList : public framework::XmlStatusReporter {
MountPointList(const std::string& vdsRoot,
const std::vector<vespalib::string>& diskPath,
std::unique_ptr<DeviceManager>);
+ ~MountPointList();
DeviceManager& getDeviceManager() { return *_deviceManager; }
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp
index b0fa6cf6667..b5b94d29336 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp
@@ -1,6 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/memfilepersistence/device/partitionmonitor.h>
+#include "partitionmonitor.h"
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/asciistream.h>
@@ -96,6 +96,8 @@ PartitionMonitor::PartitionMonitor(const std::string& file)
_fileOnPartition.c_str());
}
+PartitionMonitor::~PartitionMonitor() {}
+
void
PartitionMonitor::setPolicy(vespa::config::storage::StorDevicesConfig::StatfsPolicy policy,
uint32_t period)
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.h b/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.h
index 4b44b5b4c38..5da03029da8 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.h
@@ -18,9 +18,7 @@
#include <sys/statvfs.h>
-namespace storage {
-
-namespace memfile {
+namespace storage::memfile {
class PartitionMonitorTest;
@@ -68,6 +66,7 @@ private:
public:
/** Default policy is STAT_PERIOD(100). Default max fill rate 0.98. */
PartitionMonitor(const std::string& fileOnFileSystem);
+ ~PartitionMonitor();
/** Set monitor policy from config. */
void setPolicy(vespa::config::storage::StorDevicesConfig::StatfsPolicy, uint32_t period);
@@ -150,5 +149,3 @@ private:
};
} // memfile
-
-} // storage
diff --git a/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp b/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp
index 8084d529d79..3a83cee392a 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp
@@ -1,8 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/memfilepersistence/init/filescanner.h>
-
-#include <vespa/document/bucket/bucketid.h>
+#include "filescanner.h"
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/exceptions.h>
#include <iomanip>
@@ -35,6 +33,8 @@ FileScanner::Metrics::Metrics(framework::Clock& clock)
{
}
+FileScanner::Metrics::~Metrics() {}
+
FileScanner::FileScanner(framework::ComponentRegister& reg,
const MountPointList& mountPoints,
uint32_t directoryLevels,
@@ -50,6 +50,8 @@ FileScanner::FileScanner(framework::ComponentRegister& reg,
registerMetric(_globalMetrics);
}
+FileScanner::~FileScanner() {}
+
void
FileScanner::buildBucketList(document::BucketId::List & list,
uint16_t partition,
diff --git a/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.h b/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.h
index e83a01e932e..ff814eed19e 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.h
@@ -11,10 +11,10 @@
#pragma once
-#include <vespa/metrics/metrics.h>
#include <vespa/memfilepersistence/device/mountpointlist.h>
#include <vespa/memfilepersistence/mapper/bucketdirectorymapper.h>
#include <vespa/storageframework/storageframework.h>
+#include <vespa/metrics/metrics.h>
namespace document {
class BucketId;
@@ -44,6 +44,7 @@ public:
metrics::LongAverageMetric _listLatency;
Metrics(framework::Clock&);
+ ~Metrics();
};
private:
@@ -71,6 +72,7 @@ private:
public:
FileScanner(framework::ComponentRegister&, const MountPointList&,
uint32_t dirLevels, uint32_t dirSpread);
+ ~FileScanner();
void buildBucketList(document::BucketId::List & list,
uint16_t partition,
diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
index 6e071969218..305a71397b1 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
@@ -3,15 +3,12 @@
#include "simplememfileiobuffer.h"
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/memfilepersistence/common/environment.h>
-#include <vespa/vespalib/util/crc.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/log/log.h>
LOG_SETUP(".memfile.simpleiobuffer");
-namespace storage {
-
-namespace memfile {
+namespace storage::memfile {
namespace {
@@ -40,6 +37,8 @@ SimpleMemFileIOBuffer::SimpleMemFileIOBuffer(
{
}
+SimpleMemFileIOBuffer::~SimpleMemFileIOBuffer() {}
+
void
SimpleMemFileIOBuffer::close()
{
@@ -540,5 +539,3 @@ SimpleMemFileIOBuffer::getCachedSize(DocumentPart part) const
}
}
-
-}
diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h
index 74875d3ee79..18e99646ce9 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h
@@ -209,6 +209,7 @@ public:
FileInfo::UP fileInfo,
const FileSpecification& fileSpec,
const Environment& env);
+ ~SimpleMemFileIOBuffer();
Document::UP getDocumentHeader(const document::DocumentTypeRepo& repo, DataLocation loc) const override;
document::DocumentId getDocumentId(DataLocation loc) const override;
diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.cpp b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.cpp
index b03c9111430..6b3f72d9187 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.cpp
@@ -3,15 +3,14 @@
#include "memfile.h"
#include "memfilecompactor.h"
#include "shared_data_location_tracker.h"
-
-#include <ext/algorithm>
-#include <vespa/memfilepersistence/common/exceptions.h>
#include <vespa/memfilepersistence/mapper/memfilemapper.h>
#include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h>
-#include <vespa/vespalib/util/crc.h>
#include <vespa/memfilepersistence/common/environment.h>
-#include <iomanip>
+#include <vespa/memfilepersistence/common/exceptions.h>
#include <vespa/document/util/stringutil.h>
+#include <vespa/vespalib/util/crc.h>
+#include <ext/algorithm>
+#include <iomanip>
#include <vespa/log/log.h>
LOG_SETUP(".persistence.memfile.memfile");
@@ -81,6 +80,8 @@ MemFile::MemFile(const FileSpecification& file,
} RETHROW_NON_MEMFILE_EXCEPTIONS;
}
+MemFile::~MemFile() {}
+
MemFile::MemFile(const FileSpecification& file, Environment& env,
bool callLoadFile)
: _flags(BUCKET_INFO_OUTDATED),
diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h
index f22035faf04..cbc04ebb5c2 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h
@@ -107,6 +107,7 @@ public:
MemFile(const FileSpecification& spec,
Environment& env,
const LoadOptions& opts = LoadOptions());
+ ~MemFile();
const FileSpecification& getFile() const { return _file; }
const document::BucketId& getBucketId() const noexcept {
diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp b/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp
index d415604991b..a4f10688feb 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp
@@ -1,15 +1,14 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/document/fieldset/fieldsetrepo.h>
-#include <vespa/memfilepersistence/spi/memfilepersistenceprovider.h>
+#include "memfilepersistenceprovider.h"
#include <vespa/memfilepersistence/common/exceptions.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/fieldset/fieldsetrepo.h>
#include <vespa/config/helper/configgetter.hpp>
#include <vespa/log/log.h>
-
LOG_SETUP(".memfilepersistenceprovider");
#define TRACE(context, level, func, message) \
diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.h b/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.h
index a1b0b1bd0ae..724a77ec443 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.h
@@ -1,24 +1,23 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
+#include "operationhandler.h"
+#include "iteratorhandler.h"
+#include "joinoperationhandler.h"
+#include "splitoperationhandler.h"
+#include "memfilepersistenceprovidermetrics.h"
+#include "threadmetricprovider.h"
+#include "threadlocals.h"
+#include <vespa/memfilepersistence/common/types.h>
+#include <vespa/memfilepersistence/mapper/memfilemapper.h>
#include <vespa/memfilepersistence/init/filescanner.h>
#include <vespa/persistence/spi/abstractpersistenceprovider.h>
#include <vespa/storageframework/storageframework.h>
-#include <vespa/memfilepersistence/spi/operationhandler.h>
-#include <vespa/memfilepersistence/spi/iteratorhandler.h>
-#include <vespa/memfilepersistence/spi/joinoperationhandler.h>
-#include <vespa/memfilepersistence/spi/splitoperationhandler.h>
-#include <vespa/memfilepersistence/common/types.h>
-#include <vespa/memfilepersistence/mapper/memfilemapper.h>
-#include <vespa/memfilepersistence/spi/memfilepersistenceprovidermetrics.h>
-#include <vespa/memfilepersistence/spi/threadmetricprovider.h>
#include <vespa/storageframework/generic/status/httpurlpath.h>
-#include <vespa/memfilepersistence/spi/threadlocals.h>
-#include <vespa/config/config.h>
-namespace storage {
+#include <vespa/config/config.h>
-namespace memfile {
+namespace storage::memfile {
class ThreadContext {
public:
@@ -39,20 +38,13 @@ class MemFilePersistenceProvider : public spi::AbstractPersistenceProvider,
public:
typedef std::unique_ptr<MemFilePersistenceProvider> UP;
- MemFilePersistenceProvider(
- framework::ComponentRegister& reg,
- const config::ConfigUri & configUri);
-
+ MemFilePersistenceProvider(framework::ComponentRegister& reg, const config::ConfigUri & configUri);
~MemFilePersistenceProvider();
spi::PartitionStateListResult getPartitionStates() const override;
-
spi::BucketIdListResult listBuckets(spi::PartitionId) const override;
-
spi::BucketIdListResult getModifiedBuckets() const override;
-
spi::BucketInfoResult getBucketInfo(const spi::Bucket&) const override;
-
spi::Result put(const spi::Bucket&, spi::Timestamp,
const spi::DocumentSP&, spi::Context&) override;
@@ -70,43 +62,25 @@ public:
spi::Result flush(const spi::Bucket&, spi::Context&) override;
- spi::CreateIteratorResult createIterator(const spi::Bucket&,
- const document::FieldSet&,
- const spi::Selection&,
- spi::IncludedVersions versions,
- spi::Context&) override;
-
- spi::IterateResult iterate(spi::IteratorId,
- uint64_t maxByteSize, spi::Context&) const override;
+ spi::CreateIteratorResult createIterator(const spi::Bucket&, const document::FieldSet&, const spi::Selection&,
+ spi::IncludedVersions versions, spi::Context&) override;
+ spi::IterateResult iterate(spi::IteratorId, uint64_t maxByteSize, spi::Context&) const override;
spi::Result destroyIterator(spi::IteratorId, spi::Context&) override;
-
spi::Result deleteBucket(const spi::Bucket&, spi::Context&) override;
+ spi::Result split(const spi::Bucket& source, const spi::Bucket& target1,
+ const spi::Bucket& target2, spi::Context&) override;
- spi::Result split(const spi::Bucket& source,
- const spi::Bucket& target1,
- const spi::Bucket& target2,
- spi::Context&) override;
+ spi::Result join(const spi::Bucket& source1, const spi::Bucket& source2,
+ const spi::Bucket& target, spi::Context&) override;
- spi::Result join(const spi::Bucket& source1,
- const spi::Bucket& source2,
- const spi::Bucket& target,
- spi::Context&) override;
+ spi::Result removeEntry(const spi::Bucket&, spi::Timestamp, spi::Context&) override;
+ spi::Result maintain(const spi::Bucket&, spi::MaintenanceLevel level) override;
- spi::Result removeEntry(const spi::Bucket&,
- spi::Timestamp, spi::Context&) override;
+ Environment& getEnvironment() { return *_env; }
- spi::Result maintain(const spi::Bucket&,
- spi::MaintenanceLevel level) override;
-
- Environment& getEnvironment() {
- return *_env;
- }
-
- virtual vespalib::string getReportContentType(
- const framework::HttpUrlPath&) const;
- virtual bool reportStatus(std::ostream&,
- const framework::HttpUrlPath&) const;
+ vespalib::string getReportContentType(const framework::HttpUrlPath&) const override;
+ bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override;
/**
Used by unit tests.
@@ -114,7 +88,7 @@ public:
void clearActiveMemFile(spi::Context* = 0) const;
const IteratorHandler& getIteratorHandler() const { return *_iteratorHandler; }
- MemFilePersistenceThreadMetrics& getMetrics() const;
+ MemFilePersistenceThreadMetrics& getMetrics() const override;
void setDocumentRepo(const document::DocumentTypeRepo& repo);
void setConfig(std::unique_ptr<vespa::config::storage::StorMemfilepersistenceConfig> config);
@@ -139,15 +113,13 @@ private:
mutable ThreadLocals<ThreadContext> _threadLocals;
- std::pair<spi::Result::ErrorType, vespalib::string>
- getErrorFromException(const std::exception& e);
+ std::pair<spi::Result::ErrorType, vespalib::string> getErrorFromException(const std::exception& e);
MemFilePtr getMemFile(const spi::Bucket& b, bool keepInCache = true) const;
void setActiveMemFile(MemFilePtr ptr, const char* user) const;
bool hasCachedMemFile() const;
- template<typename C> C handleException(const std::exception& e,
- bool canRepairBucket) const;
+ template<typename C> C handleException(const std::exception& e, bool canRepairBucket) const;
void handleBucketCorruption(const FileSpecification& file) const;
@@ -160,5 +132,3 @@ private:
}
-}
-