Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RSealedPage.hxx
Go to the documentation of this file.
1/// \file ROOT/RSealedPage.hxx
2/// \author Jakob Blomer <jblomer@cern.ch>
3/// \date 2026-20-11
4
5/*************************************************************************
6 * Copyright (C) 1995-2026, 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_RSealedPage
14#define ROOT_RSealedPage
15
16#include <ROOT/RError.hxx>
17#include <ROOT/RNTupleTypes.hxx>
18
19#include <cassert>
20#include <cstddef>
21#include <cstdint>
22#include <deque>
23
24namespace ROOT {
25namespace Internal {
26
27/// A sealed page contains the bytes of a page as written to storage (packed & compressed). It is used
28/// as an input to UnsealPages() as well as to transfer pages between different storage media.
29/// RSealedPage does _not_ own the buffer it is pointing to in order to not interfere with the memory management
30/// of concrete page sink and page source implementations.
32private:
33 const void *fBuffer = nullptr;
34 std::size_t fBufferSize = 0; ///< Size of the page payload and the trailing checksum (if available)
35 std::uint32_t fNElements = 0;
36 bool fHasChecksum = false; ///< If set, the last 8 bytes of the buffer are the xxhash of the rest of the buffer
37
38public:
39 /// The page checksum is a 64bit xxhash3
40 static constexpr std::size_t kNBytesPageChecksum = sizeof(std::uint64_t);
41
42 RSealedPage() = default;
43 RSealedPage(const void *buffer, std::size_t bufferSize, std::uint32_t nElements, bool hasChecksum = false)
44 : fBuffer(buffer), fBufferSize(bufferSize), fNElements(nElements), fHasChecksum(hasChecksum)
45 {
46 }
47 RSealedPage(const RSealedPage &other) = default;
48 RSealedPage &operator=(const RSealedPage &other) = default;
49 RSealedPage(RSealedPage &&other) = default;
50 RSealedPage &operator=(RSealedPage &&other) = default;
51
52 const void *GetBuffer() const { return fBuffer; }
53 void SetBuffer(const void *buffer) { fBuffer = buffer; }
54
55 std::size_t GetDataSize() const
56 {
59 }
60 std::size_t GetBufferSize() const { return fBufferSize; }
61 void SetBufferSize(std::size_t bufferSize) { fBufferSize = bufferSize; }
62
63 std::uint32_t GetNElements() const { return fNElements; }
64 void SetNElements(std::uint32_t nElements) { fNElements = nElements; }
65
66 bool GetHasChecksum() const { return fHasChecksum; }
67 void SetHasChecksum(bool hasChecksum) { fHasChecksum = hasChecksum; }
68
69 void ChecksumIfEnabled();
71 /// Returns a failure if the sealed page has no checksum
73};
74
75using SealedPageSequence_t = std::deque<RSealedPage>;
76/// A range of sealed pages referring to the same column that can be used for vector commit
79 SealedPageSequence_t::const_iterator fFirst;
80 SealedPageSequence_t::const_iterator fLast;
81
82 RSealedPageGroup() = default;
83 RSealedPageGroup(ROOT::DescriptorId_t d, const SealedPageSequence_t::const_iterator &b,
84 const SealedPageSequence_t::const_iterator &e)
86 {
87 }
88};
89
90} // namespace Internal
91} // namespace ROOT
92
93#endif // RSealedPage
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define e(i)
Definition RSha256.hxx:103
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
Definition RError.hxx:222
std::deque< RSealedPage > SealedPageSequence_t
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
A range of sealed pages referring to the same column that can be used for vector commit.
RSealedPageGroup(ROOT::DescriptorId_t d, const SealedPageSequence_t::const_iterator &b, const SealedPageSequence_t::const_iterator &e)
ROOT::DescriptorId_t fPhysicalColumnId
SealedPageSequence_t::const_iterator fLast
SealedPageSequence_t::const_iterator fFirst
A sealed page contains the bytes of a page as written to storage (packed & compressed).
static constexpr std::size_t kNBytesPageChecksum
The page checksum is a 64bit xxhash3.
void SetBufferSize(std::size_t bufferSize)
bool fHasChecksum
If set, the last 8 bytes of the buffer are the xxhash of the rest of the buffer.
RSealedPage(const RSealedPage &other)=default
std::size_t GetBufferSize() const
std::size_t GetDataSize() const
RSealedPage(RSealedPage &&other)=default
RSealedPage & operator=(const RSealedPage &other)=default
void SetNElements(std::uint32_t nElements)
void SetBuffer(const void *buffer)
RResult< std::uint64_t > GetChecksum() const
Returns a failure if the sealed page has no checksum.
const void * GetBuffer() const
RResult< void > VerifyChecksumIfEnabled() const
std::uint32_t GetNElements() const
RSealedPage(const void *buffer, std::size_t bufferSize, std::uint32_t nElements, bool hasChecksum=false)
std::size_t fBufferSize
Size of the page payload and the trailing checksum (if available)
void SetHasChecksum(bool hasChecksum)
RSealedPage & operator=(RSealedPage &&other)=default