15#include <nlohmann/json.hpp>
39 jsonAnchor[
"formatVersionEpoch"] = fVersionEpoch;
40 jsonAnchor[
"formatVersionMajor"] = fVersionMajor;
41 jsonAnchor[
"formatVersionMinor"] = fVersionMinor;
42 jsonAnchor[
"formatVersionPatch"] = fVersionPatch;
65 }
catch (
const nlohmann::json::parse_error &
e) {
66 return R__FAIL(
"cannot parse S3 anchor JSON: " + std::string(
e.what()));
73 }
catch (
const nlohmann::json::exception &
e) {
74 return R__FAIL(
"missing or invalid 'anchorVersion' in S3 anchor: " + std::string(
e.what()));
78 return R__FAIL(
"unsupported S3 anchor version: " + std::to_string(
anchor.fVersionAnchor));
81 anchor.fVersionEpoch =
jsonAnchor.at(
"formatVersionEpoch").get<std::uint16_t>();
82 anchor.fVersionMajor =
jsonAnchor.at(
"formatVersionMajor").get<std::uint16_t>();
83 anchor.fVersionMinor =
jsonAnchor.at(
"formatVersionMinor").get<std::uint16_t>();
84 anchor.fVersionPatch =
jsonAnchor.at(
"formatVersionPatch").get<std::uint16_t>();
94 }
catch (
const nlohmann::json::exception &
e) {
95 return R__FAIL(
"missing or invalid field in S3 anchor: " + std::string(
e.what()));
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
Entry point for an RNTuple stored in S3-compatible object storage.
std::uint16_t fVersionMinor
bool operator==(const RNTupleAnchorS3 &other) const
Field-by-field equality check across all 14 anchor members.
std::uint64_t fHeaderObjId
Object ID and byte offset of the compressed header within the S3 object.
std::string fUrlTemplate
Pattern for resolving object IDs to full S3 URLs.
std::uint32_t fVersionAnchor
Allows evolving the anchor JSON schema in future versions.
std::uint16_t fVersionPatch
std::uint16_t fVersionEpoch
Version of the RNTuple binary format supported by the writer.
std::uint64_t fNBytesHeader
Compressed and uncompressed sizes of the header envelope.
std::string ToJSON() const
Serialize the anchor to a JSON string suitable for storage at the base URL.
std::uint64_t fHeaderOffset
std::uint64_t fFooterOffset
std::uint64_t fNBytesFooter
Compressed and uncompressed sizes of the footer envelope.
static RResult< RNTupleAnchorS3 > CreateFromJSON(const std::string &json)
Deserialize the anchor from a JSON string. Returns an error on malformed or incompatible input.
std::uint64_t fFooterObjId
Object ID and byte offset of the compressed footer within the S3 object.
std::uint16_t fVersionMajor