42#include <unordered_map>
92 return R__FAIL(
"page checksum verification failed, data corruption detected");
99 return R__FAIL(
"invalid attempt to extract non-existing page checksum");
101 assert(fBufferSize >= kNBytesPageChecksum);
104 reinterpret_cast<const unsigned char *
>(
fBuffer) + fBufferSize - kNBytesPageChecksum,
checksum);
128 for (std::size_t i = 0; i <
itr->second.size(); ++i) {
132 itr->second[i].fRefCounter--;
133 if (
itr->second[i].fRefCounter == 0) {
135 if (
itr->second.empty()) {
136 fColumnInfos.erase(
itr);
162 if (
clusterDesc.GetFirstEntryIndex() >= (fFirstEntry + fNEntries))
177std::unique_ptr<ROOT::Internal::RPageSource>
184 if (location.empty()) {
187 if (location.find(
"daos://") == 0)
189 return std::make_unique<ROOT::Experimental::Internal::RPageSourceDaos>(
ntupleName, location, options);
194 return std::make_unique<ROOT::Internal::RPageSourceFile>(
ntupleName, location, options);
215 if ((
range.fFirstEntry +
range.fNEntries) > GetNEntries()) {
225 fHasStructure =
true;
232 GetExclDescriptorGuard().MoveIn(AttachImpl(
mode));
238 auto clone = CloneImpl();
240 clone->GetExclDescriptorGuard().MoveIn(GetSharedDescriptorGuard()->Clone());
241 clone->fHasStructure =
true;
242 clone->fIsAttached =
true;
249 return GetSharedDescriptorGuard()->GetNEntries();
254 return GetSharedDescriptorGuard()->GetNElements(
columnHandle.fPhysicalId);
265 RNTupleAtomicTimer
timer(fCounters->fTimeWallUnzip, fCounters->fTimeCpuUnzip);
275 std::vector<std::unique_ptr<RColumnElementBase>>
allElements;
281 if (!fActivePhysicalColumns.HasColumnInfos(
columnId))
292 for (
const auto &pi :
pageRange.GetPageInfos()) {
297 sealedPage.SetBufferSize(pi.GetLocator().GetNBytesOnStorage() + pi.HasChecksum() * kNBytesPageChecksum);
324 fCounters->fNPageUnsealed.Add(
pageNo);
328 fTaskScheduler->Wait();
331 throw RException(
R__FAIL(
"page checksum verification failed, data corruption detected"));
353 pageInfo.GetLocator().GetNBytesOnStorage()));
368 GetSharedDescriptorGuard()->GetClusterDescriptor(
clusterId).GetFirstEntryIndex();
369 auto itr = fPreloadedClusters.
begin();
371 if (fPinnedClusters.count(
itr->second) > 0) {
374 fPagePool.Evict(
itr->second);
375 itr = fPreloadedClusters.erase(
itr);
379 while ((
itr != fPreloadedClusters.
end()) &&
384 while (
itr != fPreloadedClusters.
end()) {
385 if (fPinnedClusters.count(
itr->second) > 0) {
388 fPagePool.Evict(
itr->second);
389 itr = fPreloadedClusters.erase(
itr);
404 UpdateLastUsedCluster(
cachedPageRef.Get().GetClusterInfo().GetId());
475 fMetrics.ObserveMetrics(fClusterPool.GetMetrics());
476 fMetrics.ObserveMetrics(fPagePool.GetMetrics());
477 fCounters = std::make_unique<RCounters>(
RCounters{
480 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"szReadPayload",
"B",
"volume read from storage (required)"),
481 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"szReadOverhead",
"B",
"volume read from storage (overhead)"),
484 "number of partial clusters preloaded from storage"),
485 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"nPageRead",
"",
"number of pages read from storage"),
486 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"nPageUnsealed",
"",
"number of pages unzipped and decoded"),
487 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"timeWallRead",
"ns",
"wall clock time spent reading"),
488 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"timeWallUnzip",
"ns",
"wall clock time spent decompressing"),
491 "CPU time spent decompressing"),
493 "bwRead",
"MB/s",
"bandwidth compressed bytes read per second", fMetrics,
510 "bwReadUnzip",
"MB/s",
"bandwidth uncompressed bytes read per second", fMetrics,
524 "bwUnzip",
"MB/s",
"decompression bandwidth of uncompressed bytes per second", fMetrics,
538 "rtReadEfficiency",
"",
"ratio of payload over all bytes read", fMetrics,
544 return {
true, 1. / (1. + (1. *
szReadOverhead->GetValueAsInt()) / payload)};
550 *fMetrics.MakeCounter<
RNTupleCalcPerf *>(
"rtCompression",
"",
"ratio of compressed bytes / uncompressed bytes",
553 metrics.GetLocalCounter(
"szReadPayload")) {
611 if (fHasStreamerInfosRegistered)
614 for (
const auto &
extraTypeInfo : fDescriptor.GetExtraTypeInfoIterable()) {
622 fHasStreamerInfosRegistered =
true;
630 if (fCurrentPageSize ==
other.fCurrentPageSize)
631 return fColumn->GetOnDiskId() >
other.fColumn->GetOnDiskId();
632 return fCurrentPageSize >
other.fCurrentPageSize;
640 auto itr = fColumnsSortedByPageSize.
begin();
641 while (
itr != fColumnsSortedByPageSize.
end()) {
644 if (
itr->fCurrentPageSize ==
itr->fInitialPageSize) {
653 if (
itr != fColumnsSortedByPageSize.
end())
662 itr = fColumnsSortedByPageSize.find(next);
671 auto itr = fColumnsSortedByPageSize.find(key);
672 if (
itr == fColumnsSortedByPageSize.
end()) {
686 fColumnsSortedByPageSize.erase(
itr);
692 fColumnsSortedByPageSize.insert(
elem);
701 fColumnsSortedByPageSize.insert(
elem);
706 fColumnsSortedByPageSize.insert(
elem);
713 :
RPageStorage(
name), fOptions(options.Clone()), fWritePageMemoryManager(options.GetPageBufferBudget())
726 unsigned char *
pageBuf =
reinterpret_cast<unsigned char *
>(config.
fPage->GetBuffer());
731 if (!config.
fElement->IsMappable()) {
760 const auto nBytes =
page.GetNBytes() + GetWriteOptions().GetEnablePageChecksums() * kNBytesPageChecksum;
761 if (fSealPageBuffer.size() <
nBytes)
762 fSealPageBuffer.resize(
nBytes);
768 config.
fWriteChecksum = GetWriteOptions().GetEnablePageChecksums();
770 config.
fBuffer = fSealPageBuffer.data();
772 return SealPage(config);
777 for (
const auto &
cb : fOnDatasetCommitCallbacks)
779 return CommitDatasetImpl();
794std::unique_ptr<ROOT::Internal::RPageSink>
801 if (location.empty()) {
804 if (location.find(
"daos://") == 0) {
806 return std::make_unique<ROOT::Experimental::Internal::RPageSinkDaos>(
ntupleName, location, options);
813 return std::make_unique<ROOT::Internal::RPageSinkFile>(
ntupleName, location, options);
827 auto columnId = fDescriptorBuilder.GetDescriptor().GetNPhysicalColumns();
842 fDescriptorBuilder.AddColumn(
columnBuilder.MakeDescriptor().Unwrap());
849 if (fIsInitialized) {
857 const auto &
descriptor = fDescriptorBuilder.GetDescriptor();
863 const auto &
reps =
f.GetColumnRepresentatives();
866 return reps.size() *
reps[0].size();
880 fDescriptorBuilder.AddFieldLink(
f.GetParent()->GetOnDiskId(),
fieldId);
889 fDescriptorBuilder.AddFieldLink(
f.GetParent()->GetOnDiskId(),
fieldId);
896 .PhysicalColumnId(
source.GetLogicalId())
898 .BitsOnStorage(
source.GetBitsOnStorage())
899 .ValueRange(
source.GetValueRange())
902 .RepresentationIndex(
source.GetRepresentationIndex());
903 fDescriptorBuilder.AddColumn(
columnBuilder.MakeDescriptor().Unwrap());
914 for (
auto f :
changeset.fAddedProjectedFields) {
931 columnRange.SetCompressionSettings(GetWriteOptions().GetCompression());
935 fOpenPageRanges.emplace_back(std::move(
pageRange));
940 if (fSerializationContext.GetHeaderSize() > 0)
941 fSerializationContext.MapSchema(
descriptor,
true);
947 throw RException(
R__FAIL(
"ROOT bug: unexpected type extra info in UpdateExtraTypeInfo()"));
954 fDescriptorBuilder.SetNTuple(fNTupleName, model.
GetDescription());
955 const auto &
descriptor = fDescriptorBuilder.GetDescriptor();
965 for (
auto f :
fieldZero.GetMutableSubfields())
975 InitImpl(buffer.get(), fSerializationContext.GetHeaderSize());
977 fDescriptorBuilder.BeginHeaderExtension();
980std::unique_ptr<ROOT::RNTupleModel>
985 const auto &
descriptor = fDescriptorBuilder.GetDescriptor();
989 R__ASSERT(fOpenColumnRanges.empty() && fOpenPageRanges.empty());
990 fOpenColumnRanges.reserve(
nColumns);
993 const auto &column =
descriptor.GetColumnDescriptor(i);
996 columnRange.SetFirstElementIndex(column.GetFirstElementIndex());
998 columnRange.SetCompressionSettings(GetWriteOptions().GetCompression());
1002 fOpenPageRanges.emplace_back(std::move(
pageRange));
1011 for (
unsigned int i = 0; i < fOpenColumnRanges.size(); ++i) {
1012 R__ASSERT(fOpenColumnRanges[i].GetPhysicalColumnId() == i);
1013 if (!
cluster.ContainsColumn(i))
1018 fOpenColumnRanges[i].IncrementFirstElementIndex(
columnRange.GetNElements());
1020 fDescriptorBuilder.AddCluster(
cluster.Clone());
1029 modelOpts.SetReconstructProjections(
true);
1035 projectedFields.GetFieldZero().SetOnDiskId(model->GetConstFieldZero().GetOnDiskId());
1042 InitImpl(buffer.get(), fSerializationContext.GetHeaderSize());
1044 fDescriptorBuilder.BeginHeaderExtension();
1047 fIsInitialized =
true;
1054 fOpenColumnRanges.at(
columnHandle.fPhysicalId).SetIsSuppressed(
true);
1059 fOpenColumnRanges.at(
columnHandle.fPhysicalId).IncrementNElements(
page.GetNElements());
1064 pageInfo.SetHasChecksum(GetWriteOptions().GetEnablePageChecksums());
1080std::vector<ROOT::RNTupleLocator>
1082 const std::vector<bool> &
mask)
1084 std::vector<ROOT::RNTupleLocator>
locators;
1087 for (
auto &
range : ranges) {
1105 std::vector<bool>
mask;
1109 std::unordered_map<std::uint64_t, RSealedPageLink>
originalPages;
1111 for (
auto &
range : ranges) {
1117 if (!fFeatures.fCanMergePages || !fOptions->GetEnableSamePageMerging()) {
1118 mask.emplace_back(
true);
1129 mask.emplace_back(
true);
1134 const auto *
p =
itr->second.fSealedPage;
1137 mask.emplace_back(
true);
1142 mask.emplace_back(
false);
1146 mask.shrink_to_fit();
1153 for (
auto &
range : ranges) {
1155 fOpenColumnRanges.at(
range.fPhysicalColumnId).IncrementNElements(
sealedPageIt->GetNElements());
1161 fOpenPageRanges.at(
range.fPhysicalColumnId).GetPageInfos().emplace_back(
pageInfo);
1173 for (
unsigned int i = 0; i < fOpenColumnRanges.size(); ++i) {
1175 columnInfo.fCompressionSettings = fOpenColumnRanges[i].GetCompressionSettings().value();
1176 if (fOpenColumnRanges[i].IsSuppressed()) {
1177 assert(fOpenPageRanges[i].GetPageInfos().empty());
1178 columnInfo.fPageRange.SetPhysicalColumnId(i);
1181 fOpenColumnRanges[i].SetNElements(0);
1182 fOpenColumnRanges[i].SetIsSuppressed(
false);
1184 std::swap(
columnInfo.fPageRange, fOpenPageRanges[i]);
1185 fOpenPageRanges[i].SetPhysicalColumnId(i);
1187 columnInfo.fNElements = fOpenColumnRanges[i].GetNElements();
1188 fOpenColumnRanges[i].SetNElements(0);
1200 clusterBuilder.ClusterId(fDescriptorBuilder.GetDescriptor().GetNActiveClusters())
1201 .FirstEntryIndex(fPrevClusterNEntries)
1211 fOpenColumnRanges[
colId].IncrementFirstElementIndex(
columnInfo.fNElements);
1215 clusterBuilder.CommitSuppressedColumnRanges(fDescriptorBuilder.GetDescriptor()).ThrowOnError();
1228 fDescriptorBuilder.AddCluster(
clusterBuilder.MoveDescriptor().Unwrap());
1229 fPrevClusterNEntries +=
cluster.fNEntries;
1235 const auto &
descriptor = fDescriptorBuilder.GetDescriptor();
1240 for (
auto i = fNextClusterInGroup; i <
nClusters; ++i) {
1241 physClusterIDs.emplace_back(fSerializationContext.MapClusterId(i));
1254 cgBuilder.MinEntry(0).EntrySpan(0).NClusters(0);
1261 .NClusters(
nClusters - fNextClusterInGroup);
1263 std::vector<ROOT::DescriptorId_t>
clusterIds;
1265 for (
auto i = fNextClusterInGroup; i <
nClusters; ++i) {
1269 fDescriptorBuilder.AddClusterGroup(
cgBuilder.MoveDescriptor().Unwrap());
1287 fDescriptorBuilder.AddAttributeSet(std::move(
attrSetDesc)).ThrowOnError();
1292 if (!fInfosOfStreamerFields.empty()) {
1295 for (
const auto &
etDesc : fDescriptorBuilder.GetDescriptor().GetExtraTypeInfoIterable()) {
1302 fInfosOfStreamerFields.merge(
etInfo);
1309 fDescriptorBuilder.ReplaceExtraTypeInfo(
extraInfoBuilder.MoveDescriptor().Unwrap());
1312 const auto &
descriptor = fDescriptorBuilder.GetDescriptor();
1324 fCounters = std::make_unique<RCounters>(
RCounters{
1325 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"nPageCommitted",
"",
"number of pages committed to storage"),
1326 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"szWritePayload",
"B",
"volume written for committed pages"),
1328 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"timeWallWrite",
"ns",
"wall clock time spent writing"),
1329 *fMetrics.MakeCounter<
RNTupleAtomicCounter *>(
"timeWallZip",
"ns",
"wall clock time spent compressing"),
1332 "CPU time spent compressing")});
#define R__FORWARD_ERROR(res)
Short-hand to return an RResult<T> in an error state (i.e. after checking)
#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.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char mode
A thread-safe integral performance counter.
A metric element that computes its floating point value from other counters.
A collection of Counter objects with a name, a unit, and a description.
A helper class for piece-wise construction of an RClusterDescriptor.
A helper class for piece-wise construction of an RClusterGroupDescriptor.
An in-memory subset of the packed and compressed pages of a cluster.
std::unordered_set< ROOT::DescriptorId_t > ColumnSet_t
A helper class for piece-wise construction of an RColumnDescriptor.
A column element encapsulates the translation between basic C++ types and their column representation...
virtual RIdentifier GetIdentifier() const =0
A column is a storage-backed array of a simple, fixed-size type, from which pages can be mapped into ...
std::optional< std::pair< double, double > > GetValueRange() const
std::uint16_t GetRepresentationIndex() const
ROOT::Internal::RColumnElementBase * GetElement() const
ROOT::ENTupleColumnType GetType() const
ROOT::NTupleSize_t GetFirstElementIndex() const
std::size_t GetWritePageCapacity() const
std::uint16_t GetBitsOnStorage() const
std::uint32_t GetIndex() const
A helper class for piece-wise construction of an RFieldDescriptor.
static RFieldDescriptorBuilder FromField(const ROOT::RFieldBase &field)
Make a new RFieldDescriptorBuilder based off a live RNTuple field.
static std::size_t Zip(const void *from, std::size_t nbytes, int compression, void *to)
Returns the size of the compressed data, written into the provided output buffer.
static void Unzip(const void *from, size_t nbytes, size_t dataLen, void *to)
The nbytes parameter provides the size ls of the from buffer.
static unsigned int GetClusterBunchSize(const RNTupleReadOptions &options)
A helper class for serializing and deserialization of the RNTuple binary format.
static std::uint32_t SerializeXxHash3(const unsigned char *data, std::uint64_t length, std::uint64_t &xxhash3, void *buffer)
Writes a XxHash-3 64bit checksum of the byte range given by data and length.
static RResult< StreamerInfoMap_t > DeserializeStreamerInfos(const std::string &extraTypeInfoContent)
static RResult< void > VerifyXxHash3(const unsigned char *data, std::uint64_t length, std::uint64_t &xxhash3)
Expects an xxhash3 checksum in the 8 bytes following data + length and verifies it.
EDescriptorDeserializeMode
static RResult< std::uint32_t > SerializePageList(void *buffer, const RNTupleDescriptor &desc, std::span< ROOT::DescriptorId_t > physClusterIDs, const RContext &context)
static RResult< std::uint32_t > SerializeFooter(void *buffer, const RNTupleDescriptor &desc, const RContext &context)
static std::uint32_t DeserializeUInt64(const void *buffer, std::uint64_t &val)
static RResult< RContext > SerializeHeader(void *buffer, const RNTupleDescriptor &desc)
static std::string SerializeStreamerInfos(const StreamerInfoMap_t &infos)
A memory region that contains packed and compressed pages.
A page as being stored on disk, that is packed and compressed.
Uses standard C++ memory allocation for the column data pages.
Abstract interface to allocate and release pages.
RStagedCluster StageCluster(ROOT::NTupleSize_t nNewEntries) final
Stage the current cluster and create a new one for the following data.
void UpdateSchema(const ROOT::Internal::RNTupleModelChangeset &changeset, ROOT::NTupleSize_t firstEntry) override
Incorporate incremental changes to the model into the ntuple descriptor.
void CommitSealedPage(ROOT::DescriptorId_t physicalColumnId, const RPageStorage::RSealedPage &sealedPage) final
Write a preprocessed page to storage. The column must have been added before.
std::unique_ptr< RNTupleModel > InitFromDescriptor(const ROOT::RNTupleDescriptor &descriptor, bool copyClusters)
Initialize sink based on an existing descriptor and fill into the descriptor builder,...
void UpdateExtraTypeInfo(const ROOT::RExtraTypeInfoDescriptor &extraTypeInfo) final
Adds an extra type information record to schema.
void CommitAttributeSet(std::string_view attrSetName, const RNTupleLink &attrAnchorInfo) final
Adds the given anchor information (name + locator) into the main RNTuple's descriptor as an attribute...
ColumnHandle_t AddColumn(ROOT::DescriptorId_t fieldId, ROOT::Internal::RColumn &column) final
Register a new column.
virtual std::vector< RNTupleLocator > CommitSealedPageVImpl(std::span< RPageStorage::RSealedPageGroup > ranges, const std::vector< bool > &mask)
Vector commit of preprocessed pages.
RPagePersistentSink(std::string_view ntupleName, const ROOT::RNTupleWriteOptions &options)
void CommitSuppressedColumn(ColumnHandle_t columnHandle) final
Commits a suppressed column for the current cluster.
void CommitStagedClusters(std::span< RStagedCluster > clusters) final
Commit staged clusters, logically appending them to the ntuple descriptor.
static std::unique_ptr< RPageSink > Create(std::string_view ntupleName, std::string_view location, const ROOT::RNTupleWriteOptions &options=ROOT::RNTupleWriteOptions())
Guess the concrete derived page source from the location.
void CommitPage(ColumnHandle_t columnHandle, const ROOT::Internal::RPage &page) final
Write a page to the storage. The column must have been added before.
RNTupleLink CommitDatasetImpl() final
~RPagePersistentSink() override
virtual void InitImpl(unsigned char *serializedHeader, std::uint32_t length)=0
void CommitClusterGroup() final
Write out the page locations (page list envelope) for all the committed clusters since the last call ...
void CommitSealedPageV(std::span< RPageStorage::RSealedPageGroup > ranges) final
Write a vector of preprocessed pages to storage. The corresponding columns must have been added befor...
void EnableDefaultMetrics(const std::string &prefix)
Enables the default set of metrics provided by RPageSink.
Abstract interface to write data into an ntuple.
RNTupleLink CommitDataset()
Run the registered callbacks and finalize the current cluster and the entrire data set.
virtual ROOT::Internal::RPage ReservePage(ColumnHandle_t columnHandle, std::size_t nElements)
Get a new, empty page for the given column that can be filled with up to nElements; nElements must be...
RSealedPage SealPage(const ROOT::Internal::RPage &page, const ROOT::Internal::RColumnElementBase &element)
Helper for streaming a page.
RPageSink(std::string_view ntupleName, const ROOT::RNTupleWriteOptions &options)
void Insert(ROOT::DescriptorId_t physicalColumnId, ROOT::Internal::RColumnElementBase::RIdentifier elementId)
ROOT::Internal::RCluster::ColumnSet_t ToColumnSet() const
void Erase(ROOT::DescriptorId_t physicalColumnId, ROOT::Internal::RColumnElementBase::RIdentifier elementId)
void LoadStructure()
Loads header and footer without decompressing or deserializing them.
virtual ROOT::Internal::RPageRef LoadPage(ColumnHandle_t columnHandle, ROOT::NTupleSize_t globalIndex)
Allocates and fills a page that contains the index-th element.
void RegisterStreamerInfos()
Builds the streamer info records from the descriptor's extra type info section.
void Attach(ROOT::Internal::RNTupleSerializer::EDescriptorDeserializeMode mode=ROOT::Internal::RNTupleSerializer::EDescriptorDeserializeMode::kForReading)
Open the physical storage container and deserialize header and footer.
ColumnHandle_t AddColumn(ROOT::DescriptorId_t fieldId, ROOT::Internal::RColumn &column) override
Register a new column.
void UnzipCluster(ROOT::Internal::RCluster *cluster)
Parallel decompression and unpacking of the pages in the given cluster.
void PrepareLoadCluster(const ROOT::Internal::RCluster::RKey &clusterKey, ROOT::Internal::ROnDiskPageMap &pageZeroMap, std::function< void(ROOT::DescriptorId_t, ROOT::NTupleSize_t, const ROOT::RClusterDescriptor::RPageInfo &)> perPageFunc)
Prepare a page range read for the column set in clusterKey.
void EnableDefaultMetrics(const std::string &prefix)
Enables the default set of metrics provided by RPageSource.
ROOT::NTupleSize_t GetNEntries()
void UpdateLastUsedCluster(ROOT::DescriptorId_t clusterId)
Does nothing if fLastUsedCluster == clusterId.
ROOT::NTupleSize_t GetNElements(ColumnHandle_t columnHandle)
void DropColumn(ColumnHandle_t columnHandle) override
Unregisters a column.
virtual void UnzipClusterImpl(ROOT::Internal::RCluster *cluster)
RPageSource(std::string_view ntupleName, const ROOT::RNTupleReadOptions &fOptions)
void SetEntryRange(const REntryRange &range)
Promise to only read from the given entry range.
std::unique_ptr< RPageSource > Clone() const
Open the same storage multiple time, e.g.
static std::unique_ptr< RPageSource > Create(std::string_view ntupleName, std::string_view location, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
static RResult< ROOT::Internal::RPage > UnsealPage(const RSealedPage &sealedPage, const ROOT::Internal::RColumnElementBase &element, ROOT::Internal::RPageAllocator &pageAlloc)
Helper for unstreaming a page.
Common functionality of an ntuple storage for both reading and writing.
RPageStorage(std::string_view name)
Stores information about the cluster in which this page resides.
A page is a slice of a column that is mapped into memory.
static const void * GetPageZeroBuffer()
Return a pointer to the page zero buffer used if there is no on-disk data for a particular deferred c...
const ROOT::RFieldBase * GetSourceField(const ROOT::RFieldBase *target) const
bool TryEvict(std::size_t targetAvailableSize, std::size_t pageSizeLimit)
Flush columns in order of allocated write page size until the sum of all write page allocations leave...
bool TryUpdate(ROOT::Internal::RColumn &column, std::size_t newWritePageSize)
Try to register the new write page size for the given column.
The window of element indexes of a particular column in a particular cluster.
Metadata for RNTuple clusters.
Base class for all ROOT issued exceptions.
A field translates read and write calls from/to underlying columns to/from tree values.
The on-storage metadata of an RNTuple.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
The RNTupleModel encapulates the schema of an RNTuple.
const std::string & GetDescription() const
Common user-tunable settings for reading RNTuples.
Common user-tunable settings for storing RNTuples.
const_iterator begin() const
const_iterator end() const
void ThrowOnError()
Short-hand method to throw an exception in the case of errors.
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
ROOT::RFieldZero & GetFieldZeroOfModel(RNTupleModel &model)
RResult< void > EnsureValidNameForRNTuple(std::string_view name, std::string_view where)
Check whether a given string is a valid name according to the RNTuple specification.
std::unique_ptr< T[]> MakeUninitArray(std::size_t size)
Make an array of default-initialized elements.
RProjectedFields & GetProjectedFieldsOfModel(RNTupleModel &model)
std::unique_ptr< RColumnElementBase > GenerateColumnElement(std::type_index inMemoryType, ROOT::ENTupleColumnType onDiskType)
void CallConnectPageSinkOnField(RFieldBase &, ROOT::Internal::RPageSink &, ROOT::NTupleSize_t firstEntry=0)
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
The identifiers that specifies the content of a (partial) cluster.
Every concrete RColumnElement type is identified by its on-disk type (column type) and the in-memory ...
The incremental changes to a RNTupleModel
On-disk pages within a page source are identified by the column and page number.
Default I/O performance counters that get registered in fMetrics.
Parameters for the SealPage() method.
bool fWriteChecksum
Adds a 8 byte little-endian xxhash3 checksum to the page payload.
std::uint32_t fCompressionSettings
Compression algorithm and level to apply.
void * fBuffer
Location for sealed output. The memory buffer has to be large enough.
const ROOT::Internal::RPage * fPage
Input page to be sealed.
bool fAllowAlias
If false, the output buffer must not point to the input page buffer, which would otherwise be an opti...
const ROOT::Internal::RColumnElementBase * fElement
Corresponds to the page's elements, for size calculation etc.
Cluster that was staged, but not yet logically appended to the RNTuple.
Summarizes cluster-level information that are necessary to load a certain page.
Default I/O performance counters that get registered in fMetrics
Used in SetEntryRange / GetEntryRange.
bool IntersectsWith(const ROOT::RClusterDescriptor &clusterDesc) const
Returns true if the given cluster has entries within the entry range.
A sealed page contains the bytes of a page as written to storage (packed & compressed).
RResult< void > VerifyChecksumIfEnabled() const
RResult< std::uint64_t > GetChecksum() const
Returns a failure if the sealed page has no checksum.
ROOT::Internal::RColumn * fColumn
bool operator>(const RColumnInfo &other) const
Information about a single page in the context of a cluster's page range.
Modifiers passed to CreateModel()