summaryrefslogtreecommitdiffstats
path: root/memfilepersistence
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-12-18 12:29:52 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-19 14:15:50 +0000
commit2cb7c0cd99d628fac2f8d1076e2a5b2496f307eb (patch)
tree34e0e2b28c4331300ccb7ffa606244e620c2d1a0 /memfilepersistence
parent3ff9a1747c83263dc34f5f0a15c90131914f9029 (diff)
Do not carry exceptions in header files
Diffstat (limited to 'memfilepersistence')
-rw-r--r--memfilepersistence/src/tests/spi/CMakeLists.txt1
-rw-r--r--memfilepersistence/src/tests/spi/memfiletest.cpp2
-rw-r--r--memfilepersistence/src/tests/spi/memfiletestutils.cpp3
-rw-r--r--memfilepersistence/src/tests/spi/simulatedfailurefile.cpp55
-rw-r--r--memfilepersistence/src/tests/spi/simulatedfailurefile.h41
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp1
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h4
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp6
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp1
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp5
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h1
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp6
12 files changed, 76 insertions, 50 deletions
diff --git a/memfilepersistence/src/tests/spi/CMakeLists.txt b/memfilepersistence/src/tests/spi/CMakeLists.txt
index 38dadb9fd26..475e3deda9a 100644
--- a/memfilepersistence/src/tests/spi/CMakeLists.txt
+++ b/memfilepersistence/src/tests/spi/CMakeLists.txt
@@ -16,6 +16,7 @@ vespa_add_library(memfilepersistence_testspi
shared_data_location_tracker_test.cpp
buffered_file_writer_test.cpp
buffer_test.cpp
+ simulatedfailurefile.cpp
DEPENDS
memfilepersistence_testhelper
memfilepersistence
diff --git a/memfilepersistence/src/tests/spi/memfiletest.cpp b/memfilepersistence/src/tests/spi/memfiletest.cpp
index 70b03271da9..77f10f305ba 100644
--- a/memfilepersistence/src/tests/spi/memfiletest.cpp
+++ b/memfilepersistence/src/tests/spi/memfiletest.cpp
@@ -1,5 +1,4 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include <vespa/memfilepersistence/memfile/memfile.h>
#include <tests/spi/memfiletestutils.h>
#include <tests/spi/logginglazyfile.h>
@@ -7,6 +6,7 @@
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/memfilepersistence/memfile/memfilecompactor.h>
#include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h>
+#include <vespa/vespalib/util/exceptions.h>
#include <limits>
namespace storage {
diff --git a/memfilepersistence/src/tests/spi/memfiletestutils.cpp b/memfilepersistence/src/tests/spi/memfiletestutils.cpp
index dd9a231536a..572a0926c27 100644
--- a/memfilepersistence/src/tests/spi/memfiletestutils.cpp
+++ b/memfilepersistence/src/tests/spi/memfiletestutils.cpp
@@ -7,8 +7,9 @@
#include <vespa/memfilepersistence/memfile/memfilecache.h>
#include <vespa/storageframework/defaultimplementation/memory/simplememorylogic.h>
#include <vespa/document/update/assignvalueupdate.h>
-#include <sys/time.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/vespalib/util/exceptions.h>
+#include <sys/time.h>
using document::DocumentType;
diff --git a/memfilepersistence/src/tests/spi/simulatedfailurefile.cpp b/memfilepersistence/src/tests/spi/simulatedfailurefile.cpp
new file mode 100644
index 00000000000..e96475edb61
--- /dev/null
+++ b/memfilepersistence/src/tests/spi/simulatedfailurefile.cpp
@@ -0,0 +1,55 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "simulatedfailurefile.h"
+#include <vespa/vespalib/util/exceptions.h>
+
+namespace storage {
+namespace memfile {
+
+vespalib::LazyFile::UP
+SimulatedFailureLazyFile::Factory::createFile(const std::string& fileName) const {
+ return vespalib::LazyFile::UP(
+ new SimulatedFailureLazyFile(fileName,
+ vespalib::File::DIRECTIO,
+ _readOpsBeforeFailure,
+ _writeOpsBeforeFailure));
+}
+
+SimulatedFailureLazyFile::SimulatedFailureLazyFile(
+ const std::string& filename,
+ int flags,
+ int readOpsBeforeFailure,
+ int writeOpsBeforeFailure)
+ : LazyFile(filename, flags),
+ _readOpsBeforeFailure(readOpsBeforeFailure),
+ _writeOpsBeforeFailure(writeOpsBeforeFailure)
+{
+}
+
+off_t
+SimulatedFailureLazyFile::write(const void *buf, size_t bufsize, off_t offset)
+{
+ if (_writeOpsBeforeFailure == 0) {
+ throw vespalib::IoException(
+ "A simulated I/O write exception was triggered",
+ vespalib::IoException::CORRUPT_DATA, VESPA_STRLOC);
+ }
+ --_writeOpsBeforeFailure;
+ return vespalib::LazyFile::write(buf, bufsize, offset);
+}
+
+size_t
+SimulatedFailureLazyFile::read(void *buf, size_t bufsize, off_t offset) const
+{
+ if (_readOpsBeforeFailure == 0) {
+ throw vespalib::IoException(
+ "A simulated I/O read exception was triggered",
+ vespalib::IoException::CORRUPT_DATA, VESPA_STRLOC);
+ }
+ --_readOpsBeforeFailure;
+ return vespalib::LazyFile::read(buf, bufsize, offset);
+}
+
+} // ns memfile
+} // ns storage
+
diff --git a/memfilepersistence/src/tests/spi/simulatedfailurefile.h b/memfilepersistence/src/tests/spi/simulatedfailurefile.h
index 1ded927a3d1..825c9f53585 100644
--- a/memfilepersistence/src/tests/spi/simulatedfailurefile.h
+++ b/memfilepersistence/src/tests/spi/simulatedfailurefile.h
@@ -17,15 +17,8 @@ public:
Factory()
: _readOpsBeforeFailure(-1),
_writeOpsBeforeFailure(0)
- {
- }
- vespalib::LazyFile::UP createFile(const std::string& fileName) const {
- return vespalib::LazyFile::UP(
- new SimulatedFailureLazyFile(fileName,
- vespalib::File::DIRECTIO,
- _readOpsBeforeFailure,
- _writeOpsBeforeFailure));
- }
+ { }
+ vespalib::LazyFile::UP createFile(const std::string& fileName) const;
void setReadOpsBeforeFailure(int ops) {
_readOpsBeforeFailure = ops;
@@ -43,34 +36,10 @@ public:
const std::string& filename,
int flags,
int readOpsBeforeFailure,
- int writeOpsBeforeFailure)
- : LazyFile(filename, flags),
- _readOpsBeforeFailure(readOpsBeforeFailure),
- _writeOpsBeforeFailure(writeOpsBeforeFailure)
- {
- }
+ int writeOpsBeforeFailure);
- off_t write(const void *buf, size_t bufsize, off_t offset)
- {
- if (_writeOpsBeforeFailure == 0) {
- throw vespalib::IoException(
- "A simulated I/O write exception was triggered",
- vespalib::IoException::CORRUPT_DATA, VESPA_STRLOC);
- }
- --_writeOpsBeforeFailure;
- return vespalib::LazyFile::write(buf, bufsize, offset);
- }
-
- size_t read(void *buf, size_t bufsize, off_t offset) const
- {
- if (_readOpsBeforeFailure == 0) {
- throw vespalib::IoException(
- "A simulated I/O read exception was triggered",
- vespalib::IoException::CORRUPT_DATA, VESPA_STRLOC);
- }
- --_readOpsBeforeFailure;
- return vespalib::LazyFile::read(buf, bufsize, offset);
- }
+ off_t write(const void *buf, size_t bufsize, off_t offset);
+ size_t read(void *buf, size_t bufsize, off_t offset) const;
};
} // ns memfile
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp
index c314cdde1aa..d6b8a819823 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/memfilepersistence/device/ioevent.h>
#include <vespa/memfilepersistence/device/device.h>
+#include <vespa/vespalib/util/exceptions.h>
#include <cerrno>
#include <ostream>
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h b/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h
index d30026c9f8c..e801d886bca 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h
@@ -7,9 +7,9 @@
*/
#pragma once
-#include <vespa/memfilepersistence/device/device.h>
-#include <vespa/vespalib/util/exceptions.h>
+#include "device.h"
+namespace vespalib { class IoException; }
namespace storage {
namespace memfile {
diff --git a/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp b/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp
index 74708bb36d8..e921101aa17 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp
@@ -1,13 +1,13 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include <vespa/memfilepersistence/init/filescanner.h>
#include <vespa/document/bucket/bucketid.h>
-#include <iomanip>
-#include <vespa/log/log.h>
#include <vespa/vespalib/io/fileutil.h>
+#include <vespa/vespalib/util/exceptions.h>
+#include <iomanip>
+#include <vespa/log/log.h>
LOG_SETUP(".persistence.memfile.filescanner");
namespace storage {
diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
index cd9cb5f3ee9..cd4b150f41c 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
@@ -4,6 +4,7 @@
#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");
diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp
index 86cf7f50ba2..da085ca9137 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp
@@ -1,11 +1,10 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
-#include <vespa/memfilepersistence/spi/operationhandler.h>
+#include "operationhandler.h"
+#include <vespa/memfilepersistence/common/exceptions.h>
#include <vespa/document/select/parser.h>
#include <vespa/log/log.h>
-
LOG_SETUP(".persistence.memfile.handler.operation");
namespace storage {
diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h
index 708ab34922a..a55b2413321 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h
@@ -10,7 +10,6 @@
*/
#pragma once
-#include <vespa/memfilepersistence/common/exceptions.h>
#include <vespa/memfilepersistence/common/filespecification.h>
#include <vespa/memfilepersistence/common/types.h>
#include <vespa/memfilepersistence/memfile/memfile.h>
diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp
index 2a3f1d58134..0011dddd421 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp
@@ -1,17 +1,17 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include <vespa/document/util/stringutil.h>
#include <vespa/fnet/frt/frt.h>
-#include <iostream>
-#include <vespa/log/log.h>
#include <vespa/memfilepersistence/device/mountpointlist.h>
#include <vespa/memfilepersistence/tools/vdsdisktool.h>
#include <vespa/storageframework/defaultimplementation/clock/realclock.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/programoptions.h>
+#include <vespa/vespalib/util/exceptions.h>
+#include <sstream>
+#include <vespa/log/log.h>
LOG_SETUP(".vdsdiskapp");
using std::vector;