File indexing completed on 2025-09-17 09:14:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROOT_RPageStorageDaos
0017 #define ROOT_RPageStorageDaos
0018
0019 #include <ROOT/RError.hxx>
0020 #include <ROOT/RPageStorage.hxx>
0021 #include <ROOT/RNTuple.hxx>
0022 #include <ROOT/RNTupleSerialize.hxx>
0023 #include <ROOT/RNTupleZip.hxx>
0024 #include <string_view>
0025
0026 #include <array>
0027 #include <atomic>
0028 #include <cstdio>
0029 #include <memory>
0030 #include <string>
0031 #include <optional>
0032
0033 namespace ROOT {
0034
0035 namespace Internal {
0036 class RCluster;
0037 class RClusterPool;
0038 }
0039
0040 namespace Experimental {
0041 namespace Internal {
0042 using ntuple_index_t = std::uint32_t;
0043 class RDaosPool;
0044 class RDaosContainer;
0045 class RPageAllocatorHeap;
0046 enum EDaosLocatorFlags {
0047
0048 kCagedPage = 0x01,
0049 };
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 struct RDaosNTupleAnchor {
0062
0063 std::uint64_t fVersionAnchor = 1;
0064
0065 std::uint16_t fVersionEpoch = RNTuple::kVersionEpoch;
0066 std::uint16_t fVersionMajor = RNTuple::kVersionMajor;
0067 std::uint16_t fVersionMinor = RNTuple::kVersionMinor;
0068 std::uint16_t fVersionPatch = RNTuple::kVersionPatch;
0069
0070 std::uint32_t fNBytesHeader = 0;
0071
0072 std::uint32_t fLenHeader = 0;
0073
0074 std::uint32_t fNBytesFooter = 0;
0075
0076 std::uint32_t fLenFooter = 0;
0077
0078 std::string fObjClass{};
0079
0080 bool operator ==(const RDaosNTupleAnchor &other) const {
0081 return fVersionAnchor == other.fVersionAnchor && fVersionEpoch == other.fVersionEpoch &&
0082 fVersionMajor == other.fVersionMajor && fVersionMinor == other.fVersionMinor &&
0083 fVersionPatch == other.fVersionPatch && fNBytesHeader == other.fNBytesHeader &&
0084 fLenHeader == other.fLenHeader && fNBytesFooter == other.fNBytesFooter && fLenFooter == other.fLenFooter &&
0085 fObjClass == other.fObjClass;
0086 }
0087
0088 std::uint32_t Serialize(void *buffer) const;
0089 RResult<std::uint32_t> Deserialize(const void *buffer, std::uint32_t bufSize);
0090
0091 static std::uint32_t GetSize();
0092 };
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104 class RPageSinkDaos : public ROOT::Internal::RPagePersistentSink {
0105 private:
0106
0107
0108
0109
0110 std::unique_ptr<RDaosContainer> fDaosContainer;
0111
0112 std::atomic<std::uint64_t> fPageId{0};
0113
0114 std::atomic<std::uint64_t> fClusterGroupId{0};
0115
0116 std::string fURI;
0117
0118 std::uint64_t fNBytesCurrentCluster{0};
0119
0120 RDaosNTupleAnchor fNTupleAnchor;
0121 ntuple_index_t fNTupleIndex{0};
0122 uint32_t fCageSizeLimit{};
0123
0124 protected:
0125 using RPagePersistentSink::InitImpl;
0126 void InitImpl(unsigned char *serializedHeader, std::uint32_t length) final;
0127 RNTupleLocator CommitPageImpl(ColumnHandle_t columnHandle, const ROOT::Internal::RPage &page) final;
0128 RNTupleLocator
0129 CommitSealedPageImpl(ROOT::DescriptorId_t physicalColumnId, const RPageStorage::RSealedPage &sealedPage) final;
0130 std::vector<RNTupleLocator>
0131 CommitSealedPageVImpl(std::span<RPageStorage::RSealedPageGroup> ranges, const std::vector<bool> &mask) final;
0132 std::uint64_t StageClusterImpl() final;
0133 RNTupleLocator CommitClusterGroupImpl(unsigned char *serializedPageList, std::uint32_t length) final;
0134 using RPagePersistentSink::CommitDatasetImpl;
0135 void CommitDatasetImpl(unsigned char *serializedFooter, std::uint32_t length) final;
0136 void WriteNTupleHeader(const void *data, size_t nbytes, size_t lenHeader);
0137 void WriteNTupleFooter(const void *data, size_t nbytes, size_t lenFooter);
0138 void WriteNTupleAnchor();
0139
0140 public:
0141 RPageSinkDaos(std::string_view ntupleName, std::string_view uri, const ROOT::RNTupleWriteOptions &options);
0142 ~RPageSinkDaos() override;
0143 };
0144
0145
0146
0147
0148
0149
0150
0151
0152 class RPageSourceDaos : public ROOT::Internal::RPageSource {
0153 private:
0154 ntuple_index_t fNTupleIndex{0};
0155
0156
0157 ROOT::Internal::RCluster *fCurrentCluster = nullptr;
0158
0159 std::unique_ptr<RDaosContainer> fDaosContainer;
0160
0161 std::string fURI;
0162
0163 std::unique_ptr<ROOT::Internal::RClusterPool> fClusterPool;
0164
0165 ROOT::Internal::RNTupleDescriptorBuilder fDescriptorBuilder;
0166
0167 ROOT::Internal::RPageRef
0168 LoadPageImpl(ColumnHandle_t columnHandle, const RClusterInfo &clusterInfo, ROOT::NTupleSize_t idxInCluster) final;
0169
0170 protected:
0171 void LoadStructureImpl() final {}
0172 ROOT::RNTupleDescriptor AttachImpl(ROOT::Internal::RNTupleSerializer::EDescriptorDeserializeMode mode) final;
0173
0174 std::unique_ptr<RPageSource> CloneImpl() const final;
0175
0176 public:
0177 RPageSourceDaos(std::string_view ntupleName, std::string_view uri, const ROOT::RNTupleReadOptions &options);
0178 ~RPageSourceDaos() override;
0179
0180 void
0181 LoadSealedPage(ROOT::DescriptorId_t physicalColumnId, RNTupleLocalIndex localIndex, RSealedPage &sealedPage) final;
0182
0183 std::vector<std::unique_ptr<ROOT::Internal::RCluster>>
0184 LoadClusters(std::span<ROOT::Internal::RCluster::RKey> clusterKeys) final;
0185
0186
0187 std::string GetObjectClass() const;
0188 };
0189
0190 }
0191
0192 }
0193 }
0194
0195 #endif