102 fWriter->WriteNTupleHeader(zipBuffer.get(), szZipHeader,
length);
111 const TClass *cl =
nullptr;
112 if (
auto classField =
dynamic_cast<const RClassField *
>(field)) {
114 }
else if (
auto streamerField =
dynamic_cast<const RStreamerField *
>(field)) {
117 cl = soaField->GetSoAClass();
125 std::to_string(field->GetTypeVersion()) +
"]"));
131 fnAddStreamerInfo(field);
132 for (
const auto &subField : *field) {
133 fnAddStreamerInfo(&subField);
141 std::uint64_t offsetData;
148 result.SetPosition(offsetData);
163 sealedPage =
SealPage(page, *element);
173 const auto nBits =
fDescriptorBuilder.GetDescriptor().GetColumnDescriptor(physicalColumnId).GetBitsOnStorage();
174 const auto bytesPacked = (nBits * sealedPage.
GetNElements() + 7) / 8;
184 locators.reserve(locators.size() + batch.
fSealedPages.size());
187 fWriter->WriteIntoReservedBlob(pagePtr->GetBuffer(), pagePtr->GetBufferSize(),
offset);
191 locators.push_back(locator);
192 offset += pagePtr->GetBufferSize();
204std::vector<ROOT::RNTupleLocator>
206 const std::vector<bool> &
mask)
208 const std::uint64_t maxKeySize =
fOptions->GetMaxKeySize();
211 std::vector<RNTupleLocator> locators;
213 std::size_t iPage = 0;
214 for (
auto rangeIt = ranges.begin(); rangeIt != ranges.end(); ++rangeIt) {
215 auto &range = *rangeIt;
216 if (range.fFirst == range.fLast) {
221 const auto bitsOnStorage =
222 fDescriptorBuilder.GetDescriptor().GetColumnDescriptor(range.fPhysicalColumnId).GetBitsOnStorage();
224 for (
auto sealedPageIt = range.fFirst; sealedPageIt != range.fLast; ++sealedPageIt, ++iPage) {
228 const auto bytesPacked = (bitsOnStorage * sealedPageIt->GetNElements() + 7) / 8;
230 if (batch.fSize > 0 && batch.fSize + sealedPageIt->GetBufferSize() > maxKeySize) {
241 if (sealedPageIt->GetBufferSize() > maxKeySize) {
247 assert(batch.fSize == 0);
250 fWriter->WriteBlob(sealedPageIt->GetBuffer(), sealedPageIt->GetBufferSize(), bytesPacked);
254 locators.push_back(locator);
257 fCounters->fSzWritePayload.Add(sealedPageIt->GetBufferSize());
261 batch.fSealedPages.emplace_back(&(*sealedPageIt));
262 batch.fSize += sealedPageIt->GetBufferSize();
263 batch.fBytesPacked += bytesPacked;
268 if (batch.fSize > 0) {
290 result.SetNBytesOnStorage(szPageListZip);
300 for (
const auto &extraTypeInfo :
fDescriptorBuilder.GetDescriptor().GetExtraTypeInfoIterable()) {
313 fWriter->WriteNTupleFooter(bufFooterZip.get(), szFooterZip,
length);
317std::unique_ptr<ROOT::Internal::RPageSink>
333 "cumulative seek distance (excluding header/footer reads)"),
335 "szFile",
"B",
"total file size",
fMetrics,
338 return {true, static_cast<double>(fFileSize)};
343 "ratio of seek distance to bytes read (excluding file structure reads)",
fMetrics,
345 if (const auto szSkip = metrics.GetLocalCounter(
"szSkip")) {
346 if (const auto szReadPayload = metrics.GetLocalCounter(
"szReadPayload")) {
347 if (const auto szReadOverhead = metrics.GetLocalCounter(
"szReadOverhead")) {
348 auto totalRead = szReadPayload->GetValueAsInt() + szReadOverhead->GetValueAsInt();
350 return {true, (1. * szSkip->GetValueAsInt()) / totalRead};
359 "ratio of bytes read to total file size (excluding file structure reads)", fMetrics,
360 [
this](
const RNTupleMetrics &metrics) -> std::pair<bool, double> {
362 if (const auto szReadPayload = metrics.GetLocalCounter(
"szReadPayload")) {
363 if (const auto szReadOverhead = metrics.GetLocalCounter(
"szReadOverhead")) {
364 auto totalRead = szReadPayload->GetValueAsInt() + szReadOverhead->GetValueAsInt();
365 return {true, (1. * totalRead) / fFileSize};
374 std::unique_ptr<ROOT::Internal::RRawFile> file,
378 fFile = std::move(file);
389std::unique_ptr<ROOT::Internal::RPageSourceFile>
393 throw RException(
R__FAIL(
"This RNTuple object was not streamed from a ROOT file (TFile or descendant)"));
395 std::unique_ptr<ROOT::Internal::RRawFile> rawFile;
401 auto protocol = std::string(url->GetProtocol());
402 if (className ==
"TFile") {
404 }
else if (className ==
"TDavixFile" || className ==
"TCurlFile" || className ==
"TNetXNGFile") {
410 auto pageSource = std::make_unique<RPageSourceFile>(
"", std::move(rawFile), options);
411 pageSource->fAnchor = anchor;
421std::unique_ptr<ROOT::Internal::RPageSource>
430 auto pageSource = std::make_unique<RPageSourceFile>(
"",
fFile->Clone(), options);
431 pageSource->fAnchor = anchor;
451 const auto bufSize =
fAnchor->GetNBytesHeader() +
fAnchor->GetNBytesFooter() +
457 auto readvLimits =
fFile->GetReadVLimits();
459 readvLimits.fMaxSingleSize = std::min<size_t>(readvLimits.fMaxSingleSize,
fAnchor->GetMaxKeySize());
461 if ((readvLimits.fMaxReqs < 2) ||
462 (std::max(
fAnchor->GetNBytesHeader(),
fAnchor->GetNBytesFooter()) > readvLimits.fMaxSingleSize) ||
463 (
fAnchor->GetNBytesHeader() +
fAnchor->GetNBytesFooter() > readvLimits.fMaxTotalSize)) {
470 R__ASSERT(
fAnchor->GetNBytesHeader() < std::numeric_limits<std::size_t>::max());
471 R__ASSERT(
fAnchor->GetNBytesFooter() < std::numeric_limits<std::size_t>::max());
473 static_cast<std::size_t
>(
fAnchor->GetNBytesHeader()), 0},
475 static_cast<std::size_t
>(
fAnchor->GetNBytesFooter()), 0}};
476 fFile->ReadV(readRequests, 2);
500 std::vector<unsigned char> buffer;
501 for (
const auto &cgDesc : desc.GetClusterGroupIterable()) {
502 buffer.resize(std::max<size_t>(buffer.size(),
503 cgDesc.GetPageListLength() + cgDesc.GetPageListLocator().GetNBytesOnStorage()));
504 auto *zipBuffer = buffer.data() + cgDesc.GetPageListLength();
505 fReader.ReadBuffer(zipBuffer, cgDesc.GetPageListLocator().GetNBytesOnStorage(),
506 cgDesc.GetPageListLocator().GetPosition<std::uint64_t>());
508 cgDesc.GetPageListLength(), buffer.data());
514 fFile->SetBuffering(
false);
530 const auto &clusterDescriptor = descriptorGuard->GetClusterDescriptor(clusterId);
531 pageInfo = clusterDescriptor.GetPageRange(physicalColumnId).Find(localIndex.
GetIndexInCluster());
556 const auto clusterId = clusterInfo.
fClusterId;
557 const auto pageInfo = clusterInfo.
fPageInfo;
560 const auto elementSize = element->
GetSize();
561 const auto elementInMemoryType = element->GetIdentifier().fInMemoryType;
564 auto pageZero =
fPageAllocator->NewPage(elementSize, pageInfo.GetNElements());
565 pageZero.GrowUnchecked(pageInfo.GetNElements());
566 memset(pageZero.GetBuffer(), 0, pageZero.GetNBytes());
567 pageZero.SetWindow(clusterInfo.
fColumnOffset + pageInfo.GetFirstElementIndex(),
576 std::unique_ptr<unsigned char[]> directReadBuffer;
582 const auto offset = pageInfo.GetLocator().GetPosition<std::uint64_t>();
586 const auto distance =
static_cast<std::uint64_t
>(std::abs(
596 sealedPage.
SetBuffer(directReadBuffer.get());
604 if (!cachedPageRef.Get().IsNull())
605 return cachedPageRef;
610 sealedPage.
SetBuffer(onDiskPage->GetAddress());
616 newPage =
UnsealPage(sealedPage, *element).Unwrap();
617 fCounters->fSzUnzip.Add(elementSize * pageInfo.GetNElements());
629 clone->fFile =
fFile->Clone();
631 return std::unique_ptr<RPageSourceFile>(clone);
634std::unique_ptr<ROOT::Internal::RCluster>
636 std::vector<ROOT::Internal::RRawFile::RIOVec> &readRequests)
638 struct ROnDiskPageLocator {
641 std::uint64_t fOffset = 0;
642 std::uint64_t fSize = 0;
643 std::size_t fBufPos = 0;
646 std::vector<ROnDiskPageLocator> onDiskPages;
648 auto pageZeroMap = std::make_unique<ROnDiskPageMap>();
650 clusterKey, *pageZeroMap,
653 const auto &pageLocator = pageInfo.
GetLocator();
657 activeSize += nBytes;
658 onDiskPages.push_back({physicalColumnId, pageNo, pageLocator.GetPosition<std::uint64_t>(), nBytes, 0});
662 std::sort(onDiskPages.begin(), onDiskPages.end(),
663 [](
const ROnDiskPageLocator &
a,
const ROnDiskPageLocator &
b) { return a.fOffset < b.fOffset; });
672 float maxOverhead = 0.25 * float(activeSize);
673 std::vector<std::size_t> gaps;
674 if (onDiskPages.size())
675 gaps.reserve(onDiskPages.size() - 1);
676 for (
unsigned i = 1; i < onDiskPages.size(); ++i) {
678 static_cast<int64_t
>(onDiskPages[i].fOffset) - (onDiskPages[i - 1].fSize + onDiskPages[i - 1].fOffset);
679 gaps.emplace_back(std::max(gap, std::int64_t(0)));
681 activeSize += std::min(gap, std::int64_t(0));
683 std::sort(gaps.begin(), gaps.end());
684 std::size_t gapCut = 0;
685 std::size_t currentGap = 0;
687 for (
auto g : gaps) {
688 if (
g != currentGap) {
693 if (szExtra > maxOverhead)
701 const auto currentReadRequestIdx = readRequests.size();
705 if (!onDiskPages.empty())
706 req.
fOffset = onDiskPages[0].fOffset;
707 std::size_t szPayload = 0;
708 std::size_t szOverhead = 0;
709 const std::uint64_t maxKeySize =
fReader.GetMaxKeySize();
710 for (
auto &s : onDiskPages) {
714 const std::uint64_t overhead = std::max(
static_cast<std::int64_t
>(s.fOffset) - readUpTo, std::int64_t(0));
715 const std::uint64_t extent = std::max(
static_cast<std::int64_t
>(s.fOffset + s.fSize) - readUpTo, std::int64_t(0));
716 if (req.
fSize + extent < maxKeySize && overhead <= gapCut) {
717 szPayload += (extent - overhead);
718 szOverhead += overhead;
719 s.fBufPos =
reinterpret_cast<intptr_t
>(req.
fBuffer) + s.fOffset - req.
fOffset;
726 readRequests.emplace_back(req);
729 s.fBufPos =
reinterpret_cast<intptr_t
>(req.
fBuffer);
731 szPayload += s.fSize;
735 readRequests.emplace_back(req);
736 fCounters->fSzReadPayload.Add(szPayload);
737 fCounters->fSzReadOverhead.Add(szOverhead);
740 auto buffer =
new unsigned char[
reinterpret_cast<intptr_t
>(req.
fBuffer) + req.
fSize];
741 auto pageMap = std::make_unique<ROOT::Internal::ROnDiskPageMapHeap>(std::unique_ptr<
unsigned char[]>(buffer));
742 for (
const auto &s : onDiskPages) {
744 pageMap->Register(key,
ROnDiskPage(buffer + s.fBufPos, s.fSize));
746 fCounters->fNPageRead.Add(onDiskPages.size());
747 for (
auto i = currentReadRequestIdx; i < readRequests.size(); ++i) {
748 readRequests[i].fBuffer = buffer +
reinterpret_cast<intptr_t
>(readRequests[i].fBuffer);
751 auto cluster = std::make_unique<RCluster>(clusterKey.
fClusterId);
752 cluster->Adopt(std::move(pageMap));
753 cluster->Adopt(std::move(pageZeroMap));
755 cluster->SetColumnAvailable(colId);
759std::vector<std::unique_ptr<ROOT::Internal::RCluster>>
762 fCounters->fNClusterLoaded.Add(clusterKeys.size());
764 std::vector<std::unique_ptr<ROOT::Internal::RCluster>> clusters;
765 std::vector<ROOT::Internal::RRawFile::RIOVec> readRequests;
767 clusters.reserve(clusterKeys.size());
768 for (
auto key : clusterKeys) {
772 auto nReqs = readRequests.size();
773 auto readvLimits =
fFile->GetReadVLimits();
775 readvLimits.fMaxSingleSize = std::min<size_t>(readvLimits.fMaxSingleSize,
fReader.GetMaxKeySize());
779 auto nBatch = std::min(nReqs, readvLimits.fMaxReqs);
781 if (readvLimits.HasSizeLimit()) {
782 std::uint64_t totalSize = 0;
783 for (std::size_t i = 0; i < nBatch; ++i) {
784 if (readRequests[iReq + i].fSize > readvLimits.fMaxSingleSize) {
789 totalSize += readRequests[iReq + i].fSize;
790 if (totalSize > readvLimits.fMaxTotalSize) {
799 for (std::size_t i = 0; i < nBatch; ++i) {
800 const auto offset = readRequests[iReq + i].fOffset;
802 const auto distance =
static_cast<std::uint64_t
>(std::abs(
812 fReader.ReadBuffer(readRequests[iReq].
fBuffer, readRequests[iReq].fSize, readRequests[iReq].fOffset);
815 fFile->ReadV(&readRequests[iReq], nBatch);
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
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 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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
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.
An interface to read from, or write to, a ROOT file, as well as performing other common operations.
The SoA field provides I/O for an in-memory SoA layout linked to an on-disk collection of the underly...
Managed a set of clusters containing compressed and packed pages.
An in-memory subset of the packed and compressed pages of a cluster.
std::size_t GetSize() const
ROOT::Internal::RColumnElementBase * GetElement() const
Read RNTuple data blocks from a TFile container, provided by a RRawFile.
Helper class to compress data blocks in the ROOT compression frame format.
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.
Helper class to uncompress data blocks in the ROOT compression frame format.
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.
Write RNTuple data blocks in a TFile or a bare file container.
static std::unique_ptr< RNTupleFileWriter > Append(std::string_view ntupleName, TDirectory &fileOrDirectory, std::uint64_t maxKeySize, bool isHidden)
The directory parameter can also be a TFile object (TFile inherits from TDirectory).
static std::unique_ptr< RNTupleFileWriter > Recreate(std::string_view ntupleName, std::string_view path, EContainerFormat containerFormat, const ROOT::RNTupleWriteOptions &options)
Create or truncate the local file given by path with the new empty RNTuple identified by ntupleName.
A helper class for serializing and deserialization of the RNTuple binary format.
static RResult< void > DeserializePageList(const void *buffer, std::uint64_t bufSize, ROOT::DescriptorId_t clusterGroupId, RNTupleDescriptor &desc, EDescriptorDeserializeMode mode)
static RResult< void > DeserializeFooter(const void *buffer, std::uint64_t bufSize, ROOT::Internal::RNTupleDescriptorBuilder &descBuilder)
static RResult< StreamerInfoMap_t > DeserializeStreamerInfos(const std::string &extraTypeInfoContent)
EDescriptorDeserializeMode
static RResult< void > DeserializeHeader(const void *buffer, std::uint64_t bufSize, ROOT::Internal::RNTupleDescriptorBuilder &descBuilder)
A memory region that contains packed and compressed pages.
A page as being stored on disk, that is packed and compressed.
void UpdateSchema(const ROOT::Internal::RNTupleModelChangeset &changeset, ROOT::NTupleSize_t firstEntry) override
Incorporate incremental changes to the model into the ntuple descriptor.
ROOT::Internal::RNTupleDescriptorBuilder fDescriptorBuilder
RPagePersistentSink(std::string_view ntupleName, const ROOT::RNTupleWriteOptions &options)
std::unique_ptr< RCounters > fCounters
void EnableDefaultMetrics(const std::string &prefix)
Enables the default set of metrics provided by RPageSink.
A thread-safe cache of pages loaded from the page source.
std::uint64_t fNBytesCurrentCluster
Number of bytes committed to storage in the current cluster.
void CommitBatchOfPages(CommitBatch &batch, std::vector< RNTupleLocator > &locators)
Subroutine of CommitSealedPageVImpl, used to perform a vector write of the (multi-)range of pages con...
RPageSinkFile(std::string_view ntupleName, const ROOT::RNTupleWriteOptions &options)
std::unique_ptr< RPageSink > CloneAsHidden(std::string_view name, const ROOT::RNTupleWriteOptions &opts) const override
Creates a new sink with the same underlying storage as this but writing to a different RNTuple named ...
std::uint64_t StageClusterImpl() final
Returns the number of bytes written to storage (excluding metadata)
void InitImpl(unsigned char *serializedHeader, std::uint32_t length) final
RNTupleLocator CommitPageImpl(ColumnHandle_t columnHandle, const RPage &page) override
RNTupleLocator WriteSealedPage(const RPageStorage::RSealedPage &sealedPage, std::size_t bytesPacked)
We pass bytesPacked so that TFile::ls() reports a reasonable value for the compression ratio of the c...
RNTupleLocator CommitClusterGroupImpl(unsigned char *serializedPageList, std::uint32_t length) final
Returns the locator of the page list envelope of the given buffer that contains the serialized page l...
RNTupleLocator CommitSealedPageImpl(ROOT::DescriptorId_t physicalColumnId, const RPageStorage::RSealedPage &sealedPage) final
RNTupleLink CommitDatasetImpl() final
std::unique_ptr< ROOT::Internal::RNTupleFileWriter > fWriter
~RPageSinkFile() override
void UpdateSchema(const ROOT::Internal::RNTupleModelChangeset &changeset, ROOT::NTupleSize_t firstEntry) final
Incorporate incremental changes to the model into the ntuple descriptor.
std::vector< RNTupleLocator > CommitSealedPageVImpl(std::span< RPageStorage::RSealedPageGroup > ranges, const std::vector< bool > &mask) final
Vector commit of preprocessed pages.
ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fInfosOfClassFields
On UpdateSchema(), the new class fields register the corresponding streamer info here so that the str...
std::unique_ptr< ROOT::RNTupleWriteOptions > fOptions
const ROOT::RNTupleWriteOptions & GetWriteOptions() const
Returns the sink's write options.
RSealedPage SealPage(const ROOT::Internal::RPage &page, const ROOT::Internal::RColumnElementBase &element)
Helper for streaming a page.
std::int64_t fFileSize
Total file size, set once in AttachImpl()
RNTupleDescriptorBuilder fDescriptorBuilder
The descriptor is created from the header and footer either in AttachImpl or in CreateFromAnchor.
std::unique_ptr< ROOT::Internal::RCluster > PrepareSingleCluster(const ROOT::Internal::RCluster::RKey &clusterKey, std::vector< RRawFile::RIOVec > &readRequests)
Helper function for LoadClusters: it prepares the memory buffer (page map) and the read requests for ...
std::uint64_t fLastOffset
Tracks the last read offset for seek distance calculation.
ROOT::Internal::RCluster * fCurrentCluster
The last cluster from which a page got loaded. Points into fClusterPool->fPool.
std::unique_ptr< RPageSource > OpenWithDifferentAnchor(const ROOT::Internal::RNTupleLink &anchorLink, const ROOT::RNTupleReadOptions &options={}) final
Creates a new PageSource using the same underlying file as this but referring to a different RNTuple,...
~RPageSourceFile() override
RPageRef LoadPageImpl(ColumnHandle_t columnHandle, const RClusterInfo &clusterInfo, ROOT::NTupleSize_t idxInCluster) final
static std::unique_ptr< RPageSourceFile > CreateFromAnchor(const RNTuple &anchor, const ROOT::RNTupleReadOptions &options=ROOT::RNTupleReadOptions())
Used from the RNTuple class to build a datasource if the anchor is already available.
ROOT::RNTupleDescriptor AttachImpl(RNTupleSerializer::EDescriptorDeserializeMode mode) final
LoadStructureImpl() has been called before AttachImpl() is called
std::vector< std::unique_ptr< ROOT::Internal::RCluster > > LoadClusters(std::span< ROOT::Internal::RCluster::RKey > clusterKeys) final
Populates all the pages of the given cluster ids and columns; it is possible that some columns do not...
std::unique_ptr< RFileCounters > fFileCounters
friend class ROOT::RNTuple
RPageSourceFile(std::string_view ntupleName, const ROOT::RNTupleReadOptions &options)
std::unique_ptr< RPageSource > CloneImpl() const final
The cloned page source creates a new raw file and reader and opens its own file descriptor to the dat...
void LoadStructureImpl() final
void LoadStreamerInfo() final
Forces the loading of ROOT StreamerInfo from the underlying file. This currently only has an effect f...
RStructureBuffer fStructureBuffer
Populated by LoadStructureImpl(), reset at the end of Attach()
std::unique_ptr< RRawFile > fFile
An RRawFile is used to request the necessary byte ranges from a local or a remote file.
std::optional< RNTuple > fAnchor
Either provided by CreateFromAnchor, or read from the ROOT file given the ntuple name.
ROOT::Internal::RMiniFileReader fReader
Takes the fFile to read ntuple blobs from it.
void LoadSealedPage(ROOT::DescriptorId_t physicalColumnId, RNTupleLocalIndex localIndex, RSealedPage &sealedPage) final
Read the packed and compressed bytes of a page into the memory buffer provided by sealedPage....
ROOT::Internal::RClusterPool fClusterPool
The cluster pool asynchronously preloads the next few clusters. Note that derived classes should call...
ROOT::RNTupleReadOptions fOptions
const RSharedDescriptorGuard GetSharedDescriptorGuard() const
Takes the read lock for the descriptor. Multiple threads can take the lock concurrently....
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. Specifically, pages referencing the kType...
void EnableDefaultMetrics(const std::string &prefix)
Enables the default set of metrics provided by RPageSource. prefix will be used as the prefix for the...
std::unique_ptr< RCounters > fCounters
ROOT::Internal::RPagePool fPagePool
Pages that are unzipped with IMT are staged into the page pool.
RPageSource(std::string_view ntupleName, const ROOT::RNTupleReadOptions &fOptions)
RActivePhysicalColumns fActivePhysicalColumns
The active columns are implicitly defined by the model fields or views.
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. This is commonly used in derived, concrete page sources....
std::unique_ptr< ROOT::Internal::RPageAllocator > fPageAllocator
For the time being, we will use the heap allocator for all sources and sinks. This may change in the ...
static constexpr std::size_t kNBytesPageChecksum
The page checksum is a 64bit xxhash3.
RColumnHandle ColumnHandle_t
The column handle identifies a column with the current open page storage.
ROOT::Experimental::Detail::RNTupleMetrics fMetrics
const std::string & GetNTupleName() const
Returns the NTuple name.
Stores information about the cluster in which this page resides.
A page is a slice of a column that is mapped into memory.
std::uint32_t GetNElements() const
std::size_t GetNBytes() const
The space taken by column elements in the buffer.
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...
void SetWindow(const ROOT::NTupleSize_t rangeFirst, const RClusterInfo &clusterInfo)
Seek the page to a certain position of the column.
The RRawFileTFile wraps an open TFile, but does not take ownership.
The RRawFile provides read-only access to local and remote files.
static std::unique_ptr< RRawFile > Create(std::string_view url, ROptions options=ROptions())
Factory method that returns a suitable concrete implementation according to the transport in the url.
The field for a class with dictionary.
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...
ROOT::NTupleSize_t GetIndexInCluster() const
ROOT::DescriptorId_t GetClusterId() const
Generic information about the physical location of data.
std::uint64_t GetNBytesOnStorage() const
ELocatorType GetType() const
For non-disk locators, the value for the Type field.
T GetPosition() const
Note that for GetPosition() / SetPosition(), the locator type must correspond (kTypeFile,...
void SetPosition(std::uint64_t position)
void SetNBytesOnStorage(std::uint64_t nBytesOnStorage)
Common user-tunable settings for reading RNTuples.
Common user-tunable settings for storing RNTuples.
std::uint64_t GetMaxKeySize() const
TFile * fFile
! The file from which the ntuple was streamed, registered in the custom streamer
void ThrowOnError()
Short-hand method to throw an exception in the case of errors.
The field for a class using ROOT standard streaming.
TClass instances represent classes, structs and namespaces in the ROOT type system.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Describe directory structure in memory.
virtual const TUrl * GetEndpointUrl() const
TClass * IsA() const override
const char * GetName() const override
Returns name of object.
RNTupleTimer< RNTupleAtomicCounter, RNTupleTickCounter< RNTupleAtomicCounter > > RNTupleAtomicTimer
std::unique_ptr< T[]> MakeUninitArray(std::size_t size)
Make an array of default-initialized elements.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
The identifiers that specifies the content of a (partial) cluster.
ROOT::DescriptorId_t fClusterId
ColumnSet_t fPhysicalColumnSet
std::uint32_t fLength
Uncompressed length of the anchor, including the checksum.
The incremental changes to a RNTupleModel
std::vector< ROOT::RFieldBase * > fAddedFields
Points to the fields in fModel that were added as part of an updater transaction.
On-disk pages within a page source are identified by the column and page number.
size_t fSize
Total size in bytes of the batch.
std::vector< const RSealedPage * > fSealedPages
The list of pages to commit.
size_t fBytesPacked
Total uncompressed size of the elements in the page batch.
File-specific I/O performance counters.
Summarizes cluster-level information that are necessary to load a certain page. Used by LoadPageImpl(...
std::uint64_t fColumnOffset
The first element number of the page's column in the given cluster.
ROOT::DescriptorId_t fClusterId
ROOT::RClusterDescriptor::RPageInfoExtended fPageInfo
Location of the page on disk.
ROOT::Internal::RColumn * fColumn
ROOT::DescriptorId_t fPhysicalId
A sealed page contains the bytes of a page as written to storage (packed & compressed).
RResult< void > VerifyChecksumIfEnabled() const
void SetBuffer(const void *buffer)
std::uint32_t GetNElements() const
void SetHasChecksum(bool hasChecksum)
const void * GetBuffer() const
void SetNElements(std::uint32_t nElements)
std::size_t GetBufferSize() const
void SetBufferSize(std::size_t bufferSize)
std::size_t GetDataSize() const
Used for vector reads from multiple offsets into multiple buffers.
std::size_t fSize
The number of desired bytes.
void * fBuffer
The destination for reading.
std::uint64_t fOffset
The file offset.
Information about a single page in the context of a cluster's page range.
std::uint32_t GetNElements() const
const RNTupleLocator & GetLocator() const