50#ifndef R__LITTLE_ENDIAN
53#define R__LITTLE_ENDIAN 1
55#define R__LITTLE_ENDIAN 0
66 std::uint16_t fValBE = 0;
67 static std::uint16_t Swap(std::uint16_t val)
69#if R__LITTLE_ENDIAN == 1
70 return RByteSwap<
sizeof(val)>::bswap(val);
77 RUInt16BE() =
default;
78 explicit RUInt16BE(
const std::uint16_t val) : fValBE(Swap(val)) {}
79 operator std::uint16_t()
const {
return Swap(fValBE); }
80 RUInt16BE &
operator=(
const std::uint16_t val)
90 std::uint32_t fValBE = 0;
91 static std::uint32_t Swap(std::uint32_t val)
93#if R__LITTLE_ENDIAN == 1
94 return RByteSwap<
sizeof(val)>::bswap(val);
101 RUInt32BE() =
default;
102 explicit RUInt32BE(
const std::uint32_t val) : fValBE(Swap(val)) {}
103 operator std::uint32_t()
const {
return Swap(fValBE); }
104 RUInt32BE &
operator=(
const std::uint32_t val)
114 std::int32_t fValBE = 0;
115 static std::int32_t Swap(std::int32_t val)
117#if R__LITTLE_ENDIAN == 1
118 return RByteSwap<
sizeof(val)>::bswap(val);
125 RInt32BE() =
default;
126 explicit RInt32BE(
const std::int32_t val) : fValBE(Swap(val)) {}
127 operator std::int32_t()
const {
return Swap(fValBE); }
128 RInt32BE &
operator=(
const std::int32_t val)
138 std::uint64_t fValBE = 0;
139 static std::uint64_t Swap(std::uint64_t val)
141#if R__LITTLE_ENDIAN == 1
142 return RByteSwap<
sizeof(val)>::bswap(val);
149 RUInt64BE() =
default;
150 explicit RUInt64BE(
const std::uint64_t val) : fValBE(Swap(val)) {}
151 operator std::uint64_t()
const {
return Swap(fValBE); }
152 RUInt64BE &
operator=(
const std::uint64_t val)
162 unsigned char fLName{0};
164 RTFString() =
default;
165 RTFString(
const std::string &str)
170 fLName = str.length();
171 memcpy(fData, str.data(), fLName);
173 std::size_t GetSize()
const
187 auto now = std::chrono::system_clock::now();
188 auto tt = std::chrono::system_clock::to_time_t(
now);
190 fDatetime = (
tm.tm_year + 1900 - 1995) << 26 | (
tm.tm_mon + 1) << 22 |
tm.tm_mday << 17 |
tm.tm_hour << 12 |
191 tm.tm_min << 6 |
tm.tm_sec;
193 explicit RTFDatetime(RUInt32BE val) : fDatetime(val) {}
198 static constexpr unsigned kBigKeyVersion = 1000;
201 RUInt16BE fVersion{4};
202 RUInt32BE fObjLen{0};
203 RTFDatetime fDatetime;
204 RUInt16BE fKeyLen{0};
208 RUInt32BE fSeekKey{0};
209 RUInt32BE fSeekPdir{0};
212 RUInt64BE fSeekKey{0};
213 RUInt64BE fSeekPdir{0};
217 RTFKey() : fInfoLong() {}
224 fVersion = fVersion + kBigKeyVersion;
233 std::uint32_t GetSize()
const
241 std::uint32_t GetHeaderSize()
const
243 if (fVersion >= kBigKeyVersion)
244 return 18 +
sizeof(fInfoLong);
245 return 18 +
sizeof(fInfoShort);
248 std::uint64_t GetSeekKey()
const
250 if (fVersion >= kBigKeyVersion)
251 return fInfoLong.fSeekKey;
252 return fInfoShort.fSeekKey;
258 static constexpr unsigned kBEGIN = 100;
259 static constexpr unsigned kBigHeaderVersion = 1000000;
261 char fMagic[4]{
'r',
'o',
'o',
't'};
268 RUInt32BE fSeekFree{0};
269 RUInt32BE fNbytesFree{0};
271 RUInt32BE fNbytesName{0};
272 unsigned char fUnits{4};
273 RUInt32BE fCompress{0};
274 RUInt32BE fSeekInfo{0};
275 RUInt32BE fNbytesInfo{0};
279 RUInt64BE fSeekFree{0};
280 RUInt32BE fNbytesFree{0};
282 RUInt32BE fNbytesName{0};
283 unsigned char fUnits{8};
284 RUInt32BE fCompress{0};
285 RUInt64BE fSeekInfo{0};
286 RUInt32BE fNbytesInfo{0};
290 RTFHeader() : fInfoShort() {}
295 if (fVersion >= kBigHeaderVersion)
299 std::uint32_t end = fInfoShort.fEND;
300 std::uint32_t
seekFree = fInfoShort.fSeekFree;
301 std::uint32_t
nbytesFree = fInfoShort.fNbytesFree;
302 std::uint32_t
nFree = fInfoShort.fNfree;
303 std::uint32_t
nbytesName = fInfoShort.fNbytesName;
304 std::uint32_t
compress = fInfoShort.fCompress;
305 std::uint32_t
seekInfo = fInfoShort.fSeekInfo;
306 std::uint32_t
nbytesInfo = fInfoShort.fNbytesInfo;
307 fInfoLong.fEND = end;
310 fInfoLong.fNfree =
nFree;
312 fInfoLong.fUnits = 8;
316 fVersion = fVersion + kBigHeaderVersion;
322 return (fVersion >= kBigHeaderVersion) ||
323 (
offset >
static_cast<unsigned int>(std::numeric_limits<std::int32_t>::max()));
326 std::uint32_t GetSize()
const
328 std::uint32_t
sizeHead =
sizeof(fMagic) +
sizeof(fVersion) +
sizeof(fBEGIN);
330 return sizeHead +
sizeof(fInfoLong);
331 return sizeHead +
sizeof(fInfoShort);
334 std::uint64_t GetEnd()
const
337 return fInfoLong.fEND;
338 return fInfoShort.fEND;
345 fInfoLong.fEND =
value;
347 fInfoShort.fEND =
value;
351 std::uint64_t GetSeekFree()
const
354 return fInfoLong.fSeekFree;
355 return fInfoShort.fSeekFree;
362 fInfoLong.fSeekFree =
value;
364 fInfoShort.fSeekFree =
value;
371 fInfoLong.fNbytesFree =
value;
373 fInfoShort.fNbytesFree =
value;
380 fInfoLong.fNbytesName =
value;
382 fInfoShort.fNbytesName =
value;
386 std::uint64_t GetSeekInfo()
const
389 return fInfoLong.fSeekInfo;
390 return fInfoShort.fSeekInfo;
397 fInfoLong.fSeekInfo =
value;
399 fInfoShort.fSeekInfo =
value;
406 fInfoLong.fNbytesInfo =
value;
408 fInfoShort.fNbytesInfo =
value;
412 void SetCompression(std::uint32_t
value)
415 fInfoLong.fCompress =
value;
417 fInfoShort.fCompress =
value;
424 static constexpr unsigned kBigFreeEntryVersion = 1000;
426 RUInt16BE fVersion{1};
438 RTFFreeEntry() : fInfoShort() {}
439 void Set(std::uint64_t first, std::uint64_t last)
441 if (last >
static_cast<unsigned int>(std::numeric_limits<std::int32_t>::max())) {
442 fVersion = fVersion + kBigFreeEntryVersion;
443 fInfoLong.fFirst = first;
444 fInfoLong.fLast = last;
446 fInfoShort.fFirst = first;
447 fInfoShort.fLast = last;
450 std::uint32_t GetSize() {
return (fVersion >= kBigFreeEntryVersion) ? 18 : 10; }
456 std::uint32_t GetSize()
const {
return sizeof(RTFKeyList); }
457 explicit RTFKeyList(std::uint32_t
nKeys) : fNKeys(
nKeys) {}
462 static constexpr unsigned kBigFileVersion = 1000;
464 RUInt16BE fClassVersion{5};
467 RUInt32BE fNBytesKeys{0};
468 RUInt32BE fNBytesName{0};
472 RUInt32BE fSeekDir{RTFHeader::kBEGIN};
473 RUInt32BE fSeekParent{0};
474 RUInt32BE fSeekKeys{0};
477 RUInt64BE fSeekDir{RTFHeader::kBEGIN};
478 RUInt64BE fSeekParent{0};
479 RUInt64BE fSeekKeys{0};
483 RTFDirectory() : fInfoShort() {}
486 std::uint32_t GetSize()
const
488 if (fClassVersion >= kBigFileVersion)
489 return sizeof(RTFDirectory);
490 return 18 +
sizeof(fInfoShort);
493 std::uint64_t GetSeekKeys()
const
495 if (fClassVersion >= kBigFileVersion)
496 return fInfoLong.fSeekKeys;
497 return fInfoShort.fSeekKeys;
502 if (
seekKeys >
static_cast<unsigned int>(std::numeric_limits<std::int32_t>::max())) {
503 std::uint32_t
seekDir = fInfoShort.fSeekDir;
504 std::uint32_t
seekParent = fInfoShort.fSeekParent;
508 fClassVersion = fClassVersion + kBigFileVersion;
517 RUInt16BE fVersionClass{1};
518 unsigned char fUUID[16];
523 char *buffer =
reinterpret_cast<char *
>(
this);
525 assert(
reinterpret_cast<RTFUUID *
>(buffer) <= (
this + 1));
527 std::uint32_t GetSize()
const {
return sizeof(RTFUUID); }
536 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFNTuple) -
sizeof(fByteCount))};
537 RUInt16BE fVersionClass{2};
538 RUInt16BE fVersionEpoch{0};
539 RUInt16BE fVersionMajor{0};
540 RUInt16BE fVersionMinor{0};
541 RUInt16BE fVersionPatch{0};
542 RUInt64BE fSeekHeader{0};
543 RUInt64BE fNBytesHeader{0};
544 RUInt64BE fLenHeader{0};
545 RUInt64BE fSeekFooter{0};
546 RUInt64BE fNBytesFooter{0};
547 RUInt64BE fLenFooter{0};
548 RUInt64BE fMaxKeySize{0};
550 static constexpr std::uint32_t
GetSizePlusChecksum() {
return sizeof(RTFNTuple) +
sizeof(std::uint64_t); }
552 RTFNTuple() =
default;
567 std::uint32_t GetSize()
const {
return sizeof(RTFNTuple); }
569 std::uint32_t
GetOffsetCkData() {
return sizeof(fByteCount) +
sizeof(fVersionClass); }
575struct RBareFileHeader {
576 char fMagic[7]{
'r',
'n',
't',
'u',
'p',
'l',
'e'};
579 RUInt32BE fFormatVersion{1};
580 RUInt32BE fCompress{0};
594namespace Experimental {
669 if (std::string(
ident, 4) ==
"root")
679 std::string_view typeName)
692 for (
unsigned int i = 0; i <
nKeys; ++i) {
696 offset += key.GetHeaderSize();
700 if (std::string_view(
name.fData,
name.fLName) != typeName) {
708 return key.GetSeekKey();
737 auto pos = std::string::npos;
744 return R__FAIL(
"no directory named '" + std::string(
directoryName) +
"' in file '" + fRawFile->GetUrl() +
"'");
747 offset = key.GetSeekKey() + key.fKeyLen;
754 return R__FAIL(
"no RNTuple named '" + std::string(
ntupleName) +
"' in file '" + fRawFile->GetUrl() +
"'");
758 offset = key.GetSeekKey() + key.fKeyLen;
762 static_assert(
kMinNTupleSize == RTFNTuple::GetSizePlusChecksum());
764 return R__FAIL(
"invalid anchor size: " + std::to_string(key.fObjLen) +
" < " + std::to_string(
sizeof(RTFNTuple)));
771 auto objNbytes = key.GetSize() - key.fKeyLen;
780 auto lenCkData = key.fObjLen -
ntuple->GetOffsetCkData() -
sizeof(uint64_t);
784 RUInt64BE *
ckOnDiskPtr =
reinterpret_cast<RUInt64BE *
>(
bufAnchor.get() + key.fObjLen -
sizeof(uint64_t));
785 ckOnDisk =
static_cast<uint64_t
>(*ckOnDiskPtr);
787 return R__FAIL(
"RNTuple anchor checksum mismatch");
805 return R__FAIL(
"expected RNTuple named '" + std::string(
ntupleName) +
"' but instead found '" +
806 std::string(
foundName) +
"' in file '" + fRawFile->GetUrl() +
"'");
816 return R__FAIL(
"RNTuple bare file: anchor checksum mismatch");
826 if (fMaxKeySize == 0 ||
nbytes <= fMaxKeySize) {
834 uint8_t *
bufCur =
reinterpret_cast<uint8_t *
>(buffer);
904 static_assert(kHeaderBlockSize % kBlockAlign == 0,
"invalid header block size");
905 if (bufferSize % kBlockAlign != 0)
906 throw RException(
R__FAIL(
"Buffer size not a multiple of alignment: " + std::to_string(bufferSize)));
907 fBlockSize = bufferSize;
911 memset(fHeaderBlock, 0, kHeaderBlockSize);
913 memset(fBlock, 0, fBlockSize);
943 if (fBlockOffset == 0) {
968 if (fBlockOffset > 0) {
973 retval = fwrite(fHeaderBlock, 1, kHeaderBlockSize, fFile);
974 if (
retval != RFileSimple::kHeaderBlockSize)
988 if ((
offset >= 0) && (
static_cast<std::uint64_t
>(
offset) != fFilePos)) {
993 if (fFilePos < kHeaderBlockSize) {
1004 std::uint64_t
posInBlock = fFilePos % fBlockSize;
1012 retval = fwrite(fBlock, 1, fBlockSize, fFile);
1013 if (
retval != fBlockSize)
1017 memset(fBlock, 0, fBlockSize);
1021 std::size_t blockSize =
nbytes;
1026 buffer =
static_cast<const unsigned char *
>(buffer) + blockSize;
1028 fFilePos += blockSize;
1034 const std::string &className,
const std::string &objectName,
const std::string &title)
1043 Write(&key, key.GetHeaderSize(), fKeyOffset);
1080 fDirectory->GetFile()->Seek(
offset);
1081 bool rv = fDirectory->GetFile()->WriteBuffer((
char *)(buffer),
nbytes);
1104 if (
keyBlob.WasAllocatedInAFreeSlot()) {
1129std::unique_ptr<ROOT::Experimental::Internal::RNTupleFileWriter>
1134 std::string fileName(path);
1135 size_t idxDirSep = fileName.find_last_of(
"\\/");
1148 int fd = open(std::string(path).c_str(), flags, 0666);
1165 writer->fFileName = fileName;
1170 case EContainerFormat::kBare:
1174 default:
R__ASSERT(
false &&
"Internal error: unhandled container format");
1180std::unique_ptr<ROOT::Experimental::Internal::RNTupleFileWriter>
1186 throw RException(
R__FAIL(
"invalid attempt to add an RNTuple to a directory that is not backed by a file"));
1204 fFileProper.fDirectory->WriteObject(&fNTupleAnchor, fNTupleName.c_str());
1208 buf.
SetParent(fFileProper.fDirectory->GetFile());
1209 for (
auto [
_,
info] : fStreamerInfoMap)
1212 fFileProper.fDirectory->GetFile()->Write();
1226 fFileSimple.Flush();
1233 WriteTFileFreeList();
1236 memcpy(fFileSimple.fHeaderBlock, &fFileSimple.fControlBlock->fHeader, fFileSimple.fControlBlock->fHeader.GetSize());
1237 R__ASSERT(fFileSimple.fControlBlock->fSeekFileRecord + fFileSimple.fControlBlock->fFileRecord.GetSize() <
1238 RFileSimple::kHeaderBlockSize);
1239 memcpy(fFileSimple.fHeaderBlock + fFileSimple.fControlBlock->fSeekFileRecord,
1240 &fFileSimple.fControlBlock->fFileRecord, fFileSimple.fControlBlock->fFileRecord.GetSize());
1242 fFileSimple.Flush();
1253 const std::uint64_t
maxKeySize = fNTupleAnchor.fMaxKeySize;
1257 if (
static_cast<std::uint64_t
>(
len) >
static_cast<std::uint64_t
>(std::numeric_limits<std::uint32_t>::max()))
1319 offset = fFileSimple.fKeyOffset;
1320 fFileSimple.fKeyOffset +=
nbytes;
1345 fNTupleAnchor.fNBytesHeader =
nbytes;
1346 fNTupleAnchor.fSeekHeader =
offset;
1355 fNTupleAnchor.fNBytesFooter =
nbytes;
1356 fNTupleAnchor.fSeekFooter =
offset;
1370 fFileSimple.fControlBlock->fSeekNTuple = fFileSimple.fFilePos;
1374 fFileSimple.fKeyOffset = fFileSimple.fFilePos;
1385 for (
auto [
_,
info] : fStreamerInfoMap) {
1398 fFileSimple.fControlBlock->fHeader.SetSeekInfo(fFileSimple.fKeyOffset);
1414 fFileSimple.fControlBlock->fHeader.GetSeekInfo(), RTFHeader::kBEGIN,
"TList",
"StreamerInfo",
1415 "Doubly linked list");
1416 fFileSimple.fControlBlock->fHeader.SetNbytesInfo(fFileSimple.fFilePos -
1417 fFileSimple.fControlBlock->fHeader.GetSeekInfo());
1430 fFileSimple.fControlBlock->fFileRecord.SetSeekKeys(fFileSimple.fKeyOffset);
1434 fFileSimple.Write(&
keyKeyList,
keyKeyList.GetHeaderSize(), fFileSimple.fControlBlock->fFileRecord.GetSeekKeys());
1444 fFileSimple.fControlBlock->fFileRecord.fNBytesKeys =
1445 fFileSimple.fFilePos - fFileSimple.fControlBlock->fFileRecord.GetSeekKeys();
1446 fFileSimple.fKeyOffset = fFileSimple.fFilePos;
1451 fFileSimple.fControlBlock->fHeader.SetSeekFree(fFileSimple.fKeyOffset);
1457 std::uint64_t
firstFree = fFileSimple.fControlBlock->fHeader.GetSeekFree() +
keyFreeList.GetSize();
1460 fFileSimple.fControlBlock->fHeader.GetSeekFree(), RTFHeader::kBEGIN,
"", fFileName,
"");
1461 fFileSimple.fControlBlock->fHeader.SetNbytesFree(fFileSimple.fFilePos -
1462 fFileSimple.fControlBlock->fHeader.GetSeekFree());
1463 fFileSimple.fControlBlock->fHeader.SetEnd(fFileSimple.fFilePos);
1474 fFileSimple.fControlBlock->fSeekNTuple = fFileSimple.fKeyOffset;
1476 char keyBuf[RTFNTuple::GetSizePlusChecksum()];
1483 char zipAnchor[RTFNTuple::GetSizePlusChecksum()];
1487 RTFHeader::kBEGIN,
"ROOT::RNTuple", fNTupleName,
"");
1505 fFileSimple.fControlBlock->fFileRecord.fNBytesName =
nbytesName;
1506 fFileSimple.fControlBlock->fHeader.SetNbytesName(
nbytesName);
1508 fFileSimple.Write(&
keyRoot,
keyRoot.GetHeaderSize(), RTFHeader::kBEGIN);
1517 fFileSimple.fControlBlock->fSeekFileRecord = fFileSimple.fFilePos;
1518 fFileSimple.Write(&fFileSimple.fControlBlock->fFileRecord, fFileSimple.fControlBlock->fFileRecord.GetSize());
1519 fFileSimple.Write(&uuid, uuid.GetSize());
1523 for (
int i = 0; i < 3; ++i)
1525 fFileSimple.fKeyOffset = fFileSimple.fFilePos;
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
static void PrepareBlobKey(std::int64_t offset, size_t nbytes, size_t len, unsigned char buffer[kBlobKeyLen])
Prepare a blob key in the provided buffer, which must provide space for kBlobKeyLen bytes.
static size_t ComputeNumChunks(size_t nbytes, size_t maxChunkSize)
static constexpr auto kBlobKeyLen
#define ROOT_VERSION_CODE
#define ClassDefInlineOverride(name, id)
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.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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 Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Binding & operator=(OUT(*fun)(void))
void ReadBuffer(char *&buffer) override
The RKeyBlob writes an invisible key into a TFile.
void Reserve(size_t nbytes, std::uint64_t *seekKey)
Register a new key for a data record of size nbytes.
bool WasAllocatedInAFreeSlot() const
std::uint64_t SearchInDirectory(std::uint64_t &offsetDir, std::string_view keyName, std::string_view typeName)
Searches for a key with the given name and type in the key index of the directory starting at offsetD...
RMiniFileReader()=default
RResult< RNTuple > GetNTuple(std::string_view ntupleName)
Extracts header and footer location for the RNTuple identified by ntupleName.
void ReadBuffer(void *buffer, size_t nbytes, std::uint64_t offset)
Reads a given byte range from the file into the provided memory buffer.
RResult< RNTuple > GetNTupleBare(std::string_view ntupleName)
Used when the file container turns out to be a bare file.
RResult< RNTuple > GetNTupleProper(std::string_view ntuplePath)
Used when the file turns out to be a TFile container.
size_t Zip(const void *from, size_t nbytes, int compression, Writer_t fnWriter)
Returns the size of the compressed data.
Helper class to uncompress data blocks in the ROOT compression frame format.
Write RNTuple data blocks in a TFile or a bare file container.
RNTupleFileWriter(std::string_view name, std::uint64_t maxKeySize)
std::uint64_t WriteBlob(const void *data, size_t nbytes, size_t len)
Writes a new record as an RBlob key into the file.
std::uint64_t WriteNTupleFooter(const void *data, size_t nbytes, size_t lenFooter)
Writes the compressed footer and registeres its location; lenFooter is the size of the uncompressed f...
void UpdateStreamerInfos(const RNTupleSerializer::StreamerInfoMap_t &streamerInfos)
Ensures that the streamer info records passed as argument are written to the file.
void WriteTFileStreamerInfo(int compression)
Write the compressed streamer info record with the description of the RNTuple class.
RFileSimple fFileSimple
For simple use cases, survives without libRIO dependency.
void WriteTFileKeysList(std::uint64_t anchorSize)
Write the TList with the RNTuple key.
void WriteTFileFreeList()
Last record in the file.
EContainerFormat
For testing purposes, RNTuple data can be written into a bare file container instead of a ROOT file.
std::uint64_t ReserveBlob(size_t nbytes, size_t len, unsigned char keyBuffer[kBlobKeyLen]=nullptr)
Reserves a new record as an RBlob key in the file.
std::uint64_t WriteTFileNTupleKey(int compression)
The only key that will be visible in file->ls() Returns the size on disk of the anchor object.
static std::unique_ptr< RNTupleFileWriter > Recreate(std::string_view ntupleName, std::string_view path, EContainerFormat containerFormat, const RNTupleWriteOptions &options)
Create or truncate the local file given by path with the new empty RNTuple identified by ntupleName.
static std::unique_ptr< RNTupleFileWriter > Append(std::string_view ntupleName, TDirectory &fileOrDirectory, std::uint64_t maxKeySize)
The directory parameter can also be a TFile object (TFile inherits from TDirectory).
void Commit(int compression=RCompressionSetting::EDefaults::kUseGeneralPurpose)
Writes the RNTuple key to the file so that the header and footer keys can be found.
void WriteTFileSkeleton(int defaultCompression)
For a TFile container written by a C file stream, write the header and TFile object.
void WriteBareFileSkeleton(int defaultCompression)
For a bare file, which is necessarily written by a C file stream, write file header.
static constexpr std::size_t kBlobKeyLen
The key length of a blob. It is always a big key (version > 1000) with class name RBlob.
std::uint64_t WriteNTupleHeader(const void *data, size_t nbytes, size_t lenHeader)
Writes the compressed header and registeres its location; lenHeader is the size of the uncompressed h...
RNTuple fNTupleAnchor
Header and footer location of the ntuple, written on Commit()
void WriteIntoReservedBlob(const void *buffer, size_t nbytes, std::int64_t offset)
Write into a reserved record; the caller is responsible for making sure that the written byte range i...
RNTupleSerializer::StreamerInfoMap_t fStreamerInfoMap
Set of streamer info records that should be written to the file.
static std::uint32_t SerializeUInt64(std::uint64_t val, void *buffer)
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
static std::uint32_t DeserializeUInt64(const void *buffer, std::uint64_t &val)
Common user-tunable settings for storing ntuples.
std::size_t GetWriteBufferSize() const
bool GetUseDirectIO() const
std::uint32_t GetCompression() const
std::uint64_t GetMaxKeySize() const
The RRawFile provides read-only access to local and remote files.
Base class for all ROOT issued exceptions.
Representation of an RNTuple data set in a ROOT file.
std::uint64_t fMaxKeySize
The maximum size for a TKey payload. Payloads bigger than this size will be written as multiple blobs...
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
void TagStreamerInfo(TVirtualStreamerInfo *info) override
Mark the classindex of the current file as using this TStreamerInfo.
void SetParent(TObject *parent)
Set parent owning this buffer.
void SetBufferOffset(Int_t offset=0)
Describe directory structure in memory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Int_t Sizeof() const override
Return the size in bytes of the key header structure.
Int_t fVersion
Key version identifier.
Int_t fLeft
Number of bytes left in current segment.
Short_t fKeylen
Number of bytes for the key itself.
Long64_t fSeekKey
Location of object on file.
virtual void Create(Int_t nbytes, TFile *f=nullptr)
Create a TKey object of specified size.
TString fClassName
Object Class name.
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
void FillBuffer(char *&buffer)
Stream UUID into output buffer.
RNTuple CreateAnchor(std::uint16_t versionEpoch, std::uint16_t versionMajor, std::uint16_t versionMinor, std::uint16_t versionPatch, std::uint64_t seekHeader, std::uint64_t nbytesHeader, std::uint64_t lenHeader, std::uint64_t seekFooter, std::uint64_t nbytesFooter, std::uint64_t lenFooter, std::uint64_t maxKeySize)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Helper templated class for swapping bytes; specializations for N={2,4,8} are provided below.
void Write(const void *buffer, size_t nbytes, std::int64_t offset)
Low-level writing using a TFile.
std::uint64_t ReserveBlobKey(size_t nbytes, size_t len, unsigned char keyBuffer[kBlobKeyLen]=nullptr)
Reserves an RBlob opaque key as data record and returns the offset of the record.
void AllocateBuffers(std::size_t bufferSize)
std::unique_ptr< ROOT::Experimental::Internal::RTFileControlBlock > fControlBlock
Keeps track of TFile control structures, which need to be updated on committing the data set.
void Write(const void *buffer, size_t nbytes, std::int64_t offset=-1)
Writes bytes in the open stream, either at fFilePos or at the given offset.
std::uint64_t ReserveBlobKey(std::size_t nbytes, std::size_t len, unsigned char keyBuffer[kBlobKeyLen]=nullptr)
Reserves an RBlob opaque key as data record and returns the offset of the record.
std::uint64_t WriteKey(const void *buffer, std::size_t nbytes, std::size_t len, std::int64_t offset=-1, std::uint64_t directoryOffset=100, const std::string &className="", const std::string &objectName="", const std::string &title="")
Writes a TKey including the data record, given by buffer, into fFile; returns the file offset to the ...
If a TFile container is written by a C stream (simple file), on dataset commit, the file header and t...
std::uint64_t fSeekNTuple
std::uint64_t fSeekFileRecord