[ntuple] Add S3 anchor and its tests for S3 backend#22470
Conversation
9a87143 to
3a8cec6
Compare
|
I have made the changes so that the build for S3 backend only occurs when curl is present, and removed the s3 flag. |
| if the anchor exists, the entire ntuple is complete. | ||
| */ | ||
| // clang-format on | ||
| struct RS3NTupleAnchor { |
There was a problem hiding this comment.
Maybe better:
| struct RS3NTupleAnchor { | |
| struct RNTupleAnchorS3 { |
| std::uint32_t fNBytesHeader = 0; | ||
| std::uint32_t fLenHeader = 0; |
There was a problem hiding this comment.
Here and for the footer: since we use 64bits in the regular anchor, let's do the same here.
| bool operator==(const RS3NTupleAnchor &other) const; | ||
|
|
||
| /// Serialize the anchor to a JSON string suitable for storage at the base URL | ||
| std::string Serialize() const; |
There was a problem hiding this comment.
| std::string Serialize() const; | |
| std::string ToJSON() const; |
| /// Serialize the anchor to a JSON string suitable for storage at the base URL | ||
| std::string Serialize() const; | ||
| /// Deserialize the anchor from a JSON string. Returns an error on malformed or incompatible input. | ||
| RResult<void> Deserialize(const std::string &json); |
There was a problem hiding this comment.
| RResult<void> Deserialize(const std::string &json); | |
| RResult<void> FromJSON(const std::string &json); |
| jsonAnchor["anchor_version"] = fVersionAnchor; | ||
| jsonAnchor["format_version_epoch"] = fVersionEpoch; | ||
| jsonAnchor["format_version_major"] = fVersionMajor; | ||
| jsonAnchor["format_version_minor"] = fVersionMinor; | ||
| jsonAnchor["format_version_patch"] = fVersionPatch; | ||
| jsonAnchor["url_template"] = fUrlTemplate; | ||
| jsonAnchor["header_obj_id"] = fHeaderObjId; | ||
| jsonAnchor["header_offset"] = fHeaderOffset; | ||
| jsonAnchor["nbytes_header"] = fNBytesHeader; | ||
| jsonAnchor["len_header"] = fLenHeader; | ||
| jsonAnchor["footer_obj_id"] = fFooterObjId; | ||
| jsonAnchor["footer_offset"] = fFooterOffset; | ||
| jsonAnchor["nbytes_footer"] = fNBytesFooter; | ||
| jsonAnchor["len_footer"] = fLenFooter; |
There was a problem hiding this comment.
Maybe, since we use camelCase in the C++ code, let's do the same in JSON.
| if(curl) | ||
| set(ROOTNTuple_EXTRA_HEADERS ${ROOTNTuple_EXTRA_HEADERS} ROOT/RPageStorageS3.hxx) | ||
| target_sources(ROOTNTuple PRIVATE src/RPageStorageS3.cxx) | ||
| target_compile_definitions(ROOTNTuple PRIVATE R__ENABLE_S3) |
There was a problem hiding this comment.
Let's wait until we actually need the define.
| /// Serialize the anchor to a JSON string suitable for storage at the base URL | ||
| std::string Serialize() const; | ||
| /// Deserialize the anchor from a JSON string. Returns an error on malformed or incompatible input. | ||
| RResult<void> Deserialize(const std::string &json); |
There was a problem hiding this comment.
I think it is easier to make this method static and return a RResult<RS3NTupleAnchor>. Then we don't need to care about object reset.
| // clang-format on | ||
| struct RS3NTupleAnchor { | ||
| /// Allows evolving the anchor JSON schema in future versions | ||
| std::uint32_t fVersionAnchor = 1; |
There was a problem hiding this comment.
Not sure if we gain anything by reserving version 0. I think we can just start with it.
Test Results 21 files 21 suites 3d 7h 54m 42s ⏱️ For more details on these failures, see this check. Results for commit 3a8cec6. |
3a8cec6 to
77b7180
Compare
77b7180 to
7a7616f
Compare
|
I have made the update according to the comments |
This Pull request:
(Is a part of the GSoC 2026 project
S3 Backend for RNTuple.)Creates the anchor for the S3 backend.
Changes or fixes:
S3NTupleAnchorstruct, using JSON to store the anchor data.ROOT_BUILD_OPTION(s3 OFF "Enable RNTuple support for S3-compatible object storage")to conditionally compile.Checklist: