Commit fe9d723e authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Yagni: Don't offer runtime checks on thread safety. It isn't a simple yes or no anyway.

parent 4b24fb36
...@@ -206,11 +206,6 @@ public: ...@@ -206,11 +206,6 @@ public:
*/ */
virtual std::int64_t xx_eof() const = 0; virtual std::int64_t xx_eof() const = 0;
/**
* Return true if multiple reads can be in progress at the same time.
*/
virtual bool xx_threadsafe() const = 0;
/** /**
* Return true if the file is on the cloud. * Return true if the file is on the cloud.
* This might trigger some optimizations. * This might trigger some optimizations.
......
...@@ -87,7 +87,6 @@ public: ...@@ -87,7 +87,6 @@ public:
virtual void xx_read(void *data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override; virtual void xx_read(void *data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override;
virtual void xx_readv(const ReadList& requests, bool parallel_ok=false, bool immutable_ok=false, bool transient_ok=false, UsageHint usagehint=UsageHint::Unknown) override; virtual void xx_readv(const ReadList& requests, bool parallel_ok=false, bool immutable_ok=false, bool transient_ok=false, UsageHint usagehint=UsageHint::Unknown) override;
virtual void xx_write(const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override; virtual void xx_write(const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override;
virtual bool xx_threadsafe() const override;
virtual std::int64_t _real_eof() const; virtual std::int64_t _real_eof() const;
private: private:
int _fd; int _fd;
...@@ -263,15 +262,6 @@ LocalFileLinux::xx_write(const void* data, std::int64_t offset, std::int64_t siz ...@@ -263,15 +262,6 @@ LocalFileLinux::xx_write(const void* data, std::int64_t offset, std::int64_t siz
throw OpenZGY::Errors::ZgyInternalError(_name + ": Short write"); throw OpenZGY::Errors::ZgyInternalError(_name + ": Short write");
} }
/**
* \details: Thread safety: Yes.
*/
bool
LocalFileLinux::xx_threadsafe() const
{
return true;
}
/** /**
* \details: Thread safety: Not for writes. Uses xx_eof(). * \details: Thread safety: Not for writes. Uses xx_eof().
* And should in any case be changed to call ::stat(). * And should in any case be changed to call ::stat().
......
...@@ -151,7 +151,6 @@ public: ...@@ -151,7 +151,6 @@ public:
virtual void xx_write(const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override; virtual void xx_write(const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override;
virtual void xx_close(); virtual void xx_close();
virtual std::int64_t xx_eof() const; virtual std::int64_t xx_eof() const;
virtual bool xx_threadsafe() const override;
virtual bool xx_iscloud() const override; virtual bool xx_iscloud() const override;
// Functions from FileUtilsSeismicStore // Functions from FileUtilsSeismicStore
virtual void deleteFile(const std::string& filename, bool missing_ok) const; virtual void deleteFile(const std::string& filename, bool missing_ok) const;
...@@ -279,7 +278,6 @@ public: ...@@ -279,7 +278,6 @@ public:
virtual void xx_write(const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override; virtual void xx_write(const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override;
virtual void xx_close() override; virtual void xx_close() override;
virtual std::int64_t xx_eof() const override; virtual std::int64_t xx_eof() const override;
virtual bool xx_threadsafe() const override;
virtual bool xx_iscloud() const override; virtual bool xx_iscloud() const override;
private: private:
...@@ -1144,15 +1142,6 @@ SeismicStoreFile::xx_eof() const ...@@ -1144,15 +1142,6 @@ SeismicStoreFile::xx_eof() const
return _dataset->info().totalSize(); return _dataset->info().totalSize();
} }
/**
* \details: Thread safety: Yes.
*/
bool
SeismicStoreFile::xx_threadsafe() const
{
return this->_mode == OpenMode::ReadOnly;
}
/** /**
* \details: Thread safety: Yes. * \details: Thread safety: Yes.
*/ */
...@@ -1553,15 +1542,6 @@ SeismicStoreFileDelayedWrite::xx_eof() const ...@@ -1553,15 +1542,6 @@ SeismicStoreFileDelayedWrite::xx_eof() const
static_cast<std::int64_t>(this->_open_segment.size())); static_cast<std::int64_t>(this->_open_segment.size()));
} }
/**
* \details: Thread safety: Yes.
*/
bool
SeismicStoreFileDelayedWrite::xx_threadsafe() const
{
return this->_relay->xx_threadsafe();
}
/** /**
* \details: Thread safety: Yes. * \details: Thread safety: Yes.
*/ */
......
...@@ -91,7 +91,6 @@ public: ...@@ -91,7 +91,6 @@ public:
virtual void xx_read(void *data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override; virtual void xx_read(void *data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override;
virtual void xx_readv(const ReadList& requests, bool parallel_ok=false, bool immutable_ok=false, bool transient_ok=false, UsageHint usagehint=UsageHint::Unknown) override; virtual void xx_readv(const ReadList& requests, bool parallel_ok=false, bool immutable_ok=false, bool transient_ok=false, UsageHint usagehint=UsageHint::Unknown) override;
virtual void xx_write(const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override; virtual void xx_write(const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override;
virtual bool xx_threadsafe() const override;
virtual std::int64_t _real_eof() const; virtual std::int64_t _real_eof() const;
private: private:
int _fd; int _fd;
...@@ -280,15 +279,6 @@ LocalFileWindows::xx_write(const void* data, std::int64_t offset, std::int64_t s ...@@ -280,15 +279,6 @@ LocalFileWindows::xx_write(const void* data, std::int64_t offset, std::int64_t s
throw OpenZGY::Errors::ZgyInternalError(_name + ": Short write"); throw OpenZGY::Errors::ZgyInternalError(_name + ": Short write");
} }
/**
* \details: Thread safety: Yes.
*/
bool
LocalFileWindows::xx_threadsafe() const
{
return false;
}
/** /**
* \details: Thread safety: Not for writes. Uses xx_eof(). * \details: Thread safety: Not for writes. Uses xx_eof().
* And should in any case be changed to call ::stat(). * And should in any case be changed to call ::stat().
......
...@@ -85,13 +85,11 @@ run_helloworld(const std::string& fn, const std::function<std::shared_ptr<FileAD ...@@ -85,13 +85,11 @@ run_helloworld(const std::string& fn, const std::function<std::shared_ptr<FileAD
{ {
std::shared_ptr<FileADT> file; std::shared_ptr<FileADT> file;
file = alloc(fn, OpenMode::Truncate); file = alloc(fn, OpenMode::Truncate);
//TEST_CHECK(!file->xx_threadsafe()); // not true for all backends.
file->xx_write("Hello, world, what else can I say?\n", 0, 35); file->xx_write("Hello, world, what else can I say?\n", 0, 35);
file->xx_close(); file->xx_close();
file.reset(); file.reset();
file = alloc(fn, OpenMode::ReadOnly); file = alloc(fn, OpenMode::ReadOnly);
//TEST_CHECK(!file->xx_threadsafe());
char data[100]{0}; char data[100]{0};
file->xx_read(data, 7, 5); file->xx_read(data, 7, 5);
TEST_CHECK(std::string(data) == std::string("world")); TEST_CHECK(std::string(data) == std::string("world"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment