summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--storage/src/vespa/storage/tools/.gitignore17
-rw-r--r--storage/src/vespa/storage/tools/CMakeLists.txt15
-rw-r--r--storage/src/vespa/storage/tools/lib/.gitignore0
-rw-r--r--storage/src/vespa/storage/tools/statfs.cpp67
-rw-r--r--vespalib/src/tests/io/fileutil/fileutiltest.cpp55
-rw-r--r--vespalib/src/vespa/vespalib/io/fileutil.h59
6 files changed, 0 insertions, 213 deletions
diff --git a/storage/src/vespa/storage/tools/.gitignore b/storage/src/vespa/storage/tools/.gitignore
index 9f66a0b7157..26990358442 100644
--- a/storage/src/vespa/storage/tools/.gitignore
+++ b/storage/src/vespa/storage/tools/.gitignore
@@ -3,27 +3,10 @@
.*.swp
.depend
Makefile
-analyzedistribution
distbitreport.html
-distributionsim
-dumpslotfile
generatedistributionbits
-generatemailbuckets
getidealstate
idealstate
-pingstorage
-populatenode
-slotfilefeeder
-statfs
-stoccart
vespa-storage-cmd
-throttlingsim
-vdsclient
-vdsdisktool
-vdsidealstate
-vesparemovelocation
-storage_analyzedistribution_app
storage_generatedistributionbits_app
storage_getidealstate_app
-storage_statfs_app
-storage_throttlingsim_app
diff --git a/storage/src/vespa/storage/tools/CMakeLists.txt b/storage/src/vespa/storage/tools/CMakeLists.txt
index 3a00573cdd8..4bdcc7272db 100644
--- a/storage/src/vespa/storage/tools/CMakeLists.txt
+++ b/storage/src/vespa/storage/tools/CMakeLists.txt
@@ -15,14 +15,6 @@ vespa_add_executable(storage_generatedistributionbits_app
AFTER
storage_storageconfig
)
-vespa_add_executable(storage_analyzedistribution_app
- SOURCES
- analyzedistribution.cpp
- DEPENDS
- storage
- AFTER
- storage_storageconfig
-)
vespa_add_executable(storage_storage-cmd_app
SOURCES
storage-cmd.cpp
@@ -31,10 +23,3 @@ vespa_add_executable(storage_storage-cmd_app
AFTER
storage_storageconfig
)
-vespa_add_executable(storage_statfs_app
- SOURCES
- statfs.cpp
- DEPENDS
- AFTER
- storage_storageconfig
-)
diff --git a/storage/src/vespa/storage/tools/lib/.gitignore b/storage/src/vespa/storage/tools/lib/.gitignore
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/src/vespa/storage/tools/lib/.gitignore
+++ /dev/null
diff --git a/storage/src/vespa/storage/tools/statfs.cpp b/storage/src/vespa/storage/tools/statfs.cpp
deleted file mode 100644
index cc90b77e91d..00000000000
--- a/storage/src/vespa/storage/tools/statfs.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <iostream>
-#include <sys/vfs.h>
-#include <vespa/vespalib/util/programoptions.h>
-#include <vespa/vespalib/io/fileutil.h>
-
-struct Options : public vespalib::ProgramOptions {
- bool showSyntaxPage;
- std::string _filename;
-
- Options(int argc, const char* const* argv);
- ~Options();
-};
-
-Options::Options(int argc, const char* const* argv)
- : vespalib::ProgramOptions(argc, argv),
- showSyntaxPage(false)
-{
- setSyntaxMessage(
- "Utility program for checking output of statfs."
- );
- addOption("h help", showSyntaxPage, false,
- "Shows this help page");
- addArgument("file", _filename, "File to use when calling statfs()");
-}
-Options::~Options() {}
-
-
-int main(int argc, char** argv) {
- Options o(argc, argv);
- o.parse();
-
- if (o.showSyntaxPage) {
- o.writeSyntaxPage(std::cerr);
- exit(1);
- }
-
- if (!vespalib::fileExists(o._filename)) {
- std::cerr << "Cannot use statfs on non-existing file '" << o._filename
- << "'.\n";
- exit(1);
- }
-
- struct statfs buf;
- if (statfs(o._filename.c_str(), &buf) == 0) {
- std::cerr << "f_type " << buf.f_type << "\n"
- << "f_bsize " << buf.f_bsize << "\n"
- << "f_blocks " << buf.f_blocks << "\n"
- << "f_bfree " << buf.f_bfree << "\n"
- << "f_bavail " << buf.f_bavail << "\n"
- << "f_files " << buf.f_files << "\n"
- << "f_ffree " << buf.f_ffree << "\n"
- << "f_namelen " << buf.f_namelen << "\n";
-
- uint64_t available = buf.f_bavail;
- uint64_t total = buf.f_blocks;
- available *= buf.f_bsize;
- total *= buf.f_bsize;
-
- std::cerr << "\nAvailable " << available << " of total " << total
- << "\n" << (100.0 * (total - available) / (double) total)
- << " % full\n";
- } else {
- std::cerr << "statfs() failed: " << errno << "\n";
- }
-}
diff --git a/vespalib/src/tests/io/fileutil/fileutiltest.cpp b/vespalib/src/tests/io/fileutil/fileutiltest.cpp
index 8345a8dcb99..b0a08f4e7fd 100644
--- a/vespalib/src/tests/io/fileutil/fileutiltest.cpp
+++ b/vespalib/src/tests/io/fileutil/fileutiltest.cpp
@@ -481,61 +481,6 @@ TEST("require that copy constructor and assignment for vespalib::File works")
}
}
-TEST("require that vespalib::LazyFile works")
-{
- // Copy constructor
- {
- LazyFile file("myfile", File::CREATE, true);
- LazyFile file2(file);
- EXPECT_EQUAL(file.getFlags(), file2.getFlags());
- EXPECT_EQUAL(file.autoCreateDirectories(), file2.autoCreateDirectories());
- }
- // Assignment
- {
- LazyFile file("myfile", File::CREATE, true);
- LazyFile file2("targetfile", File::READONLY);
- file = file2;
- EXPECT_EQUAL(file.getFlags(), file2.getFlags());
- EXPECT_EQUAL(file.autoCreateDirectories(), file2.autoCreateDirectories());
- }
- // Lazily write
- {
- LazyFile file("myfile", File::CREATE, true);
- file.write("foo", 3, 0);
- }
- // Lazy stat
- {
- LazyFile file("myfile", File::CREATE, true);
- EXPECT_EQUAL(3, file.getFileSize());
- file.close();
-
- LazyFile file2("myfile", File::CREATE, true);
- FileInfo info = file2.stat();
- EXPECT_EQUAL(3, info._size);
- EXPECT_EQUAL(true, info._plainfile);
- }
-
- // Lazy read
- {
- LazyFile file("myfile", File::CREATE, true);
- std::vector<char> buf(10, ' ');
- EXPECT_EQUAL(3u, file.read(&buf[0], 10, 0));
- EXPECT_EQUAL(std::string("foo"), std::string(&buf[0], 3));
- }
- // Lazy resize
- {
- LazyFile file("myfile", File::CREATE, true);
- file.resize(5);
- EXPECT_EQUAL(5, file.getFileSize());
- }
- // Lazy get file descriptor
- {
- LazyFile file("myfile", File::CREATE, true);
- int fd = file.getFileDescriptor();
- ASSERT_TRUE(fd != -1);
- }
-}
-
TEST("require that vespalib::symlink works")
{
// Target exists
diff --git a/vespalib/src/vespa/vespalib/io/fileutil.h b/vespalib/src/vespa/vespalib/io/fileutil.h
index 1507513dbbc..59994819600 100644
--- a/vespalib/src/vespa/vespalib/io/fileutil.h
+++ b/vespalib/src/vespa/vespalib/io/fileutil.h
@@ -209,65 +209,6 @@ public:
};
/**
- * @brief A File instance that automatically opens once needed.
- */
-class LazyFile : public File {
- int _flags;
- bool _autoCreateDirectories;
-
-public:
- typedef std::unique_ptr<LazyFile> UP;
-
- LazyFile(vespalib::stringref filename, int flags,
- bool autoCreateDirs = false)
- : File(filename),
- _flags(flags),
- _autoCreateDirectories(autoCreateDirs) {}
-
- LazyFile(LazyFile& other)
- : File(other),
- _flags(other._flags),
- _autoCreateDirectories(other._autoCreateDirectories) {}
-
- LazyFile& operator=(LazyFile& other) {
- File::operator=(other);
- _flags = other._flags;
- _autoCreateDirectories = other._autoCreateDirectories;
- return *this;
- }
-
- int getFlags() const { return _flags; }
- void setFlags(int flags) { _flags = flags; }
- void setAutoCreateDirectories(bool autoCreate)
- { _autoCreateDirectories = autoCreate; }
- bool autoCreateDirectories() const { return _autoCreateDirectories; }
-
- int getFileDescriptor() const override {
- if (!isOpen()) {
- const_cast<LazyFile&>(*this).open(_flags, _autoCreateDirectories);
- }
- return File::getFileDescriptor();
- }
-
- void resize(off_t size) override {
- if (!isOpen()) { open(_flags, _autoCreateDirectories); }
- File::resize(size);
- }
-
- off_t write(const void *buf, size_t bufsize, off_t offset) override {
- if (!isOpen()) { open(_flags, _autoCreateDirectories); }
- return File::write(buf, bufsize, offset);
- }
-
- size_t read(void *buf, size_t bufsize, off_t offset) const override {
- if (!isOpen()) {
- const_cast<LazyFile&>(*this).open(_flags, _autoCreateDirectories);
- }
- return File::read(buf, bufsize, offset);
- }
-};
-
-/**
* Get the current working directory.
*
* @throw IoException On failure.