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
Kate Kader
Open VDS
Commits
49298969
Commit
49298969
authored
Nov 14, 2019
by
David Diederich
Browse files
Merge remote-tracking branch 'upstream/master' into ci-pipeline
Conflicts: build-environment.Dockerfile
parents
c661bfa9
51e7ce6f
Changes
26
Hide whitespace changes
Inline
Side-by-side
CMake/BuildAWSSDK.cmake
View file @
49298969
macro
(
BuildAWSSDK
)
get_property
(
LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS
)
if
(
"
${
LIB64
}
"
STREQUAL
"TRUE"
)
set
(
LIBSUFFIX 64
)
else
()
set
(
LIBSUFFIX
""
)
endif
()
if
(
WIN32
)
list
(
APPEND AWS_LIBS_LIST
"bin/aws-cpp-sdk-core.lib"
)
list
(
APPEND AWS_LIBS_LIST
"bin/aws-cpp-sdk-s3.lib"
)
...
...
CMake/BuildAzure.cmake
View file @
49298969
function
(
BuildAzure
)
get_property
(
LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS
)
if
(
"
${
LIB64
}
"
STREQUAL
"TRUE"
)
set
(
LIBSUFFIX 64
)
else
()
set
(
LIBSUFFIX
""
)
endif
()
if
(
WIN32
)
list
(
APPEND AZURE_LIBS_LIST
"lib/wastorage.lib"
)
...
...
@@ -14,9 +6,9 @@ function(BuildAzure)
elseif
(
APPLE
)
list
(
APPEND AZURE_LIBS_LIST
"lib/libwastorage.dylib"
)
else
()
list
(
APPEND AZURE_LIBS_LIST
"lib
${
LIBSUFFIX
}
/libazurestorage.so.7.0"
)
list
(
APPEND AZURE_LIBS_LIST
"lib
${
LIBSUFFIX
}
/libazurestorage.so.7"
)
list
(
APPEND AZURE_LIBS_LIST
"lib
${
LIBSUFFIX
}
/libazurestorage.so"
)
list
(
APPEND AZURE_LIBS_LIST
"lib/libazurestorage.so.7.0"
)
list
(
APPEND AZURE_LIBS_LIST
"lib/libazurestorage.so.7"
)
list
(
APPEND AZURE_LIBS_LIST
"lib/libazurestorage.so"
)
endif
()
set
(
AzureCmakeDir
"
${
azure-storage-cpp_SOURCE_DIR
}
/Microsoft.WindowsAzure.Storage"
)
if
(
WIN32
)
...
...
CMake/BuildCppRestSdk.cmake
View file @
49298969
function
(
BuildCppRestSdk
)
get_property
(
LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS
)
if
(
"
${
LIB64
}
"
STREQUAL
"TRUE"
)
set
(
LIBSUFFIX 64
)
else
()
set
(
LIBSUFFIX
""
)
endif
()
if
(
WIN32
)
get_property
(
_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG
)
if
(
${
_isMultiConfig
}
)
...
...
CMake/BuildZlib.cmake
View file @
49298969
macro
(
BuildZlib
)
get_property
(
LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS
)
if
(
"
${
LIB64
}
"
STREQUAL
"TRUE"
)
set
(
LIBSUFFIX 64
)
else
()
set
(
LIBSUFFIX
""
)
endif
()
if
(
WIN32
)
list
(
APPEND ZLIB_LIBS_LIST_RELEASE
"lib/zlib.lib"
)
list
(
APPEND ZLIB_LIBS_LIST_DEBUG
"lib/zlibd.lib"
)
...
...
CMakeLists.txt
View file @
49298969
...
...
@@ -11,6 +11,16 @@ set (TEST_AWS_REGION "" CACHE STRING "Test AWS region")
set
(
TEST_AWS_BUCKET
""
CACHE STRING
"Test AWS bucket"
)
set
(
TEST_AWS_OBJECTID
""
CACHE STRING
"Test AWS object ID"
)
set
(
OPENVDS_LIBDIR_SUFFIX
""
CACHE STRING
"Suffix to add to lib directories on linux"
)
option
(
FORCE_NO_LIBDIR_SUFFIX
"Force there to be no suffix on lib directories linux"
)
get_property
(
LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS
)
if
(
"
${
LIB64
}
"
STREQUAL
"TRUE"
)
set
(
LIBSUFFIX 64
)
else
()
set
(
LIBSUFFIX
""
)
endif
()
set
(
BUILD_PYTHON_DEFAULT ON
)
find_package
(
Python3 COMPONENTS Interpreter
)
if
(
Python3_FOUND
)
...
...
build-environment.Dockerfile
View file @
49298969
FROM
alpine:latest
# Install the various required packages
RUN
apk add python3 gcc g++ cmake make git
\
RUN
apk add python3
python3-dev
gcc g++ cmake make git
\
libxml2-dev boost-dev zlib-dev openssl-dev curl-dev
\
util-linux-dev
# This package contains the uuid development headers
...
...
src/CMakeLists.txt
View file @
49298969
...
...
@@ -35,6 +35,7 @@ set (PRIVATE_HEADER_FILES
IO/IOManager.h
IO/IOManagerAWS.h
IO/IOManagerAzure.h
VDS/VDS.h
VDS/VolumeDataPartition.h
VDS/VolumeDataChannelMapping.h
VDS/VolumeDataLayer.h
...
...
@@ -115,7 +116,7 @@ get_property(runtime_3rdparty_release GLOBAL PROPERTY OPENVDS_RUNTIME_LIBS_RELEA
get_property
(
runtime_3rdparty_debug GLOBAL PROPERTY OPENVDS_RUNTIME_LIBS_DEBUG
)
get_property
(
include_3rdparty GLOBAL PROPERTY OPENVDS_INCLUDE_LIBRARIES
)
add_dependencies
(
openvds_objects aws-cpp-sdk
)
add_dependencies
(
openvds_objects aws-cpp-sdk
azure-storage
)
target_include_directories
(
openvds_objects SYSTEM PRIVATE
${
include_3rdparty
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
target_compile_definitions
(
openvds_objects PRIVATE openvds_EXPORTS
)
...
...
src/OpenVDS.cpp
View file @
49298969
...
...
@@ -17,7 +17,7 @@
#include "OpenVDS/OpenVDS.h"
#include <
OpenVDSHandle
.h>
#include <
VDS/VDS
.h>
#include <VDS/ParseVDSJson.h>
...
...
@@ -35,9 +35,9 @@
namespace
OpenVDS
{
VDS
Handle
*
Open
(
IOManager
*
ioManager
,
Error
&
error
)
VDS
*
Open
(
IOManager
*
ioManager
,
Error
&
error
)
{
std
::
unique_ptr
<
VDS
Handle
>
ret
(
new
VDS
Handle
(
ioManager
));
std
::
unique_ptr
<
VDS
>
ret
(
new
VDS
(
ioManager
));
error
=
Error
();
if
(
!
DownloadAndParseVolumeDataLayoutAndLayerStatus
(
*
ret
.
get
(),
error
))
...
...
@@ -49,7 +49,7 @@ VDSHandle* Open(IOManager *ioManager, Error& error)
return
ret
.
release
();
}
VDS
Handle
*
Open
(
const
OpenOptions
&
options
,
Error
&
error
)
VDS
*
Open
(
const
OpenOptions
&
options
,
Error
&
error
)
{
error
=
Error
();
IOManager
*
ioManager
=
IOManager
::
CreateIOManager
(
options
,
error
);
...
...
@@ -59,26 +59,26 @@ VDSHandle *Open(const OpenOptions &options, Error &error)
return
Open
(
ioManager
,
error
);
}
VolumeDataLayout
*
GetLayout
(
VDS
Handle
*
handle
)
VolumeDataLayout
*
GetLayout
(
VDS
*
vds
)
{
if
(
!
handle
)
if
(
!
vds
)
return
nullptr
;
return
handle
->
VolumeDataLayout
.
get
();
return
vds
->
VolumeDataLayout
.
get
();
}
VolumeDataAccessManager
*
GetDataAccessManager
(
VDS
Handle
*
handle
)
VolumeDataAccessManager
*
GetDataAccessManager
(
VDS
*
vds
)
{
if
(
!
handle
)
if
(
!
vds
)
return
nullptr
;
return
handle
->
DataAccessManager
.
get
();
return
vds
->
DataAccessManager
.
get
();
}
const
char
*
AddDescriptorString
(
std
::
string
const
&
descriptorString
,
VDS
Handle
&
handle
)
const
char
*
AddDescriptorString
(
std
::
string
const
&
descriptorString
,
VDS
&
vds
)
{
char
*
data
=
new
char
[
descriptorString
.
size
()
+
1
];
memcpy
(
data
,
descriptorString
.
data
(),
descriptorString
.
size
());
data
[
descriptorString
.
size
()]
=
0
;
handle
.
DescriptorStrings
.
emplace_back
(
data
);
vds
.
DescriptorStrings
.
emplace_back
(
data
);
return
data
;
}
...
...
@@ -119,33 +119,32 @@ MetadataManager *FindMetadataManager(LayerMetadataContainer const &layerMetadata
return
(
it
!=
layerMetadataContainer
.
managers
.
end
())
?
it
->
second
.
get
()
:
nullptr
;
}
MetadataManager
*
CreateMetadataManager
(
VDS
Handle
&
handle
,
std
::
string
const
&
layerName
,
MetadataStatus
const
&
metadataStatus
)
MetadataManager
*
CreateMetadataManager
(
VDS
&
vds
,
std
::
string
const
&
layerName
,
MetadataStatus
const
&
metadataStatus
)
{
std
::
unique_lock
<
std
::
mutex
>
metadataManagersMutexLock
(
handle
.
LayerMetadataContainer
.
mutex
);
std
::
unique_lock
<
std
::
mutex
>
metadataManagersMutexLock
(
vds
.
LayerMetadataContainer
.
mutex
);
assert
(
handle
.
LayerMetadataContainer
.
managers
.
find
(
layerName
)
==
handle
.
LayerMetadataContainer
.
managers
.
end
());
int
pageLimit
=
handle
.
AxisDescriptors
.
size
()
<=
3
?
64
:
1024
;
return
handle
.
LayerMetadataContainer
.
managers
.
insert
(
std
::
make_pair
(
layerName
,
std
::
unique_ptr
<
MetadataManager
>
(
new
MetadataManager
(
handle
.
IoManager
.
get
(),
layerName
,
metadataStatus
,
pageLimit
)))).
first
->
second
.
get
();
assert
(
vds
.
LayerMetadataContainer
.
managers
.
find
(
layerName
)
==
vds
.
LayerMetadataContainer
.
managers
.
end
());
int
pageLimit
=
vds
.
AxisDescriptors
.
size
()
<=
3
?
64
:
1024
;
return
vds
.
LayerMetadataContainer
.
managers
.
insert
(
std
::
make_pair
(
layerName
,
std
::
unique_ptr
<
MetadataManager
>
(
new
MetadataManager
(
vds
.
IoManager
.
get
(),
layerName
,
metadataStatus
,
pageLimit
)))).
first
->
second
.
get
();
}
void
CreateVolumeDataLayout
(
VDS
Handle
&
handle
)
void
CreateVolumeDataLayout
(
VDS
&
vds
)
{
//handle.volumeDataLayout.reset(new VolumeDataLayout(handle.channelDescriptors)
int32_t
dimensionality
=
int32_t
(
handle
.
AxisDescriptors
.
size
());
int32_t
dimensionality
=
int32_t
(
vds
.
AxisDescriptors
.
size
());
// Check if input layouts are valid so we can create a new layout
if
(
dimensionality
<
2
)
{
handle
.
VolumeDataLayout
.
reset
();
vds
.
VolumeDataLayout
.
reset
();
return
;
}
handle
.
VolumeDataLayout
.
reset
(
vds
.
VolumeDataLayout
.
reset
(
new
VolumeDataLayoutImpl
(
handle
,
handle
.
LayoutDescriptor
,
handle
.
AxisDescriptors
,
handle
.
ChannelDescriptors
,
vds
,
vds
.
LayoutDescriptor
,
vds
.
AxisDescriptors
,
vds
.
ChannelDescriptors
,
0
,
//MIA for now
{
1
,
0
},
//MIA for now
VolumeDataHash
::
GetUniqueHash
(),
...
...
@@ -169,23 +168,23 @@ void CreateVolumeDataLayout(VDSHandle &handle)
assert
(
nChunkDimensionality
==
2
||
nChunkDimensionality
==
3
);
int32_t
physicalLODLevels
=
(
nChunkDimensionality
==
3
||
handle
.
LayoutDescriptor
.
IsCreate2DLODs
())
?
GetLODCount
(
handle
.
LayoutDescriptor
)
:
1
;
int32_t
brickSize
=
GetInternalCubeSizeLOD0
(
handle
.
LayoutDescriptor
)
*
(
nChunkDimensionality
==
2
?
handle
.
LayoutDescriptor
.
GetBrickSizeMultiplier2D
()
:
1
);
int32_t
physicalLODLevels
=
(
nChunkDimensionality
==
3
||
vds
.
LayoutDescriptor
.
IsCreate2DLODs
())
?
GetLODCount
(
vds
.
LayoutDescriptor
)
:
1
;
int32_t
brickSize
=
GetInternalCubeSizeLOD0
(
vds
.
LayoutDescriptor
)
*
(
nChunkDimensionality
==
2
?
vds
.
LayoutDescriptor
.
GetBrickSizeMultiplier2D
()
:
1
);
handle
.
VolumeDataLayout
->
CreateLayers
(
dimensionGroup
,
brickSize
,
physicalLODLevels
,
handle
.
ProduceStatuses
[
DimensionGroupUtil
::
GetDimensionsNDFromDimensionGroup
(
dimensionGroup
)]);
vds
.
VolumeDataLayout
->
CreateLayers
(
dimensionGroup
,
brickSize
,
physicalLODLevels
,
vds
.
ProduceStatuses
[
DimensionGroupUtil
::
GetDimensionsNDFromDimensionGroup
(
dimensionGroup
)]);
}
}
VDS
Handle
*
Create
(
IOManager
*
ioManager
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
)
VDS
*
Create
(
IOManager
*
ioManager
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
)
{
error
=
Error
();
std
::
unique_ptr
<
VDS
Handle
>
handle
(
new
VDS
Handle
(
ioManager
));
std
::
unique_ptr
<
VDS
>
vds
(
new
VDS
(
ioManager
));
handle
->
LayoutDescriptor
=
layoutDescriptor
;
vds
->
LayoutDescriptor
=
layoutDescriptor
;
for
(
auto
axisDescriptor
:
axisDescriptors
)
{
handle
->
AxisDescriptors
.
push_back
(
VolumeDataAxisDescriptor
(
axisDescriptor
.
GetNumSamples
(),
AddDescriptorString
(
axisDescriptor
.
GetName
(),
*
handle
),
AddDescriptorString
(
axisDescriptor
.
GetUnit
(),
*
handle
),
axisDescriptor
.
GetCoordinateMin
(),
axisDescriptor
.
GetCoordinateMax
()));
vds
->
AxisDescriptors
.
push_back
(
VolumeDataAxisDescriptor
(
axisDescriptor
.
GetNumSamples
(),
AddDescriptorString
(
axisDescriptor
.
GetName
(),
*
vds
),
AddDescriptorString
(
axisDescriptor
.
GetUnit
(),
*
vds
),
axisDescriptor
.
GetCoordinateMin
(),
axisDescriptor
.
GetCoordinateMax
()));
}
for
(
auto
channelDescriptor
:
channelDescriptors
)
...
...
@@ -199,34 +198,34 @@ VDSHandle* Create(IOManager *ioManager, VolumeDataLayoutDescriptor const &layout
if
(
channelDescriptor
.
IsUseNoValue
())
{
handle
->
ChannelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
channelDescriptor
.
GetFormat
(),
channelDescriptor
.
GetComponents
(),
AddDescriptorString
(
channelDescriptor
.
GetName
(),
*
handle
),
AddDescriptorString
(
channelDescriptor
.
GetUnit
(),
*
handle
),
channelDescriptor
.
GetValueRangeMin
(),
channelDescriptor
.
GetValueRangeMax
(),
channelDescriptor
.
GetMapping
(),
channelDescriptor
.
GetMappedValueCount
(),
flags
,
channelDescriptor
.
GetNoValue
(),
channelDescriptor
.
GetIntegerScale
(),
channelDescriptor
.
GetIntegerOffset
()));
vds
->
ChannelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
channelDescriptor
.
GetFormat
(),
channelDescriptor
.
GetComponents
(),
AddDescriptorString
(
channelDescriptor
.
GetName
(),
*
vds
),
AddDescriptorString
(
channelDescriptor
.
GetUnit
(),
*
vds
),
channelDescriptor
.
GetValueRangeMin
(),
channelDescriptor
.
GetValueRangeMax
(),
channelDescriptor
.
GetMapping
(),
channelDescriptor
.
GetMappedValueCount
(),
flags
,
channelDescriptor
.
GetNoValue
(),
channelDescriptor
.
GetIntegerScale
(),
channelDescriptor
.
GetIntegerOffset
()));
}
else
{
handle
->
ChannelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
channelDescriptor
.
GetFormat
(),
channelDescriptor
.
GetComponents
(),
AddDescriptorString
(
channelDescriptor
.
GetName
(),
*
handle
),
AddDescriptorString
(
channelDescriptor
.
GetUnit
(),
*
handle
),
channelDescriptor
.
GetValueRangeMin
(),
channelDescriptor
.
GetValueRangeMax
(),
channelDescriptor
.
GetMapping
(),
channelDescriptor
.
GetMappedValueCount
(),
flags
,
channelDescriptor
.
GetIntegerScale
(),
channelDescriptor
.
GetIntegerOffset
()));
vds
->
ChannelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
channelDescriptor
.
GetFormat
(),
channelDescriptor
.
GetComponents
(),
AddDescriptorString
(
channelDescriptor
.
GetName
(),
*
vds
),
AddDescriptorString
(
channelDescriptor
.
GetUnit
(),
*
vds
),
channelDescriptor
.
GetValueRangeMin
(),
channelDescriptor
.
GetValueRangeMax
(),
channelDescriptor
.
GetMapping
(),
channelDescriptor
.
GetMappedValueCount
(),
flags
,
channelDescriptor
.
GetIntegerScale
(),
channelDescriptor
.
GetIntegerOffset
()));
}
}
handle
->
MetadataContainer
=
metadataContainer
;
vds
->
MetadataContainer
=
metadataContainer
;
handle
->
ProduceStatuses
.
clear
();
handle
->
ProduceStatuses
.
resize
(
int
(
Dimensions_45
)
+
1
,
VolumeDataLayer
::
ProduceStatus_Unavailable
);
vds
->
ProduceStatuses
.
clear
();
vds
->
ProduceStatuses
.
resize
(
int
(
Dimensions_45
)
+
1
,
VolumeDataLayer
::
ProduceStatus_Unavailable
);
CreateVolumeDataLayout
(
*
handle
);
CreateVolumeDataLayout
(
*
vds
);
if
(
error
.
Code
)
return
nullptr
;
if
(
!
SerializeAndUploadVolumeDataLayout
(
*
handle
,
error
))
if
(
!
SerializeAndUploadVolumeDataLayout
(
*
vds
,
error
))
return
nullptr
;
handle
->
DataAccessManager
.
reset
(
new
VolumeDataAccessManagerImpl
(
*
handle
.
get
()));
handle
->
RequestProcessor
.
reset
(
new
VolumeDataRequestProcessor
(
*
handle
->
DataAccessManager
.
get
()));
vds
->
DataAccessManager
.
reset
(
new
VolumeDataAccessManagerImpl
(
*
vds
.
get
()));
vds
->
RequestProcessor
.
reset
(
new
VolumeDataRequestProcessor
(
*
vds
->
DataAccessManager
.
get
()));
return
handle
.
release
();
return
vds
.
release
();
}
VDS
Handle
*
Create
(
const
OpenOptions
&
options
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
)
VDS
*
Create
(
const
OpenOptions
&
options
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
)
{
error
=
Error
();
IOManager
*
ioManager
=
IOManager
::
CreateIOManager
(
options
,
error
);
...
...
@@ -236,9 +235,9 @@ VDSHandle* Create(const OpenOptions& options, VolumeDataLayoutDescriptor const&
return
Create
(
ioManager
,
layoutDescriptor
,
axisDescriptors
,
channelDescriptors
,
metadataContainer
,
error
);
}
void
Close
(
VDS
Handle
*
handle
)
void
Close
(
VDS
*
vds
)
{
delete
handle
;
delete
vds
;
}
}
src/OpenVDS/OpenVDS.h
View file @
49298969
...
...
@@ -69,7 +69,7 @@ enum class Access
Read
=
1
<<
0
,
Write
=
1
<<
1
};
struct
VDSHandle
;
typedef
struct
VDS
*
VDSHandle
;
class
VolumeDataLayout
;
class
VolumeDataAccessManager
;
class
VolumeDataPageAccessor
;
...
...
@@ -86,7 +86,7 @@ class VolumeDataPageAccessor;
/// <returns>
/// The VDS handle that can be used to get the VolumeDataLayout and the VolumeDataAccessManager
/// </returns>
OPENVDS_EXPORT
VDSHandle
*
Open
(
const
OpenOptions
&
options
,
Error
&
error
);
OPENVDS_EXPORT
VDSHandle
Open
(
const
OpenOptions
&
options
,
Error
&
error
);
/// <summary>
/// Open an existing VDS
...
...
@@ -100,7 +100,7 @@ OPENVDS_EXPORT VDSHandle* Open(const OpenOptions& options, Error& error);
/// <returns>
/// The VDS handle that can be used to get the VolumeDataLayout and the VolumeDataAccessManager
/// </returns>
OPENVDS_EXPORT
VDSHandle
*
Open
(
IOManager
*
ioManager
,
Error
&
error
);
OPENVDS_EXPORT
VDSHandle
Open
(
IOManager
*
ioManager
,
Error
&
error
);
/// <summary>
/// Create a new VDS
...
...
@@ -114,7 +114,7 @@ OPENVDS_EXPORT VDSHandle* Open(IOManager*ioManager, Error &error);
/// <returns>
/// The VDS handle that can be used to get the VolumeDataLayout and the VolumeDataAccessManager
/// </returns>
OPENVDS_EXPORT
VDSHandle
*
Create
(
const
OpenOptions
&
options
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
);
OPENVDS_EXPORT
VDSHandle
Create
(
const
OpenOptions
&
options
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
);
/// <summary>
/// Create a new VDS
...
...
@@ -128,7 +128,7 @@ OPENVDS_EXPORT VDSHandle* Create(const OpenOptions& options, VolumeDataLayoutDes
/// <returns>
/// The VDS handle that can be used to get the VolumeDataLayout and the VolumeDataAccessManager
/// </returns>
OPENVDS_EXPORT
VDSHandle
*
Create
(
IOManager
*
ioManager
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
);
OPENVDS_EXPORT
VDSHandle
Create
(
IOManager
*
ioManager
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
);
/// <summary>
/// Close a VDS and free up all associated resources
...
...
@@ -136,10 +136,10 @@ OPENVDS_EXPORT VDSHandle* Create(IOManager* ioManager, VolumeDataLayoutDescripto
/// <param name="handle">
/// The handle to close
/// </param>
OPENVDS_EXPORT
void
Close
(
VDSHandle
*
handle
);
OPENVDS_EXPORT
void
Close
(
VDSHandle
handle
);
OPENVDS_EXPORT
VolumeDataLayout
*
GetLayout
(
VDSHandle
*
handle
);
OPENVDS_EXPORT
VolumeDataAccessManager
*
GetDataAccessManager
(
VDSHandle
*
handle
);
OPENVDS_EXPORT
VolumeDataLayout
*
GetLayout
(
VDSHandle
handle
);
OPENVDS_EXPORT
VolumeDataAccessManager
*
GetDataAccessManager
(
VDSHandle
handle
);
}
#endif //OPENVDS_H
src/OpenVDS/VolumeDataAccess.h
View file @
49298969
...
...
@@ -26,7 +26,7 @@ namespace OpenVDS {
class
VolumeDataPageAccessor
;
class
VolumeDataLayout
;
struct
VDS
Handle
;
struct
VDS
;
template
<
typename
INDEX
,
typename
T
>
class
VolumeDataReadAccessor
;
template
<
typename
INDEX
,
typename
T
>
class
VolumeDataReadWriteAccessor
;
...
...
src/SEG-Y/SEGYExport.cpp
View file @
49298969
...
...
@@ -79,7 +79,7 @@ main(int argc, char *argv[])
std
::
string
key
=
!
prefix
.
empty
()
?
prefix
+
"/"
+
persistentID
:
persistentID
;
std
::
unique_ptr
<
OpenVDS
::
VDS
Handle
,
decltype
(
&
OpenVDS
::
Close
)
>
vds
(
OpenVDS
::
Open
(
OpenVDS
::
AWSOpenOptions
(
bucket
,
key
,
region
),
openError
),
&
OpenVDS
::
Close
);
std
::
unique_ptr
<
OpenVDS
::
VDS
,
decltype
(
&
OpenVDS
::
Close
)
>
vds
(
OpenVDS
::
Open
(
OpenVDS
::
AWSOpenOptions
(
bucket
,
key
,
region
),
openError
),
&
OpenVDS
::
Close
);
if
(
openError
.
Code
!=
0
)
{
...
...
src/SEG-Y/SEGYUpload.cpp
View file @
49298969
...
...
@@ -857,7 +857,7 @@ main(int argc, char *argv[])
std
::
string
key
=
!
prefix
.
empty
()
?
prefix
+
"/"
+
persistentID
:
persistentID
;
std
::
unique_ptr
<
OpenVDS
::
VDS
Handle
,
decltype
(
&
OpenVDS
::
Close
)
>
vds
(
OpenVDS
::
Create
(
OpenVDS
::
AWSOpenOptions
(
bucket
,
key
,
region
),
layoutDescriptor
,
axisDescriptors
,
channelDescriptors
,
metadataContainer
,
createError
),
&
OpenVDS
::
Close
);
std
::
unique_ptr
<
OpenVDS
::
VDS
,
decltype
(
&
OpenVDS
::
Close
)
>
vds
(
OpenVDS
::
Create
(
OpenVDS
::
AWSOpenOptions
(
bucket
,
key
,
region
),
layoutDescriptor
,
axisDescriptors
,
channelDescriptors
,
metadataContainer
,
createError
),
&
OpenVDS
::
Close
);
if
(
createError
.
Code
!=
0
)
{
...
...
src/VDS/ParseVDSJson.cpp
View file @
49298969
...
...
@@ -435,7 +435,7 @@ bool ParseJSONFromBuffer(const std::vector<uint8_t> &json, Json::Value &root, Er
return
false
;
}
bool
ParseVolumeDataLayout
(
const
std
::
vector
<
uint8_t
>
&
json
,
VDS
Handle
&
handle
,
Error
&
error
)
bool
ParseVolumeDataLayout
(
const
std
::
vector
<
uint8_t
>
&
json
,
VDS
&
vds
,
Error
&
error
)
{
Json
::
Value
root
;
...
...
@@ -450,7 +450,7 @@ bool ParseVolumeDataLayout(const std::vector<uint8_t> &json, VDSHandle &handle,
Json
::
Value
layoutDescriptor
=
root
[
"layoutDescriptor"
];
handle
.
LayoutDescriptor
=
VolumeDataLayoutDescriptor
(
BrickSizeFromJson
(
layoutDescriptor
[
"brickSize"
]),
vds
.
LayoutDescriptor
=
VolumeDataLayoutDescriptor
(
BrickSizeFromJson
(
layoutDescriptor
[
"brickSize"
]),
layoutDescriptor
[
"negativeMargin"
].
asInt
(),
layoutDescriptor
[
"positiveMargin"
].
asInt
(),
layoutDescriptor
[
"brickSize2DMultiplier"
].
asInt
(),
...
...
@@ -463,23 +463,23 @@ bool ParseVolumeDataLayout(const std::vector<uint8_t> &json, VDSHandle &handle,
{
VolumeDataAxisDescriptor
volumeDataAxisDescriptor
(
axisDescriptor
[
"numSamples"
].
asInt
(),
AddDescriptorString
(
axisDescriptor
[
"name"
].
asString
(),
handle
),
AddDescriptorString
(
axisDescriptor
[
"unit"
].
asString
(),
handle
),
AddDescriptorString
(
axisDescriptor
[
"name"
].
asString
(),
vds
),
AddDescriptorString
(
axisDescriptor
[
"unit"
].
asString
(),
vds
),
axisDescriptor
[
"coordinateMin"
].
asFloat
(),
axisDescriptor
[
"coordinateMax"
].
asFloat
());
handle
.
AxisDescriptors
.
push_back
(
volumeDataAxisDescriptor
);
vds
.
AxisDescriptors
.
push_back
(
volumeDataAxisDescriptor
);
}
for
(
const
Json
::
Value
&
channelDescriptor
:
root
[
"channelDescriptors"
])
{
if
(
channelDescriptor
[
"useNoValue"
].
asBool
())
{
handle
.
ChannelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
vds
.
ChannelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
VoxelFormatFromJson
(
channelDescriptor
[
"format"
]),
VoxelComponentsFromJson
(
channelDescriptor
[
"components"
]),
AddDescriptorString
(
channelDescriptor
[
"name"
].
asString
(),
handle
),
AddDescriptorString
(
channelDescriptor
[
"unit"
].
asString
(),
handle
),
AddDescriptorString
(
channelDescriptor
[
"name"
].
asString
(),
vds
),
AddDescriptorString
(
channelDescriptor
[
"unit"
].
asString
(),
vds
),
channelDescriptor
[
"valueRange"
][
0
].
asFloat
(),
channelDescriptor
[
"valueRange"
][
1
].
asFloat
(),
ChannelMappingFromJson
(
channelDescriptor
[
"channelMapping"
]),
...
...
@@ -493,11 +493,11 @@ bool ParseVolumeDataLayout(const std::vector<uint8_t> &json, VDSHandle &handle,
}
else
{
handle
.
ChannelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
vds
.
ChannelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
VoxelFormatFromJson
(
channelDescriptor
[
"format"
]),
VoxelComponentsFromJson
(
channelDescriptor
[
"components"
]),
AddDescriptorString
(
channelDescriptor
[
"name"
].
asString
(),
handle
),
AddDescriptorString
(
channelDescriptor
[
"unit"
].
asString
(),
handle
),
AddDescriptorString
(
channelDescriptor
[
"name"
].
asString
(),
vds
),
AddDescriptorString
(
channelDescriptor
[
"unit"
].
asString
(),
vds
),
channelDescriptor
[
"valueRange"
][
0
].
asFloat
(),
channelDescriptor
[
"valueRange"
][
1
].
asFloat
(),
ChannelMappingFromJson
(
channelDescriptor
[
"channelMapping"
]),
...
...
@@ -514,59 +514,59 @@ bool ParseVolumeDataLayout(const std::vector<uint8_t> &json, VDSHandle &handle,
{
MetadataKey
key
=
{
MetadataTypeFromJson
(
metadata
[
"type"
]),
metadata
[
"category"
].
asString
(),
metadata
[
"name"
].
asString
()
};
handle
.
MetadataContainer
.
keys
.
push_back
(
key
);
vds
.
MetadataContainer
.
keys
.
push_back
(
key
);
if
(
metadata
[
"type"
].
asString
()
==
"Int"
)
{
handle
.
MetadataContainer
.
intData
[
key
]
=
metadata
[
"value"
].
asInt
();
vds
.
MetadataContainer
.
intData
[
key
]
=
metadata
[
"value"
].
asInt
();
}
else
if
(
metadata
[
"type"
].
asString
()
==
"IntVector2"
)
{
handle
.
MetadataContainer
.
intVector2Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asInt
(),
metadata
[
"value"
][
1
].
asInt
()};
vds
.
MetadataContainer
.
intVector2Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asInt
(),
metadata
[
"value"
][
1
].
asInt
()};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"IntVector3"
)
{
handle
.
MetadataContainer
.
intVector3Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asInt
(),
metadata
[
"value"
][
1
].
asInt
(),
metadata
[
"value"
][
2
].
asInt
()
};
vds
.
MetadataContainer
.
intVector3Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asInt
(),
metadata
[
"value"
][
1
].
asInt
(),
metadata
[
"value"
][
2
].
asInt
()
};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"IntVector4"
)
{
handle
.
MetadataContainer
.
intVector4Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asInt
(),
metadata
[
"value"
][
1
].
asInt
(),
metadata
[
"value"
][
2
].
asInt
(),
metadata
[
"value"
][
3
].
asInt
()
};
vds
.
MetadataContainer
.
intVector4Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asInt
(),
metadata
[
"value"
][
1
].
asInt
(),
metadata
[
"value"
][
2
].
asInt
(),
metadata
[
"value"
][
3
].
asInt
()
};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"Float"
)
{
handle
.
MetadataContainer
.
floatData
[
key
]
=
metadata
[
"value"
].
asFloat
();
vds
.
MetadataContainer
.
floatData
[
key
]
=
metadata
[
"value"
].
asFloat
();
}
else
if
(
metadata
[
"type"
].
asString
()
==
"FloatVector2"
)
{
handle
.
MetadataContainer
.
floatVector2Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asFloat
(),
metadata
[
"value"
][
1
].
asFloat
()
};
vds
.
MetadataContainer
.
floatVector2Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asFloat
(),
metadata
[
"value"
][
1
].
asFloat
()
};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"FloatVector3"
)
{
handle
.
MetadataContainer
.
floatVector3Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asFloat
(),
metadata
[
"value"
][
1
].
asFloat
(),
metadata
[
"value"
][
2
].
asFloat
()
};
vds
.
MetadataContainer
.
floatVector3Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asFloat
(),
metadata
[
"value"
][
1
].
asFloat
(),
metadata
[
"value"
][
2
].
asFloat
()
};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"FloatVector4"
)
{
handle
.
MetadataContainer
.
floatVector4Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asFloat
(),
metadata
[
"value"
][
1
].
asFloat
(),
metadata
[
"value"
][
2
].
asFloat
(),
metadata
[
"value"
][
3
].
asFloat
()
};
vds
.
MetadataContainer
.
floatVector4Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asFloat
(),
metadata
[
"value"
][
1
].
asFloat
(),
metadata
[
"value"
][
2
].
asFloat
(),
metadata
[
"value"
][
3
].
asFloat
()
};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"Double"
)
{
handle
.
MetadataContainer
.
doubleData
[
key
]
=
metadata
[
"value"
].
asDouble
();
vds
.
MetadataContainer
.
doubleData
[
key
]
=
metadata
[
"value"
].
asDouble
();
}
else
if
(
metadata
[
"type"
].
asString
()
==
"DoubleVector2"
)
{
handle
.
MetadataContainer
.
doubleVector2Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asDouble
(),
metadata
[
"value"
][
1
].
asDouble
()
};
vds
.
MetadataContainer
.
doubleVector2Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asDouble
(),
metadata
[
"value"
][
1
].
asDouble
()
};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"DoubleVector3"
)
{
handle
.
MetadataContainer
.
doubleVector3Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asDouble
(),
metadata
[
"value"
][
1
].
asDouble
(),
metadata
[
"value"
][
2
].
asDouble
()
};
vds
.
MetadataContainer
.
doubleVector3Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asDouble
(),
metadata
[
"value"
][
1
].
asDouble
(),
metadata
[
"value"
][
2
].
asDouble
()
};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"DoubleVector4"
)
{
handle
.
MetadataContainer
.
doubleVector4Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asDouble
(),
metadata
[
"value"
][
1
].
asDouble
(),
metadata
[
"value"
][
2
].
asDouble
(),
metadata
[
"value"
][
3
].
asDouble
()
};
vds
.
MetadataContainer
.
doubleVector4Data
[
key
]
=
{
metadata
[
"value"
][
0
].
asDouble
(),
metadata
[
"value"
][
1
].
asDouble
(),
metadata
[
"value"
][
2
].
asDouble
(),
metadata
[
"value"
][
3
].
asDouble
()
};
}
else
if
(
metadata
[
"type"
].
asString
()
==
"String"
)
{
handle
.
MetadataContainer
.
stringData
[
key
]
=
metadata
[
"value"
].
asString
();
vds
.
MetadataContainer
.
stringData
[
key
]
=
metadata
[
"value"
].
asString
();
}
else
if
(
metadata
[
"type"
].
asString
()
==
"BLOB"
)
{
...
...
@@ -574,7 +574,7 @@ bool ParseVolumeDataLayout(const std::vector<uint8_t> &json, VDSHandle &handle,
int
len
=
(
int
)
strlen
(
value
);
std
::
vector
<
uint8_t
>
&
data
=
handle
.
MetadataContainer
.
blobData
[
key
];
std
::
vector
<
uint8_t
>
&
data
=
vds
.
MetadataContainer
.
blobData
[
key
];
data
.
clear
();
bool
success
=
Base64Decode
(
value
,
len
,
data
);
...
...
@@ -679,10 +679,10 @@ static MetadataStatus MetadataStatusFromJSON(Json::Value const &metadataStatusJs
return
metadataStatus
;
}
bool
ParseLayerStatus
(
const
std
::
vector
<
uint8_t
>
&
json
,
VDS
Handle
&
handle
,
Error
&
error
)
bool
ParseLayerStatus
(
const
std
::
vector
<
uint8_t
>
&
json
,
VDS
&
vds
,
Error
&
error
)
{
handle
.
ProduceStatuses
.
clear
();
handle
.
ProduceStatuses
.
resize
(
int
(
Dimensions_45
)
+
1
,
VolumeDataLayer
::
ProduceStatus_Unavailable
);
vds
.
ProduceStatuses
.
clear
();
vds
.
ProduceStatuses
.
resize
(
int
(
Dimensions_45
)
+
1
,
VolumeDataLayer
::
ProduceStatus_Unavailable
);
Json
::
Value
root
;
if
(
!
ParseJSONFromBuffer
(
json
,
root
,
error
))
...
...
@@ -709,9 +709,9 @@ bool ParseLayerStatus(const std::vector<uint8_t> &json, VDSHandle &handle, Error
int
lod
=
layerStatus
[
"lod"
].
asInt
();
if
(
lod
==
0
&&
handle
.
ProduceStatuses
[
dimensionsND
]
==
VolumeDataLayer
::
ProduceStatus_Unavailable
)
if
(
lod
==
0
&&
vds
.
ProduceStatuses
[
dimensionsND
]
==
VolumeDataLayer
::
ProduceStatus_Unavailable
)
{
handle
.
ProduceStatuses
[
dimensionsND
]
=
produceStatus
;
vds
.
ProduceStatuses
[
dimensionsND
]
=
produceStatus
;
}
MetadataStatus
...
...
@@ -740,14 +740,14 @@ bool ParseLayerStatus(const std::vector<uint8_t> &json, VDSHandle &handle, Error
if
(
hasChunkMetadataPages
)
{
std
::
unique_lock
<
std
::
mutex
>
metadataManagersMutexLock
(
handle
.
LayerMetadataContainer
.
mutex
);
auto
&
managers
=
handle
.
LayerMetadataContainer
.
managers
;
std
::
unique_lock
<
std
::
mutex
>
metadataManagersMutexLock
(
vds
.
LayerMetadataContainer
.
mutex
);
auto
&
managers
=
vds
.
LayerMetadataContainer
.
managers
;
if
(
managers
.
find
(
layerName
)
==
handle
.
LayerMetadataContainer
.
managers
.
end
())
if
(
managers
.
find
(
layerName
)
==
vds
.
LayerMetadataContainer
.
managers
.
end
())
{
int
pageLimit
=
handle
.
AxisDescriptors
.
size
()
<=
3
?
64
:
1024
;
int
pageLimit
=
vds
.
AxisDescriptors
.
size
()
<=
3
?
64
:
1024
;
handle
.
LayerMetadataContainer
.
managers
.
insert
(
std
::
make_pair
(
layerName
,
std
::
unique_ptr
<
MetadataManager
>
(
new
MetadataManager
(
handle
.
IoManager
.
get
(),
layerName
,
metadataStatus
,
pageLimit
))));
vds
.
LayerMetadataContainer
.
managers
.
insert
(
std
::