Skip to content

Commit ba1cbcf

Browse files
silverweeddpiparo
authored andcommitted
[ntuple] Move RCluster/RClusterPool out of experimental
(cherry picked from commit f0d5bed)
1 parent 6eeb6e5 commit ba1cbcf

15 files changed

+100
-116
lines changed

tree/ntuple/inc/ROOT/RCluster.hxx

+6-11
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@
2626
#include <vector>
2727

2828
namespace ROOT {
29-
namespace Experimental {
3029
namespace Internal {
3130

3231
// clang-format off
3332
/**
34-
\class ROnDiskPage
33+
\class ROOT::Internal::ROnDiskPage
3534
\ingroup NTuple
3635
\brief A page as being stored on disk, that is packed and compressed
3736
@@ -68,16 +67,15 @@ public:
6867
}; // class ROnDiskPage
6968

7069
} // namespace Internal
71-
} // namespace Experimental
7270
} // namespace ROOT
7371

7472
// For hash maps ROnDiskPage::Key --> ROnDiskPage
7573
namespace std
7674
{
7775
template <>
78-
struct hash<ROOT::Experimental::Internal::ROnDiskPage::Key> {
76+
struct hash<ROOT::Internal::ROnDiskPage::Key> {
7977
// TODO(jblomer): quick and dirty hash, likely very sub-optimal, to be revised later.
80-
size_t operator()(const ROOT::Experimental::Internal::ROnDiskPage::Key &key) const
78+
size_t operator()(const ROOT::Internal::ROnDiskPage::Key &key) const
8179
{
8280
return (
8381
(std::hash<ROOT::DescriptorId_t>()(key.fPhysicalColumnId) ^ (hash<ROOT::NTupleSize_t>()(key.fPageNo) << 1)) >>
@@ -86,14 +84,12 @@ struct hash<ROOT::Experimental::Internal::ROnDiskPage::Key> {
8684
};
8785
}
8886

89-
9087
namespace ROOT {
91-
namespace Experimental {
9288
namespace Internal {
9389

9490
// clang-format off
9591
/**
96-
\class ROOT::Experimental::Internal::ROnDiskPageMap
92+
\class ROOT::Internal::ROnDiskPageMap
9793
\ingroup NTuple
9894
\brief A memory region that contains packed and compressed pages
9995
@@ -122,7 +118,7 @@ public:
122118

123119
// clang-format off
124120
/**
125-
\class ROOT::Experimental::Internal::ROnDiskPageMapHeap
121+
\class ROOT::Internal::ROnDiskPageMapHeap
126122
\ingroup NTuple
127123
\brief An ROnDiskPageMap that is used for an fMemory allocated as an array of unsigned char.
128124
*/
@@ -142,7 +138,7 @@ public:
142138

143139
// clang-format off
144140
/**
145-
\class ROOT::Experimental::Internal::RCluster
141+
\class ROOT::Internal::RCluster
146142
\ingroup NTuple
147143
\brief An in-memory subset of the packed and compressed pages of a cluster
148144
@@ -199,7 +195,6 @@ public:
199195
}; // class RCluster
200196

201197
} // namespace Internal
202-
} // namespace Experimental
203198
} // namespace ROOT
204199

205200
#endif

tree/ntuple/inc/ROOT/RClusterPool.hxx

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ namespace Internal {
3333
class RPageSource;
3434
}
3535

36-
namespace Experimental {
3736
namespace Internal {
3837

3938
// clang-format off
4039
/**
41-
\class ROOT::Experimental::Internal::RClusterPool
40+
\class ROOT::Internal::RClusterPool
4241
\ingroup NTuple
4342
\brief Managed a set of clusters containing compressed and packed pages
4443
@@ -142,7 +141,6 @@ public:
142141
}; // class RClusterPool
143142

144143
} // namespace Internal
145-
} // namespace Experimental
146144
} // namespace ROOT
147145

148146
#endif

tree/ntuple/inc/ROOT/RNTupleMerger.hxx

+5-6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class RNTuple;
3232

3333
namespace Internal {
3434
class RPageAllocator;
35+
class RClusterPool;
3536
}
3637

3738
namespace Experimental::Internal {
@@ -59,8 +60,6 @@ struct RColumnMergeInfo;
5960
struct RNTupleMergeData;
6061
struct RSealedPageMergeData;
6162

62-
class RClusterPool;
63-
6463
/// Set of merging options to pass to RNTupleMerger.
6564
/// If you're using the merger through TFileMerger you need to give it string-based options instead.
6665
/// Here is the mapping for the TFileMerger options:
@@ -99,11 +98,11 @@ class RNTupleMerger final {
9998
std::optional<TTaskGroup> fTaskGroup;
10099
std::unique_ptr<ROOT::RNTupleModel> fModel;
101100

102-
void MergeCommonColumns(RClusterPool &clusterPool, const ROOT::RClusterDescriptor &clusterDesc,
101+
void MergeCommonColumns(ROOT::Internal::RClusterPool &clusterPool, const ROOT::RClusterDescriptor &clusterDesc,
103102
std::span<const RColumnMergeInfo> commonColumns,
104-
const RCluster::ColumnSet_t &commonColumnSet, std::size_t nCommonColumnsInCluster,
105-
RSealedPageMergeData &sealedPageData, const RNTupleMergeData &mergeData,
106-
ROOT::Internal::RPageAllocator &pageAlloc);
103+
const ROOT::Internal::RCluster::ColumnSet_t &commonColumnSet,
104+
std::size_t nCommonColumnsInCluster, RSealedPageMergeData &sealedPageData,
105+
const RNTupleMergeData &mergeData, ROOT::Internal::RPageAllocator &pageAlloc);
107106

108107
void MergeSourceClusters(ROOT::Internal::RPageSource &source, std::span<const RColumnMergeInfo> commonColumns,
109108
std::span<const RColumnMergeInfo> extraDstColumns, RNTupleMergeData &mergeData);

tree/ntuple/inc/ROOT/RPageStorage.hxx

+6-7
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ protected:
667667
public:
668668
void Insert(ROOT::DescriptorId_t physicalColumnId, ROOT::Internal::RColumnElementBase::RIdentifier elementId);
669669
void Erase(ROOT::DescriptorId_t physicalColumnId, ROOT::Internal::RColumnElementBase::RIdentifier elementId);
670-
ROOT::Experimental::Internal::RCluster::ColumnSet_t ToColumnSet() const;
670+
ROOT::Internal::RCluster::ColumnSet_t ToColumnSet() const;
671671
bool HasColumnInfos(ROOT::DescriptorId_t physicalColumnId) const
672672
{
673673
return fColumnInfos.count(physicalColumnId) > 0;
@@ -703,7 +703,7 @@ protected:
703703
/// Returns a new, unattached page source for the same data set
704704
virtual std::unique_ptr<RPageSource> CloneImpl() const = 0;
705705
// Only called if a task scheduler is set. No-op be default.
706-
virtual void UnzipClusterImpl(ROOT::Experimental::Internal::RCluster *cluster);
706+
virtual void UnzipClusterImpl(ROOT::Internal::RCluster *cluster);
707707
// Returns a page from storage if not found in the page pool. Should be able to handle zero page locators.
708708
virtual ROOT::Internal::RPageRef
709709
LoadPageImpl(ColumnHandle_t columnHandle, const RClusterInfo &clusterInfo, ROOT::NTupleSize_t idxInCluster) = 0;
@@ -712,8 +712,7 @@ protected:
712712
/// `kTypePageZero` locator are filled in `pageZeroMap`; otherwise, `perPageFunc` is called for each page. This is
713713
/// commonly used as part of `LoadClusters()` in derived classes.
714714
void PrepareLoadCluster(
715-
const ROOT::Experimental::Internal::RCluster::RKey &clusterKey,
716-
ROOT::Experimental::Internal::ROnDiskPageMap &pageZeroMap,
715+
const ROOT::Internal::RCluster::RKey &clusterKey, ROOT::Internal::ROnDiskPageMap &pageZeroMap,
717716
std::function<void(ROOT::DescriptorId_t, ROOT::NTupleSize_t, const ROOT::RClusterDescriptor::RPageInfo &)>
718717
perPageFunc);
719718

@@ -805,15 +804,15 @@ public:
805804
/// for the cluster would assume an incomplete cluster and trigger loading again.
806805
/// `LoadClusters()` is typically called from the I/O thread of a cluster pool, i.e. the method runs
807806
/// concurrently to other methods of the page source.
808-
virtual std::vector<std::unique_ptr<ROOT::Experimental::Internal::RCluster>>
809-
LoadClusters(std::span<ROOT::Experimental::Internal::RCluster::RKey> clusterKeys) = 0;
807+
virtual std::vector<std::unique_ptr<ROOT::Internal::RCluster>>
808+
LoadClusters(std::span<ROOT::Internal::RCluster::RKey> clusterKeys) = 0;
810809

811810
/// Parallel decompression and unpacking of the pages in the given cluster. The unzipped pages are supposed
812811
/// to be preloaded in a page pool attached to the source. The method is triggered by the cluster pool's
813812
/// unzip thread. It is an optional optimization, the method can safely do nothing. In particular, the
814813
/// actual implementation will only run if a task scheduler is set. In practice, a task scheduler is set
815814
/// if implicit multi-threading is turned on.
816-
void UnzipCluster(ROOT::Experimental::Internal::RCluster *cluster);
815+
void UnzipCluster(ROOT::Internal::RCluster *cluster);
817816

818817
// TODO(gparolini): for symmetry with SealPage(), we should either make this private or SealPage() public.
819818
RResult<ROOT::Internal::RPage>

tree/ntuple/inc/ROOT/RPageStorageDaos.hxx

+9-5
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@
3131
#include <optional>
3232

3333
namespace ROOT {
34-
namespace Experimental {
3534

3635
namespace Internal {
37-
using ntuple_index_t = std::uint32_t;
3836
class RCluster;
3937
class RClusterPool;
38+
} // namespace Internal
39+
40+
namespace Experimental {
41+
namespace Internal {
42+
using ntuple_index_t = std::uint32_t;
4043
class RDaosPool;
4144
class RDaosContainer;
4245
class RPageAllocatorHeap;
@@ -151,13 +154,13 @@ private:
151154
ntuple_index_t fNTupleIndex{0};
152155

153156
/// The last cluster from which a page got loaded. Points into fClusterPool->fPool
154-
RCluster *fCurrentCluster = nullptr;
157+
ROOT::Internal::RCluster *fCurrentCluster = nullptr;
155158
/// A container that stores object data (header/footer, pages, etc.)
156159
std::unique_ptr<RDaosContainer> fDaosContainer;
157160
/// A URI to a DAOS pool of the form 'daos://pool-label/container-label'
158161
std::string fURI;
159162
/// The cluster pool asynchronously preloads the next few clusters
160-
std::unique_ptr<RClusterPool> fClusterPool;
163+
std::unique_ptr<ROOT::Internal::RClusterPool> fClusterPool;
161164

162165
ROOT::Internal::RNTupleDescriptorBuilder fDescriptorBuilder;
163166

@@ -177,7 +180,8 @@ public:
177180
void
178181
LoadSealedPage(ROOT::DescriptorId_t physicalColumnId, RNTupleLocalIndex localIndex, RSealedPage &sealedPage) final;
179182

180-
std::vector<std::unique_ptr<RCluster>> LoadClusters(std::span<RCluster::RKey> clusterKeys) final;
183+
std::vector<std::unique_ptr<ROOT::Internal::RCluster>>
184+
LoadClusters(std::span<ROOT::Internal::RCluster::RKey> clusterKeys) final;
181185

182186
/// Return the object class used for user data OIDs in this ntuple.
183187
std::string GetObjectClass() const;

tree/ntuple/inc/ROOT/RPageStorageFile.hxx

+7-11
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ namespace ROOT {
3535
class RNTuple; // for making RPageSourceFile a friend of RNTuple
3636
class RNTupleLocator;
3737

38-
namespace Experimental::Internal {
39-
class RClusterPool;
40-
}
41-
4238
namespace Internal {
39+
class RClusterPool;
4340
class RRawFile;
4441
class RPageAllocatorHeap;
4542

@@ -131,15 +128,15 @@ private:
131128
/// Either provided by CreateFromAnchor, or read from the ROOT file given the ntuple name
132129
std::optional<RNTuple> fAnchor;
133130
/// The last cluster from which a page got loaded. Points into fClusterPool->fPool
134-
ROOT::Experimental::Internal::RCluster *fCurrentCluster = nullptr;
131+
ROOT::Internal::RCluster *fCurrentCluster = nullptr;
135132
/// An RRawFile is used to request the necessary byte ranges from a local or a remote file
136133
std::unique_ptr<RRawFile> fFile;
137134
/// Takes the fFile to read ntuple blobs from it
138135
ROOT::Internal::RMiniFileReader fReader;
139136
/// The descriptor is created from the header and footer either in AttachImpl or in CreateFromAnchor
140137
RNTupleDescriptorBuilder fDescriptorBuilder;
141138
/// The cluster pool asynchronously preloads the next few clusters
142-
std::unique_ptr<ROOT::Experimental::Internal::RClusterPool> fClusterPool;
139+
std::unique_ptr<ROOT::Internal::RClusterPool> fClusterPool;
143140
/// Populated by LoadStructureImpl(), reset at the end of Attach()
144141
RStructureBuffer fStructureBuffer;
145142

@@ -149,9 +146,8 @@ private:
149146
/// read requests for a given cluster and columns. The reead requests are appended to
150147
/// the provided vector. This way, requests can be collected for multiple clusters before
151148
/// sending them to RRawFile::ReadV().
152-
std::unique_ptr<ROOT::Experimental::Internal::RCluster>
153-
PrepareSingleCluster(const ROOT::Experimental::Internal::RCluster::RKey &clusterKey,
154-
std::vector<RRawFile::RIOVec> &readRequests);
149+
std::unique_ptr<ROOT::Internal::RCluster>
150+
PrepareSingleCluster(const ROOT::Internal::RCluster::RKey &clusterKey, std::vector<RRawFile::RIOVec> &readRequests);
155151

156152
protected:
157153
void LoadStructureImpl() final;
@@ -180,8 +176,8 @@ public:
180176
void
181177
LoadSealedPage(ROOT::DescriptorId_t physicalColumnId, RNTupleLocalIndex localIndex, RSealedPage &sealedPage) final;
182178

183-
std::vector<std::unique_ptr<ROOT::Experimental::Internal::RCluster>>
184-
LoadClusters(std::span<ROOT::Experimental::Internal::RCluster::RKey> clusterKeys) final;
179+
std::vector<std::unique_ptr<ROOT::Internal::RCluster>>
180+
LoadClusters(std::span<ROOT::Internal::RCluster::RKey> clusterKeys) final;
185181
}; // class RPageSourceFile
186182

187183
} // namespace Internal

tree/ntuple/src/RCluster.cxx

+6-7
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,31 @@
2020
#include <iterator>
2121
#include <utility>
2222

23-
ROOT::Experimental::Internal::ROnDiskPageMap::~ROnDiskPageMap() = default;
23+
ROOT::Internal::ROnDiskPageMap::~ROnDiskPageMap() = default;
2424

2525
////////////////////////////////////////////////////////////////////////////////
2626

27-
ROOT::Experimental::Internal::ROnDiskPageMapHeap::~ROnDiskPageMapHeap() = default;
27+
ROOT::Internal::ROnDiskPageMapHeap::~ROnDiskPageMapHeap() = default;
2828

2929
////////////////////////////////////////////////////////////////////////////////
3030

31-
const ROOT::Experimental::Internal::ROnDiskPage *
32-
ROOT::Experimental::Internal::RCluster::GetOnDiskPage(const ROnDiskPage::Key &key) const
31+
const ROOT::Internal::ROnDiskPage *ROOT::Internal::RCluster::GetOnDiskPage(const ROnDiskPage::Key &key) const
3332
{
3433
const auto itr = fOnDiskPages.find(key);
3534
if (itr != fOnDiskPages.end())
3635
return &(itr->second);
3736
return nullptr;
3837
}
3938

40-
void ROOT::Experimental::Internal::RCluster::Adopt(std::unique_ptr<ROnDiskPageMap> pageMap)
39+
void ROOT::Internal::RCluster::Adopt(std::unique_ptr<ROnDiskPageMap> pageMap)
4140
{
4241
auto &pages = pageMap->fOnDiskPages;
4342
fOnDiskPages.insert(std::make_move_iterator(pages.begin()), std::make_move_iterator(pages.end()));
4443
pageMap->fOnDiskPages.clear();
4544
fPageMaps.emplace_back(std::move(pageMap));
4645
}
4746

48-
void ROOT::Experimental::Internal::RCluster::Adopt(RCluster &&other)
47+
void ROOT::Internal::RCluster::Adopt(RCluster &&other)
4948
{
5049
R__ASSERT(fClusterId == other.fClusterId);
5150

@@ -60,7 +59,7 @@ void ROOT::Experimental::Internal::RCluster::Adopt(RCluster &&other)
6059
other.fPageMaps.clear();
6160
}
6261

63-
void ROOT::Experimental::Internal::RCluster::SetColumnAvailable(ROOT::DescriptorId_t physicalColumnId)
62+
void ROOT::Internal::RCluster::SetColumnAvailable(ROOT::DescriptorId_t physicalColumnId)
6463
{
6564
fAvailPhysicalColumns.insert(physicalColumnId);
6665
}

0 commit comments

Comments
 (0)