Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTupleReadOptions.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTupleReadOptions.hxx
2/// \author Jakob Blomer <jblomer@cern.ch>
3/// \date 2024-02-22
4
5/*************************************************************************
6 * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT_RNTupleReadOptions
14#define ROOT_RNTupleReadOptions
15
16#include <cstdint>
17
18namespace ROOT {
19
20class RNTupleReadOptions;
21
22namespace Internal {
23
25public:
26 static unsigned int GetClusterBunchSize(const RNTupleReadOptions &options);
27 static void SetClusterBunchSize(RNTupleReadOptions &options, unsigned int val);
28 static unsigned int GetClusterGroupBudget(const RNTupleReadOptions &options);
29 static void SetClusterGroupBudget(RNTupleReadOptions &options, unsigned int val);
30 static std::uint64_t GetMaxEnvelopeSize(const RNTupleReadOptions &options);
31 static void SetMaxEnvelopeSize(RNTupleReadOptions &options, std::uint64_t val);
32};
33
34} // namespace Internal
35
36// clang-format off
37/**
38\class ROOT::RNTupleReadOptions
39\ingroup NTuple
40\brief Common user-tunable settings for reading RNTuples
41
42All page source classes need to support the common options.
43
44<table>
45<tr>
46<th>Option name</th>
47<th>Type</th>
48<th>Default</th>
49<th>Description</th>
50</tr>
51
52<tr>
53<td>`ClusterCache`</td>
54<td>EClusterCache</td>
55<td>EClusterCache::kDefault</td>
56<td>
57Controls if the prefetcher (including the prefetcher thread) is used
58</td>
59</tr>
60
61<tr>
62<td>`UseImplicitMT`</td>
63<td>EImplicitMT</td>
64<td>EImplicitMT::kDefault</td>
65<td>
66Allows to disable parallel page compression and decompression even if ROOT uses implicit MT.
67This is useful, e.g., in the context of RDataFrame where the threads are fully managed by RDataFrame.
68</td>
69</tr>
70
71<tr>
72<td>`EMetadataMode`</td>
73<td>EMetadataMode</td>
74<td>EMetadataMode::kDefault</td>
75<td>
76Set whether cluster metadata (page locations) are loaded entirely on open or on demand during entry iteration.
77By default, the RNTuple reader loads metadata on demand.
78</td>
79</tr>
80
81<tr>
82<td>`EnableMetrics`</td>
83<td>`bool`</td>
84<td>`false`</td>
85<td>
86If `true`, the RNTupleReader will track metrics straight from its construction, as
87if calling RNTupleReader::EnableMetrics() before having created the object.
88</td>
89</tr>
90</table>
91*/
92// clang-format on
95
96public:
97 enum class EClusterCache {
98 kOff,
99 kOn,
100 kDefault = kOn,
101 };
102
103 enum class EImplicitMT {
104 kOff,
105 kDefault,
106 };
107
108 enum class EMetadataMode {
109 kEager,
110 kOnDemand,
112 };
113
114private:
116 /// The number of cluster to be prefetched in a single batch; this option is transitional and will be replaced
117 /// by an option that allows to control the amount of memory that the prefetcher uses.
118 unsigned int fClusterBunchSize = 1;
119 /// The threshold for the number of concurrently loaded cluster group details as of which the cluster details of the
120 /// least recently used cluster groups are evicted. The budget can be overspent due to pinned cluster groups.
121 /// Currently a private option that cannot be changed by the user.
122 unsigned int fClusterGroupBudget = 2;
125 bool fEnableMetrics = false;
126 /// Largest header or footer envelope a page source will accept from an anchor it does not fully trust,
127 /// such as the S3 anchor, which is a separately stored object. Guards the allocation made from those sizes.
128 std::uint64_t fMaxEnvelopeSize = 1024 * 1024 * 1024;
129
130public:
133
136
139
140 bool GetEnableMetrics() const { return fEnableMetrics; }
141 void SetEnableMetrics(bool val) { fEnableMetrics = val; }
142}; // class RNTupleReadOptions
143
144namespace Internal {
145
147{
148 return options.fClusterBunchSize;
149}
150
152{
153 options.fClusterBunchSize = val;
154}
155
157{
158 return options.fClusterGroupBudget;
159}
160
162{
163 options.fClusterGroupBudget = val;
164}
165
167{
168 return options.fMaxEnvelopeSize;
169}
170
172{
173 options.fMaxEnvelopeSize = val;
174}
175
176} // namespace Internal
177} // namespace ROOT
178
179#endif
static void SetMaxEnvelopeSize(RNTupleReadOptions &options, std::uint64_t val)
static void SetClusterBunchSize(RNTupleReadOptions &options, unsigned int val)
static unsigned int GetClusterBunchSize(const RNTupleReadOptions &options)
static unsigned int GetClusterGroupBudget(const RNTupleReadOptions &options)
static void SetClusterGroupBudget(RNTupleReadOptions &options, unsigned int val)
static std::uint64_t GetMaxEnvelopeSize(const RNTupleReadOptions &options)
Common user-tunable settings for reading RNTuples.
std::uint64_t fMaxEnvelopeSize
Largest header or footer envelope a page source will accept from an anchor it does not fully trust,...
void SetMetadataMode(EMetadataMode val)
EClusterCache GetClusterCache() const
void SetClusterCache(EClusterCache val)
void SetUseImplicitMT(EImplicitMT val)
EImplicitMT GetUseImplicitMT() const
unsigned int fClusterBunchSize
The number of cluster to be prefetched in a single batch; this option is transitional and will be rep...
unsigned int fClusterGroupBudget
The threshold for the number of concurrently loaded cluster group details as of which the cluster det...
EMetadataMode GetMetadataMode() const