66// / is welcome!
77
88/* ************************************************************************
9- * Copyright (C) 1995-2020 , Rene Brun and Fons Rademakers. *
9+ * Copyright (C) 1995-2021 , Rene Brun and Fons Rademakers. *
1010 * All rights reserved. *
1111 * *
1212 * For the licensing terms see $ROOTSYS/LICENSE. *
@@ -41,14 +41,14 @@ class RDaosContainer;
4141
4242// clang-format off
4343/* *
44- \class ROOT::Experimental::RDaosNTuple
44+ \class ROOT::Experimental::Detail::RDaosNTupleAnchor
4545\ingroup NTuple
4646\brief Entry point for an RNTuple in a DAOS container. It encodes essential
4747information to read the ntuple; currently, it contains (un)compressed size of
4848the header/footer blobs.
4949*/
5050// clang-format on
51- struct RDaosNTuple {
51+ struct RDaosNTupleAnchor {
5252 // / Allows for evolving the struct in future versions
5353 std::uint32_t fVersion = 0 ;
5454 // / The size of the compressed ntuple header
@@ -59,16 +59,13 @@ struct RDaosNTuple {
5959 std::uint32_t fNBytesFooter = 0 ;
6060 // / The size of the uncompressed ntuple footer
6161 std::uint32_t fLenFooter = 0 ;
62- // / Currently unused, reserved for later use
63- std::uint64_t fReserved = 0 ;
6462
65- bool operator ==(const RDaosNTuple &other) const {
63+ bool operator ==(const RDaosNTupleAnchor &other) const {
6664 return fVersion == other.fVersion &&
6765 fNBytesHeader == other.fNBytesHeader &&
6866 fLenHeader == other.fLenHeader &&
6967 fNBytesFooter == other.fNBytesFooter &&
70- fLenFooter == other.fLenFooter &&
71- fReserved == other.fReserved ;
68+ fLenFooter == other.fLenFooter ;
7269 }
7370};
7471
@@ -88,31 +85,29 @@ private:
8885 RNTupleMetrics fMetrics ;
8986 std::unique_ptr<RPageAllocatorHeap> fPageAllocator ;
9087
91- std::shared_ptr<RDaosPool> fDaosPool ;
88+ // / \brief Underlying DAOS container. An internal `std::shared_ptr` keep the pool connection alive.
89+ // / ISO C++ ensures the correct destruction order, i.e., `~RDaosContainer` is invoked first
90+ // / (which calls `daos_cont_close()`; the destructor for the `std::shared_ptr<RDaosPool>` is invoked
91+ // / after (which calls `daos_pool_disconect()`).
9292 std::unique_ptr<RDaosContainer> fDaosContainer ;
93- // / A URI to a DAOS pool of the form 'daos://pool-uuid:svc_replicas/container-uuid'
94- std::string fLocator ;
93+ // / \brief A URI to a DAOS pool of the form 'daos://pool-uuid:svc_replicas/container-uuid'
94+ std::string fURI ;
9595
96- RDaosNTuple fNTupleAnchor ;
97- // FIXME: do we really need these data members?
98- // / Byte offset of the first page of the current cluster
99- std::uint64_t fClusterMinOffset = std::uint64_t (-1 );
100- // / Byte offset of the end of the last page of the current cluster
101- std::uint64_t fClusterMaxOffset = 0 ;
102- // / Helper for zipping keys and header / footer; comprises a 16MB zip buffer
103- RNTupleCompressor fCompressor ;
96+ RDaosNTupleAnchor fNTupleAnchor ;
10497
10598protected:
10699 void CreateImpl (const RNTupleModel &model) final ;
107100 RClusterDescriptor::RLocator CommitPageImpl (ColumnHandle_t columnHandle, const RPage &page) final ;
101+ RClusterDescriptor::RLocator CommitSealedPageImpl (DescriptorId_t columnId,
102+ const RPageStorage::RSealedPage &sealedPage) final ;
108103 RClusterDescriptor::RLocator CommitClusterImpl (NTupleSize_t nEntries) final ;
109104 void CommitDatasetImpl () final ;
110105 void WriteNTupleHeader (const void *data, size_t nbytes, size_t lenHeader);
111106 void WriteNTupleFooter (const void *data, size_t nbytes, size_t lenFooter);
112107 void WriteNTupleAnchor ();
113108
114109public:
115- RPageSinkDaos (std::string_view ntupleName, std::string_view locator , const RNTupleWriteOptions &options);
110+ RPageSinkDaos (std::string_view ntupleName, std::string_view uri , const RNTupleWriteOptions &options);
116111 virtual ~RPageSinkDaos ();
117112
118113 RPage ReservePage (ColumnHandle_t columnHandle, std::size_t nElements = 0 ) final ;
@@ -144,11 +139,6 @@ public:
144139*/
145140// clang-format on
146141class RPageSourceDaos : public RPageSource {
147- public:
148- // FIXME: this value probably needs to match DAOS object size limit.
149- // / Cannot process pages larger than 1MB
150- static constexpr std::size_t kMaxPageSize = 1024 * 1024 ;
151-
152142private:
153143 // / I/O performance counters that get registered in fMetrics
154144 struct RCounters {
@@ -168,32 +158,29 @@ private:
168158 // / Wraps the I/O counters and is observed by the RNTupleReader metrics
169159 RNTupleMetrics fMetrics ;
170160
171- // / Populated pages might be shared; there memory buffer is managed by the RPageAllocatorDaos
161+ // / Populated pages might be shared; the memory buffer is managed by the RPageAllocatorDaos
172162 std::unique_ptr<RPageAllocatorDaos> fPageAllocator ;
173163 // TODO: the page pool should probably be handled by the base class.
174164 // / The page pool might, at some point, be used by multiple page sources
175165 std::shared_ptr<RPagePool> fPagePool ;
176166 // / The last cluster from which a page got populated. Points into fClusterPool->fPool
177167 RCluster *fCurrentCluster = nullptr ;
178- // / Helper to unzip pages and header/footer; comprises a 16MB unzip buffer
179- RNTupleDecompressor fDecompressor ;
180- // / A connection to a DAOS pool
181- std::shared_ptr<RDaosPool> fDaosPool ;
182168 // / A container that stores object data (header/footer, pages, etc.)
183169 std::unique_ptr<RDaosContainer> fDaosContainer ;
184170 // / A URI to a DAOS pool of the form 'daos://pool-uuid:svc_replicas/container-uuid'
185- std::string fLocator ;
171+ std::string fURI ;
186172 // / The cluster pool asynchronously preloads the next few clusters
187173 std::unique_ptr<RClusterPool> fClusterPool ;
188174
189175 RPage PopulatePageFromCluster (ColumnHandle_t columnHandle, const RClusterDescriptor &clusterDescriptor,
190- ClusterSize_t::ValueType clusterIndex );
176+ ClusterSize_t::ValueType idxInCluster );
191177
192178protected:
193179 RNTupleDescriptor AttachImpl () final ;
180+ void UnzipClusterImpl (RCluster *cluster) final ;
194181
195182public:
196- RPageSourceDaos (std::string_view ntupleName, std::string_view locator , const RNTupleReadOptions &options);
183+ RPageSourceDaos (std::string_view ntupleName, std::string_view uri , const RNTupleReadOptions &options);
197184 // / The cloned page source creates a new connection to the pool/container.
198185 // / The meta-data (header and footer) is reread and parsed by the clone.
199186 std::unique_ptr<RPageSource> Clone () const final ;
@@ -203,6 +190,9 @@ public:
203190 RPage PopulatePage (ColumnHandle_t columnHandle, const RClusterIndex &clusterIndex) final ;
204191 void ReleasePage (RPage &page) final ;
205192
193+ void LoadSealedPage (DescriptorId_t columnId, const RClusterIndex &clusterIndex,
194+ RSealedPage &sealedPage) final ;
195+
206196 std::unique_ptr<RCluster> LoadCluster (DescriptorId_t clusterId, const ColumnSet_t &columns) final ;
207197
208198 RNTupleMetrics &GetMetrics () final { return fMetrics ; }
0 commit comments