-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for read-only s3 virtual driver #1010
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ef57f4d
add ros3 functions
gszep 007b49d
fix julia julia to C struct passing
gszep ff4517c
Update src/drivers/drivers.jl
29f99d5
Update src/drivers/drivers.jl
b7b4c18
re-generate functions.jl and remove cchar hardcode
gszep bbbb1e4
remove local file existance check
gszep 02eff7d
remove user-defined cconvert
gszep 692ded0
remove h5file existance test
gszep aa89a7f
lazy tests
gszep 97f0113
obey formatter
gszep 6aa4810
obey formatter
gszep 877f0ac
restore file existance tests
gszep 6fdeaa7
obey formatter
gszep cc6625e
Make a bind exception for h5p_get_fapl_ros3 and h5p_set_fapl_ros3
mkitti b904ce6
Refactor ROS3 driver interface to match C definitions
mkitti 6d41c99
Update docstring, reorganize
mkitti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,5 +44,6 @@ CurrentModule = HDF5.Drivers | |
```@docs | ||
Core | ||
POSIX | ||
ROS3 | ||
MPIO | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
""" | ||
ROS3() | ||
ROS3(aws_region::String, secret_id::String, secret_key::String) | ||
ROS3(version::Int32, authenticate::Bool, aws_region::String, secret_id::String, secret_key::String) | ||
|
||
This is the read-only virtual driver that enables access to HDF5 objects stored in AWS S3 | ||
""" | ||
struct ROS3 <: Driver | ||
version::Int32 | ||
authenticate::Bool | ||
aws_region::String | ||
secret_id::String | ||
secret_key::String | ||
function ROS3(version, authenticate, aws_region, secret_id, secret_key) | ||
length(aws_region) <= API.H5FD_ROS3_MAX_REGION_LEN || | ||
"length(aws_region), $(length(aws_region)), must be less than or equal to $(API.H5FD_ROS3_MAX_REGION_LEN)" | ||
length(secret_id) <= API.H5FD_ROS3_MAX_SECRET_ID_LEN || | ||
"length(secret_id), $(length(secret_id)), must be less than or equal to $(API.H5FD_ROS3_MAX_SECRET_ID_LEN)" | ||
length(secret_key) <= API.H5FD_ROS3_MAX_SECRET_KEY_LEN || | ||
"length(secret_key), $(length(secret_key)), must be less than or equal to $(API.H5FD_ROS3_MAX_SECRET_KEY_LEN)" | ||
new(version, authenticate, aws_region, secret_id, secret_key) | ||
end | ||
end | ||
|
||
ROS3() = ROS3(1, false, "", "", "") | ||
|
||
ROS3(region::AbstractString, id::AbstractString, key::AbstractString) = | ||
ROS3(1, true, region, id, key) | ||
|
||
function ROS3(driver::API.H5FD_ros3_fapl_t) | ||
aws_region = _ntuple_to_string(driver.aws_region) | ||
secret_id = _ntuple_to_string(driver.secret_id) | ||
secret_key = _ntuple_to_string(driver.secret_key) | ||
ROS3(driver.version, driver.authenticate, aws_region, secret_id, secret_key) | ||
end | ||
_ntuple_to_string(x) = unsafe_string(Ptr{Cchar}(pointer_from_objref(Ref(x))), length(x)) | ||
|
||
function Base.convert(::Type{API.H5FD_ros3_fapl_t}, driver::ROS3) | ||
aws_region = ntuple( | ||
i -> i <= length(driver.aws_region) ? Cchar(driver.aws_region[i]) : Cchar(0x0), | ||
API.H5FD_ROS3_MAX_REGION_LEN + 1 | ||
) | ||
secret_id = ntuple( | ||
i -> i <= length(driver.secret_id) ? Cchar(driver.secret_id[i]) : Cchar(0x0), | ||
API.H5FD_ROS3_MAX_SECRET_ID_LEN + 1 | ||
) | ||
secret_key = ntuple( | ||
i -> i <= length(driver.secret_key) ? Cchar(driver.secret_key[i]) : Cchar(0x0), | ||
API.H5FD_ROS3_MAX_SECRET_KEY_LEN + 1 | ||
) | ||
s = API.H5FD_ros3_fapl_t( | ||
driver.version, driver.authenticate, aws_region, secret_id, secret_key, | ||
) | ||
end | ||
|
||
function get_driver(fapl::Properties, ::Type{ROS3}) | ||
r_fa = Ref{H5FD_ros3_fapl_t}() | ||
API.h5p_get_fapl_ros3(fapl, r_fa) | ||
return ROS3(r_fa[]) | ||
end | ||
|
||
function set_driver!(fapl::Properties, driver::ROS3) | ||
HDF5.has_ros3() || error( | ||
"HDF5.jl has no ros3 support." * | ||
" Make sure that you're using ROS3-enabled HDF5 libraries" | ||
) | ||
HDF5.init!(fapl) | ||
API.h5p_set_fapl_ros3(fapl, Ref{API.H5FD_ros3_fapl_t}(driver)) | ||
DRIVERS[API.h5p_get_driver(fapl)] = ROS3 | ||
return nothing | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using HDF5 | ||
using Test | ||
|
||
@testset "ros3" begin | ||
@test HDF5.has_ros3() | ||
|
||
h5open( | ||
"http://s3.us-east-2.amazonaws.com/hdf5ros3/GMODO-SVM01.h5"; | ||
driver=HDF5.Drivers.ROS3() | ||
) do f | ||
@test keys(f) == ["All_Data", "Data_Products"] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the docstring signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added additonal signatures below this line.