Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RPageNullSink.hxx
Go to the documentation of this file.
1/// \file ROOT/RPageNullSink.hxx
2/// \ingroup NTuple ROOT7
3/// \author Jonas Hahnfeld <jonas.hahnfeld@cern.ch>
4/// \date 2024-01-31
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT7_RPageNullSink
17#define ROOT7_RPageNullSink
18
19#include <ROOT/RColumn.hxx>
20#include <ROOT/RFieldBase.hxx>
21#include <ROOT/RNTupleModel.hxx>
22#include <ROOT/RPageStorage.hxx>
23
24namespace ROOT {
25namespace Experimental {
26namespace Internal {
27
28/**
29\class ROOT::Experimental::Internal::RPageNullSink
30\ingroup NTuple
31\brief Dummy sink that discards all pages
32
33The RPageNullSink class is for internal testing only and can be used to measure the software overhead of serializing
34elements into pages, without actually writing them onto disk or even serializing the RNTuple headers and footers.
35*/
36class RPageNullSink : public RPageSink {
38 std::uint64_t fNBytesCurrentCluster = 0;
39
40public:
41 RPageNullSink(std::string_view ntupleName, const RNTupleWriteOptions &options) : RPageSink(ntupleName, options) {}
42
43 ColumnHandle_t AddColumn(DescriptorId_t, RColumn &column) final { return {fNColumns++, &column}; }
44
45 const RNTupleDescriptor &GetDescriptor() const final
46 {
47 static RNTupleDescriptor descriptor;
48 return descriptor;
49 }
50
51 void ConnectFields(const std::vector<RFieldBase *> &fields, NTupleSize_t firstEntry)
52 {
53 auto connectField = [&](RFieldBase &f) { CallConnectPageSinkOnField(f, *this, firstEntry); };
54 for (auto *f : fields) {
55 connectField(*f);
56 for (auto &descendant : *f) {
57 connectField(descendant);
58 }
59 }
60 }
61 void InitImpl(RNTupleModel &model) final
62 {
63 auto &fieldZero = GetFieldZeroOfModel(model);
64 ConnectFields(fieldZero.GetSubFields(), 0);
65 }
66 void UpdateSchema(const RNTupleModelChangeset &changeset, NTupleSize_t firstEntry) final
67 {
68 ConnectFields(changeset.fAddedFields, firstEntry);
69 }
71
73 void CommitPage(ColumnHandle_t, const RPage &page) final { fNBytesCurrentCluster += page.GetNBytes(); }
75 {
76 fNBytesCurrentCluster += page.GetBufferSize();
77 }
78 void CommitSealedPageV(std::span<RSealedPageGroup> ranges) final
79 {
80 for (auto &range : ranges) {
81 for (auto sealedPageIt = range.fFirst; sealedPageIt != range.fLast; ++sealedPageIt) {
82 fNBytesCurrentCluster += sealedPageIt->GetBufferSize();
83 }
84 }
85 }
86
88 {
89 RStagedCluster stagedCluster;
92 return stagedCluster;
93 }
94 void CommitStagedClusters(std::span<RStagedCluster>) final {}
95 void CommitClusterGroup() final {}
96 void CommitDatasetImpl() final {}
97};
98
99} // namespace Internal
100} // namespace Experimental
101} // namespace ROOT
102
103#endif
#define f(i)
Definition RSha256.hxx:104
A column is a storage-backed array of a simple, fixed-size type, from which pages can be mapped into ...
Definition RColumn.hxx:40
Dummy sink that discards all pages.
void ConnectFields(const std::vector< RFieldBase * > &fields, NTupleSize_t firstEntry)
void CommitSuppressedColumn(ColumnHandle_t) final
Commits a suppressed column for the current cluster.
void CommitSealedPage(DescriptorId_t, const RSealedPage &page) final
Write a preprocessed page to storage. The column must have been added before.
void CommitClusterGroup() final
Write out the page locations (page list envelope) for all the committed clusters since the last call ...
void CommitSealedPageV(std::span< RSealedPageGroup > ranges) final
Write a vector of preprocessed pages to storage. The corresponding columns must have been added befor...
RPageNullSink(std::string_view ntupleName, const RNTupleWriteOptions &options)
void InitImpl(RNTupleModel &model) final
void CommitPage(ColumnHandle_t, const RPage &page) final
Write a page to the storage. The column must have been added before.
void UpdateSchema(const RNTupleModelChangeset &changeset, NTupleSize_t firstEntry) final
Incorporate incremental changes to the model into the ntuple descriptor.
void CommitStagedClusters(std::span< RStagedCluster >) final
Commit staged clusters, logically appending them to the ntuple descriptor.
RStagedCluster StageCluster(NTupleSize_t) final
Stage the current cluster and create a new one for the following data.
ColumnHandle_t AddColumn(DescriptorId_t, RColumn &column) final
Register a new column.
const RNTupleDescriptor & GetDescriptor() const final
Return the RNTupleDescriptor being constructed.
void UpdateExtraTypeInfo(const RExtraTypeInfoDescriptor &) final
Adds an extra type information record to schema.
Abstract interface to write data into an ntuple.
A page is a slice of a column that is mapped into memory.
Definition RPage.hxx:47
Field specific extra type information from the header / extenstion header.
A field translates read and write calls from/to underlying columns to/from tree values.
The on-storage meta-data of an ntuple.
The RNTupleModel encapulates the schema of an ntuple.
Common user-tunable settings for storing ntuples.
void CallConnectPageSinkOnField(RFieldBase &, RPageSink &, NTupleSize_t firstEntry=0)
RFieldZero & GetFieldZeroOfModel(RNTupleModel &model)
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
The incremental changes to a RNTupleModel
Cluster that was staged, but not yet logically appended to the RNTuple.
A sealed page contains the bytes of a page as written to storage (packed & compressed).