Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Domain Data Mgmt Services
Seismic
Open ZGY
Commits
fe9d723e
Commit
fe9d723e
authored
Dec 04, 2020
by
Paal Kvamme
Browse files
Yagni: Don't offer runtime checks on thread safety. It isn't a simple yes or no anyway.
parent
4b24fb36
Changes
5
Hide whitespace changes
Inline
Side-by-side
native/src/impl/file.h
View file @
fe9d723e
...
...
@@ -206,11 +206,6 @@ public:
*/
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.
* This might trigger some optimizations.
...
...
native/src/impl/file_local.cpp
View file @
fe9d723e
...
...
@@ -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_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
bool
xx_threadsafe
()
const
override
;
virtual
std
::
int64_t
_real_eof
()
const
;
private:
int
_fd
;
...
...
@@ -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"
);
}
/**
* \details: Thread safety: Yes.
*/
bool
LocalFileLinux
::
xx_threadsafe
()
const
{
return
true
;
}
/**
* \details: Thread safety: Not for writes. Uses xx_eof().
* And should in any case be changed to call ::stat().
...
...
native/src/impl/file_sd.cpp
View file @
fe9d723e
...
...
@@ -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_close
();
virtual
std
::
int64_t
xx_eof
()
const
;
virtual
bool
xx_threadsafe
()
const
override
;
virtual
bool
xx_iscloud
()
const
override
;
// Functions from FileUtilsSeismicStore
virtual
void
deleteFile
(
const
std
::
string
&
filename
,
bool
missing_ok
)
const
;
...
...
@@ -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_close
()
override
;
virtual
std
::
int64_t
xx_eof
()
const
override
;
virtual
bool
xx_threadsafe
()
const
override
;
virtual
bool
xx_iscloud
()
const
override
;
private:
...
...
@@ -1144,15 +1142,6 @@ SeismicStoreFile::xx_eof() const
return
_dataset
->
info
().
totalSize
();
}
/**
* \details: Thread safety: Yes.
*/
bool
SeismicStoreFile
::
xx_threadsafe
()
const
{
return
this
->
_mode
==
OpenMode
::
ReadOnly
;
}
/**
* \details: Thread safety: Yes.
*/
...
...
@@ -1553,15 +1542,6 @@ SeismicStoreFileDelayedWrite::xx_eof() const
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.
*/
...
...
native/src/impl/file_windows.cpp
View file @
fe9d723e
...
...
@@ -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_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
bool
xx_threadsafe
()
const
override
;
virtual
std
::
int64_t
_real_eof
()
const
;
private:
int
_fd
;
...
...
@@ -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"
);
}
/**
* \details: Thread safety: Yes.
*/
bool
LocalFileWindows
::
xx_threadsafe
()
const
{
return
false
;
}
/**
* \details: Thread safety: Not for writes. Uses xx_eof().
* And should in any case be changed to call ::stat().
...
...
native/src/test/test_file.cpp
View file @
fe9d723e
...
...
@@ -85,13 +85,11 @@ run_helloworld(const std::string& fn, const std::function<std::shared_ptr<FileAD
{
std
::
shared_ptr
<
FileADT
>
file
;
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_close
();
file
.
reset
();
file
=
alloc
(
fn
,
OpenMode
::
ReadOnly
);
//TEST_CHECK(!file->xx_threadsafe());
char
data
[
100
]{
0
};
file
->
xx_read
(
data
,
7
,
5
);
TEST_CHECK
(
std
::
string
(
data
)
==
std
::
string
(
"world"
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment