49enum EDaosMapping { kOidPerCluster, kOidPerPage };
53 DistributionKey_t fDkey;
61static constexpr DistributionKey_t kDistributionKeyDefault = 0x5a3c69f0cafe4a11;
62static constexpr AttributeKey_t kAttributeKeyDefault = 0x4243544b53444229;
63static constexpr AttributeKey_t kAttributeKeyAnchor = 0x4243544b5344422a;
64static constexpr AttributeKey_t kAttributeKeyHeader = 0x4243544b5344422b;
65static constexpr AttributeKey_t kAttributeKeyFooter = 0x4243544b5344422c;
73static constexpr EDaosMapping kDefaultDaosMapping = kOidPerCluster;
75template <EDaosMapping mapping>
77 long unsigned columnId,
long unsigned pageCount)
79 if constexpr (mapping == kOidPerCluster) {
82 static_cast<DistributionKey_t
>(columnId),
static_cast<AttributeKey_t
>(pageCount)};
83 }
else if constexpr (mapping == kOidPerPage) {
86 kDistributionKeyDefault, kAttributeKeyDefault};
92 std::string fPoolLabel;
94 std::string fContainerLabel;
100RDaosURI ParseDaosURI(std::string_view uri)
102 std::regex re(
"daos://([^/]+)/(.+)");
104 if (!std::regex_match(uri.data(),
m, re))
113 auto position =
static_cast<uint32_t
>(address.
fLocation & 0xFFFFFFFF);
115 return {position,
offset};
122 uint64_t address = (position & 0xFFFFFFFF) | (
offset << 32);
133struct RDaosContainerNTupleLocator {
136 std::optional<ROOT::Experimental::Internal::RDaosNTupleAnchor> fAnchor;
139 RDaosContainerNTupleLocator() =
default;
140 explicit RDaosContainerNTupleLocator(
const std::string &ntupleName) : fName(ntupleName), fIndex(
Hash(ntupleName)){};
142 bool IsValid() {
return fAnchor.has_value() && fAnchor->fNBytesHeader; }
147 uint64_t
h = std::hash<std::string>{}(ntupleName);
149 auto seed =
static_cast<uint32_t
>(
h >> 32);
150 seed ^=
static_cast<uint32_t
>(
h & 0xffffffff) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
152 return (hash == kReservedIndex) ? kReservedIndex + 1 : hash;
155 int InitNTupleDescriptorBuilder(ROOT::Experimental::Internal::RDaosContainer &cont,
156 ROOT::Experimental::Internal::RNTupleDecompressor &decompressor,
157 ROOT::Experimental::Internal::RNTupleDescriptorBuilder &builder)
159 std::unique_ptr<unsigned char[]> buffer, zipBuffer;
160 auto &anchor = fAnchor.emplace();
164 daos_obj_id_t oidMetadata{kOidLowMetadata,
static_cast<decltype(
daos_obj_id_t::hi)
>(this->GetIndex())};
166 buffer = std::make_unique<unsigned char[]>(anchorSize);
167 if ((err = cont.
ReadSingleAkey(buffer.get(), anchorSize, oidMetadata, kDistributionKeyDefault,
168 kAttributeKeyAnchor, kCidMetadata))) {
172 anchor.Deserialize(buffer.get(), anchorSize).Unwrap();
174 throw ROOT::Experimental::RException(
175 R__FAIL(
"unsupported RNTuple epoch version: " + std::to_string(anchor.fVersionEpoch)));
177 if (anchor.fVersionEpoch == 0) {
178 static std::once_flag once;
179 std::call_once(once, [&anchor]() {
181 <<
"Pre-release format version: RC " << anchor.fVersionMajor;
186 buffer = std::make_unique<unsigned char[]>(anchor.fLenHeader);
187 zipBuffer = std::make_unique<unsigned char[]>(anchor.fNBytesHeader);
188 if ((err = cont.
ReadSingleAkey(zipBuffer.get(), anchor.fNBytesHeader, oidMetadata, kDistributionKeyDefault,
189 kAttributeKeyHeader, kCidMetadata)))
191 decompressor.
Unzip(zipBuffer.get(), anchor.fNBytesHeader, anchor.fLenHeader, buffer.get());
195 buffer = std::make_unique<unsigned char[]>(anchor.fLenFooter);
196 zipBuffer = std::make_unique<unsigned char[]>(anchor.fNBytesFooter);
197 if ((err = cont.
ReadSingleAkey(zipBuffer.get(), anchor.fNBytesFooter, oidMetadata, kDistributionKeyDefault,
198 kAttributeKeyFooter, kCidMetadata)))
200 decompressor.
Unzip(zipBuffer.get(), anchor.fNBytesFooter, anchor.fLenFooter, buffer.get());
206 static std::pair<RDaosContainerNTupleLocator, ROOT::Experimental::Internal::RNTupleDescriptorBuilder>
207 LocateNTuple(ROOT::Experimental::Internal::RDaosContainer &cont,
const std::string &ntupleName,
208 ROOT::Experimental::Internal::RNTupleDecompressor &decompressor)
210 auto result = std::make_pair(RDaosContainerNTupleLocator(ntupleName),
211 ROOT::Experimental::Internal::RNTupleDescriptorBuilder());
214 auto &builder =
result.second;
216 if (
int err = loc.InitNTupleDescriptorBuilder(cont, decompressor, builder); !err) {
219 throw ROOT::Experimental::RException(
220 R__FAIL(
"LocateNTuple: ntuple name '" + ntupleName +
"' unavailable in this container."));
234 if (buffer !=
nullptr) {
235 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
254 return R__FAIL(
"DAOS anchor too short");
257 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
274 return result.Unwrap() + 32;
290 static std::once_flag once;
291 std::call_once(once, []() {
293 <<
"Do not store real data with this version of RNTuple!";
295 fCompressor = std::make_unique<RNTupleCompressor>();
306 if (oclass.IsUnknown())
313 auto args = ParseDaosURI(
fURI);
314 auto pool = std::make_shared<RDaosPool>(args.fPoolLabel);
316 fDaosContainer = std::make_unique<RDaosContainer>(pool, args.fContainerLabel,
true);
323 auto zipBuffer = std::make_unique<unsigned char[]>(
length);
347 auto offsetData =
fPageId.fetch_add(1);
352 RDaosKey daosKey = GetPageDaosKey<kDefaultDaosMapping>(
fNTupleIndex, clusterId, physicalColumnId, offsetData);
357 result.fPosition = EncodeDaosPagePosition(offsetData);
366std::vector<ROOT::Experimental::RNTupleLocator>
370 std::vector<ROOT::Experimental::RNTupleLocator> locators;
373 return c + std::distance(r.fFirst, r.fLast);
375 locators.reserve(nPages);
382 int64_t payloadSz = 0;
383 std::size_t positionOffset;
384 uint32_t positionIndex;
387 for (
auto &range : ranges) {
392 positionIndex = useCaging ?
fPageId.fetch_add(1) :
fPageId.load();
394 for (
auto sealedPageIt = range.fFirst; sealedPageIt != range.fLast; ++sealedPageIt) {
398 if (positionOffset + s.
fSize > maxCageSz) {
400 positionIndex =
fPageId.fetch_add(1);
407 GetPageDaosKey<kDefaultDaosMapping>(
fNTupleIndex, clusterId, range.fPhysicalColumnId, positionIndex);
410 it->second.Insert(daosKey.fAkey, pageIov);
413 locator.
fPosition = EncodeDaosPagePosition(positionIndex, positionOffset);
417 locators.push_back(locator);
419 positionOffset += s.
fSize;
420 payloadSz += s.
fSize;
432 fCounters->fSzWritePayload.Add(payloadSz);
446 auto bufPageListZip = std::make_unique<unsigned char[]>(
length);
452 bufPageListZip.get(), szPageListZip,
453 daos_obj_id_t{kOidLowPageList, static_cast<decltype(daos_obj_id_t::hi)>(fNTupleIndex)}, kDistributionKeyDefault,
454 offsetData, kCidMetadata);
457 result.fBytesOnStorage = szPageListZip;
459 fCounters->fSzWritePayload.Add(
static_cast<int64_t
>(szPageListZip));
466 auto bufFooterZip = std::make_unique<unsigned char[]>(
length);
477 kDistributionKeyDefault, kAttributeKeyHeader, kCidMetadata);
486 kDistributionKeyDefault, kAttributeKeyFooter, kCidMetadata);
494 auto buffer = std::make_unique<unsigned char[]>(ntplSize);
497 buffer.get(), ntplSize,
daos_obj_id_t{kOidLowMetadata, static_cast<decltype(daos_obj_id_t::hi)>(fNTupleIndex)},
498 kDistributionKeyDefault, kAttributeKeyAnchor, kCidMetadata);
527 auto args = ParseDaosURI(uri);
528 auto pool = std::make_shared<RDaosPool>(args.fPoolLabel);
529 fDaosContainer = std::make_unique<RDaosContainer>(pool, args.fContainerLabel);
537 std::unique_ptr<unsigned char[]> buffer, zipBuffer;
539 auto [locator, descBuilder] =
541 if (!locator.IsValid())
543 R__FAIL(
"Attach: requested ntuple '" +
fNTupleName +
"' is not present in DAOS container."));
546 if (oclass.IsUnknown())
553 auto desc = descBuilder.MoveDescriptor();
555 for (
const auto &cgDesc : desc.GetClusterGroupIterable()) {
556 buffer = std::make_unique<unsigned char[]>(cgDesc.GetPageListLength());
557 zipBuffer = std::make_unique<unsigned char[]>(cgDesc.GetPageListLocator().fBytesOnStorage);
559 zipBuffer.get(), cgDesc.GetPageListLocator().fBytesOnStorage, oidPageList, kDistributionKeyDefault,
561 fDecompressor->Unzip(zipBuffer.get(), cgDesc.GetPageListLocator().fBytesOnStorage, cgDesc.GetPageListLength(),
583 const auto &clusterDescriptor = descriptorGuard->GetClusterDescriptor(clusterId);
584 pageInfo = clusterDescriptor.GetPageRange(physicalColumnId).Find(clusterIndex.
GetIndex());
589 R__FAIL(
"accessing caged pages is only supported in conjunction with cluster cache"));
593 sealedPage.
fSize = bytesOnStorage;
598 RDaosKey daosKey = GetPageDaosKey<kDefaultDaosMapping>(
601 daosKey.fDkey, daosKey.fAkey);
613 const auto clusterId = clusterInfo.
fClusterId;
614 const auto &pageInfo = clusterInfo.
fPageInfo;
617 const auto elementSize = element->
GetSize();
618 const auto bytesOnStorage = pageInfo.fLocator.fBytesOnStorage;
620 const void *sealedPageBuffer =
nullptr;
621 std::unique_ptr<unsigned char[]> directReadBuffer;
625 pageZero.GrowUnchecked(pageInfo.fNElements);
626 pageZero.SetWindow(clusterInfo.
fColumnOffset + pageInfo.fFirstInPage,
635 R__FAIL(
"accessing caged pages is only supported in conjunction with cluster cache"));
638 directReadBuffer = std::unique_ptr<unsigned char[]>(
new unsigned char[bytesOnStorage]);
639 RDaosKey daosKey = GetPageDaosKey<kDefaultDaosMapping>(
641 fDaosContainer->ReadSingleAkey(directReadBuffer.get(), bytesOnStorage, daosKey.fOid, daosKey.fDkey,
645 fCounters->fSzReadPayload.Add(bytesOnStorage);
646 sealedPageBuffer = directReadBuffer.get();
653 if (!cachedPage.IsNull())
658 R__ASSERT(onDiskPage && (bytesOnStorage == onDiskPage->GetSize()));
659 sealedPageBuffer = onDiskPage->GetAddress();
665 newPage =
UnsealPage({sealedPageBuffer, bytesOnStorage, pageInfo.fNElements}, *element, columnId);
666 fCounters->fSzUnzip.Add(elementSize * pageInfo.fNElements);
681 auto cachedPage =
fPagePool->GetPage(columnId, globalIndex);
682 if (!cachedPage.IsNull())
685 std::uint64_t idxInCluster;
689 clusterInfo.
fClusterId = descriptorGuard->FindClusterId(columnId, globalIndex);
692 throw RException(
R__FAIL(
"entry with index " + std::to_string(globalIndex) +
" out of bounds"));
694 const auto &clusterDescriptor = descriptorGuard->GetClusterDescriptor(clusterInfo.
fClusterId);
695 clusterInfo.
fColumnOffset = clusterDescriptor.GetColumnRange(columnId).fFirstElementIndex;
698 clusterInfo.
fPageInfo = clusterDescriptor.GetPageRange(columnId).Find(idxInCluster);
707 const auto idxInCluster = clusterIndex.
GetIndex();
709 auto cachedPage =
fPagePool->GetPage(columnId, clusterIndex);
710 if (!cachedPage.IsNull())
719 const auto &clusterDescriptor = descriptorGuard->GetClusterDescriptor(clusterId);
721 clusterInfo.
fColumnOffset = clusterDescriptor.GetColumnRange(columnId).fFirstElementIndex;
722 clusterInfo.
fPageInfo = clusterDescriptor.GetPageRange(columnId).Find(idxInCluster);
736 return std::unique_ptr<RPageSourceDaos>(
clone);
739std::vector<std::unique_ptr<ROOT::Experimental::Internal::RCluster>>
742 struct RDaosSealedPageLocator {
746 std::uint64_t fPosition = 0;
747 std::uint64_t fCageOffset = 0;
748 std::uint64_t fSize = 0;
755 auto fnPrepareSingleCluster = [&](
const RCluster::RKey &clusterKey,
760 std::unordered_map<std::uint32_t, std::vector<RDaosSealedPageLocator>> onDiskPages;
762 unsigned clusterBufSz = 0, nPages = 0;
763 auto pageZeroMap = std::make_unique<ROnDiskPageMap>();
767 const auto &pageLocator = pageInfo.
fLocator;
768 uint32_t position,
offset;
769 std::tie(position,
offset) =
771 auto [itLoc,
_] = onDiskPages.emplace(position, std::vector<RDaosSealedPageLocator>());
773 itLoc->second.push_back(
774 {clusterId, physicalColumnId, pageNo, position,
offset, pageLocator.fBytesOnStorage});
776 clusterBufSz += pageLocator.fBytesOnStorage;
779 auto clusterBuffer =
new unsigned char[clusterBufSz];
780 auto pageMap = std::make_unique<ROnDiskPageMapHeap>(std::unique_ptr<
unsigned char[]>(clusterBuffer));
782 auto cageBuffer = clusterBuffer;
784 for (
auto &[cageIndex, pageVec] : onDiskPages) {
785 auto columnId = pageVec[0].fColumnId;
786 std::size_t cageSz = 0;
788 for (
auto &s : pageVec) {
789 assert(columnId == s.fColumnId);
790 assert(cageIndex == s.fPosition);
793 pageMap->Register(key,
ROnDiskPage(cageBuffer + s.fCageOffset, s.fSize));
801 RDaosKey daosKey = GetPageDaosKey<kDefaultDaosMapping>(
fNTupleIndex, clusterId, columnId, cageIndex);
804 itReq->second.Insert(daosKey.fAkey, iov);
806 cageBuffer += cageSz;
809 fCounters->fSzReadPayload.Add(clusterBufSz);
811 auto cluster = std::make_unique<RCluster>(clusterId);
812 cluster->Adopt(std::move(pageMap));
813 cluster->Adopt(std::move(pageZeroMap));
815 cluster->SetColumnAvailable(colId);
819 fCounters->fNClusterLoaded.Add(clusterKeys.size());
821 std::vector<std::unique_ptr<ROOT::Experimental::Internal::RCluster>> clusters;
823 for (
auto key : clusterKeys) {
824 clusters.emplace_back(fnPrepareSingleCluster(key, readRequests));
833 fCounters->fNRead.Add(readRequests.size());
842 const auto clusterId = cluster->
GetId();
844 const auto &clusterDescriptor = descriptorGuard->GetClusterDescriptor(clusterId);
846 std::vector<std::unique_ptr<RColumnElementBase>> allElements;
849 for (
const auto columnId : columnsInCluster) {
850 const auto &columnDesc = descriptorGuard->GetColumnDescriptor(columnId);
854 const auto &pageRange = clusterDescriptor.GetPageRange(columnId);
855 std::uint64_t pageNo = 0;
856 std::uint64_t firstInPage = 0;
857 for (
const auto &pi : pageRange.fPageInfos) {
860 R__ASSERT(onDiskPage && (onDiskPage->GetSize() == pi.fLocator.fBytesOnStorage));
862 auto taskFunc = [
this, columnId, clusterId, firstInPage, onDiskPage, element = allElements.back().get(),
863 nElements = pi.fNElements,
864 indexOffset = clusterDescriptor.GetColumnRange(columnId).fFirstElementIndex]() {
865 auto newPage =
UnsealPage({onDiskPage->GetAddress(), onDiskPage->GetSize(), nElements}, *element, columnId);
866 fCounters->fSzUnzip.Add(element->GetSize() * nElements);
875 firstInPage += pi.fNElements;
#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...
#define R__LOG_WARNING(...)
TObject * clone(const char *newname) const override
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 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 r
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 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 bytes
UInt_t Hash(const TString &s)
Managed a set of clusters containing compressed and packed pages.
An in-memory subset of the packed and compressed pages of a cluster.
const ColumnSet_t & GetAvailPhysicalColumns() const
const ROnDiskPage * GetOnDiskPage(const ROnDiskPage::Key &key) const
size_t GetNOnDiskPages() const
DescriptorId_t GetId() const
std::size_t GetSize() const
static std::unique_ptr< RColumnElementBase > Generate(EColumnType type)
If CppT == void, use the default C++ type for the given column type.
RColumnElementBase * GetElement() const
RDaosObject::DistributionKey_t DistributionKey_t
std::unordered_map< ROidDkeyPair, RWOperation, ROidDkeyPair::Hash > MultiObjectRWOperation_t
int ReadSingleAkey(void *buffer, std::size_t length, daos_obj_id_t oid, DistributionKey_t dkey, AttributeKey_t akey, ObjClassId_t cid)
Read data from a single object attribute key to the given buffer.
RDaosObject::AttributeKey_t AttributeKey_t
static Writer_t MakeMemCopyWriter(unsigned char *dest)
Helper class to uncompress data blocks in the ROOT compression frame format.
void Unzip(const void *from, size_t nbytes, size_t dataLen, void *to)
The nbytes parameter provides the size ls of the from buffer.
void SetOnDiskHeaderSize(std::uint64_t size)
void AddToOnDiskFooterSize(std::uint64_t size)
The real footer size also include the page list envelopes.
const RNTupleDescriptor & GetDescriptor() const
A helper class for serializing and deserialization of the RNTuple binary format.
static std::uint32_t DeserializeUInt16(const void *buffer, std::uint16_t &val)
static RResult< void > DeserializeHeader(const void *buffer, std::uint64_t bufSize, RNTupleDescriptorBuilder &descBuilder)
static RResult< void > DeserializeFooter(const void *buffer, std::uint64_t bufSize, RNTupleDescriptorBuilder &descBuilder)
static std::uint32_t SerializeString(const std::string &val, void *buffer)
static std::uint32_t DeserializeUInt32(const void *buffer, std::uint32_t &val)
static std::uint32_t SerializeUInt64(std::uint64_t val, void *buffer)
static RResult< void > DeserializePageList(const void *buffer, std::uint64_t bufSize, DescriptorId_t clusterGroupId, RNTupleDescriptor &desc)
static std::uint32_t DeserializeUInt64(const void *buffer, std::uint64_t &val)
static RResult< std::uint32_t > DeserializeString(const void *buffer, std::uint64_t bufSize, std::string &val)
static std::uint32_t SerializeUInt16(std::uint16_t val, void *buffer)
static std::uint32_t SerializeUInt32(std::uint32_t val, void *buffer)
A page as being stored on disk, that is packed and compressed.
Uses standard C++ memory allocation for the column data pages.
static void DeletePage(const RPage &page)
Releases the memory pointed to by page and resets the page's information.
A closure that can free the memory associated with a mapped page.
std::unique_ptr< RCounters > fCounters
RPagePersistentSink(std::string_view ntupleName, const RNTupleWriteOptions &options)
Internal::RNTupleDescriptorBuilder fDescriptorBuilder
void EnableDefaultMetrics(const std::string &prefix)
Enables the default set of metrics provided by RPageSink.
A thread-safe cache of column pages.
RPage ReservePage(ColumnHandle_t columnHandle, std::size_t nElements) final
Get a new, empty page for the given column that can be filled with up to nElements.
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...
void ReleasePage(RPage &page) final
Every page store needs to be able to free pages it handed out.
RPageSinkDaos(std::string_view ntupleName, std::string_view uri, const RNTupleWriteOptions &options)
std::vector< RNTupleLocator > CommitSealedPageVImpl(std::span< RPageStorage::RSealedPageGroup > ranges) final
Vector commit of preprocessed pages.
std::unique_ptr< RDaosContainer > fDaosContainer
Underlying DAOS container.
ntuple_index_t fNTupleIndex
std::uint64_t fNBytesCurrentCluster
Tracks the number of bytes committed to the current cluster.
std::string fURI
A URI to a DAOS pool of the form 'daos://pool-label/container-label'.
RDaosNTupleAnchor fNTupleAnchor
void WriteNTupleFooter(const void *data, size_t nbytes, size_t lenFooter)
void WriteNTupleHeader(const void *data, size_t nbytes, size_t lenHeader)
void InitImpl(unsigned char *serializedHeader, std::uint32_t length) final
std::atomic< std::uint64_t > fPageId
Page identifier for the next committed page; it is automatically incremented in CommitSealedPageImpl(...
std::atomic< std::uint64_t > fClusterGroupId
Cluster group counter for the next committed cluster pagelist; incremented in CommitClusterGroupImpl(...
void CommitDatasetImpl(unsigned char *serializedFooter, std::uint32_t length) final
~RPageSinkDaos() override
std::uint64_t CommitClusterImpl() final
Returns the number of bytes written to storage (excluding metadata)
RNTupleLocator CommitPageImpl(ColumnHandle_t columnHandle, const RPage &page) final
std::unique_ptr< RPageAllocatorHeap > fPageAllocator
RNTupleLocator CommitSealedPageImpl(DescriptorId_t physicalColumnId, const RPageStorage::RSealedPage &sealedPage) final
const RNTupleWriteOptions & GetWriteOptions() const
Returns the sink's write options.
RSealedPage SealPage(const RPage &page, const RColumnElementBase &element, int compressionSetting)
Helper for streaming a page.
std::unique_ptr< RNTupleCompressor > fCompressor
Helper to zip pages and header/footer; includes a 16MB (kMAXZIPBUF) zip buffer.
std::unique_ptr< RNTupleWriteOptions > fOptions
std::string GetObjectClass() const
Return the object class used for user data OIDs in this ntuple.
std::unique_ptr< RClusterPool > fClusterPool
The cluster pool asynchronously preloads the next few clusters.
RCluster * fCurrentCluster
The last cluster from which a page got populated. Points into fClusterPool->fPool.
std::string fURI
A URI to a DAOS pool of the form 'daos://pool-label/container-label'.
std::vector< std::unique_ptr< RCluster > > LoadClusters(std::span< RCluster::RKey > clusterKeys) final
Populates all the pages of the given cluster ids and columns; it is possible that some columns do not...
RPageSourceDaos(std::string_view ntupleName, std::string_view uri, const RNTupleReadOptions &options)
void UnzipClusterImpl(RCluster *cluster) final
ntuple_index_t fNTupleIndex
RPage PopulatePageFromCluster(ColumnHandle_t columnHandle, const RClusterInfo &clusterInfo, ClusterSize_t::ValueType idxInCluster)
~RPageSourceDaos() override
void LoadSealedPage(DescriptorId_t physicalColumnId, RClusterIndex clusterIndex, RSealedPage &sealedPage) final
Read the packed and compressed bytes of a page into the memory buffer provided by selaedPage.
RNTupleDescriptor AttachImpl() final
void ReleasePage(RPage &page) final
Every page store needs to be able to free pages it handed out.
RPage PopulatePage(ColumnHandle_t columnHandle, NTupleSize_t globalIndex) final
Allocates and fills a page that contains the index-th element.
std::unique_ptr< RPageSource > Clone() const final
The cloned page source creates a new connection to the pool/container.
std::shared_ptr< RPagePool > fPagePool
Populated pages might be shared; the page pool might, at some point, be used by multiple page sources...
std::unique_ptr< RDaosContainer > fDaosContainer
A container that stores object data (header/footer, pages, etc.)
RPageSource(std::string_view ntupleName, const RNTupleReadOptions &fOptions)
RNTupleReadOptions fOptions
void PrepareLoadCluster(const RCluster::RKey &clusterKey, ROnDiskPageMap &pageZeroMap, std::function< void(DescriptorId_t, NTupleSize_t, const RClusterDescriptor::RPageRange::RPageInfo &)> perPageFunc)
Prepare a page range read for the column set in clusterKey.
std::unique_ptr< RCounters > fCounters
RActivePhysicalColumns fActivePhysicalColumns
The active columns are implicitly defined by the model fields or views.
void EnableDefaultMetrics(const std::string &prefix)
Enables the default set of metrics provided by RPageSource.
RPage UnsealPage(const RSealedPage &sealedPage, const RColumnElementBase &element, DescriptorId_t physicalColumnId)
Helper for unstreaming a page.
std::unique_ptr< RNTupleDecompressor > fDecompressor
Helper to unzip pages and header/footer; comprises a 16MB (kMAXZIPBUF) unzip buffer.
const RSharedDescriptorGuard GetSharedDescriptorGuard() const
Takes the read lock for the descriptor.
RTaskScheduler * fTaskScheduler
RColumnHandle ColumnHandle_t
The column handle identifies a column with the current open page storage.
Stores information about the cluster in which this page resides.
A page is a slice of a column that is mapped into memory.
static RPage MakePageZero(ColumnId_t columnId, ClusterSize_t::ValueType elementSize)
Make a 'zero' page for column columnId (that is comprised of 0x00 bytes only).
std::uint32_t GetNBytes() const
The space taken by column elements in the buffer.
void SetWindow(const NTupleSize_t rangeFirst, const RClusterInfo &clusterInfo)
Seek the page to a certain position of the column.
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...
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
DescriptorId_t GetClusterId() const
ClusterSize_t::ValueType GetIndex() const
Base class for all ROOT issued exceptions.
The on-storage meta-data of an ntuple.
std::string GetName() const
Common user-tunable settings for reading ntuples.
DAOS-specific user-tunable settings for storing ntuples.
uint32_t GetMaxCageSize() const
const std::string & GetObjectClass() const
Common user-tunable settings for storing ntuples.
std::size_t GetApproxUnzippedPageSize() const
static constexpr std::uint16_t kVersionEpoch
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
const char * d_errstr(int rc)
static void d_iov_set(d_iov_t *iov, void *buf, size_t size)
uint16_t daos_oclass_id_t
RNTupleTimer< RNTupleAtomicCounter, RNTupleTickCounter< RNTupleAtomicCounter > > RNTupleAtomicTimer
std::uint32_t ntuple_index_t
RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
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.
constexpr DescriptorId_t kInvalidDescriptorId
The identifiers that specifies the content of a (partial) cluster.
DescriptorId_t fClusterId
ColumnSet_t fPhysicalColumnSet
A pair of <object ID, distribution key> that can be used to issue a fetch/update request for multiple...
Describes a read/write operation on multiple attribute keys under the same object ID and distribution...
Entry point for an RNTuple in a DAOS container.
std::uint32_t fNBytesFooter
The size of the compressed ntuple footer.
RResult< std::uint32_t > Deserialize(const void *buffer, std::uint32_t bufSize)
std::uint64_t fVersionAnchor
Allows for evolving the struct in future versions.
std::string fObjClass
The object class for user data OIDs, e.g. SX
std::uint16_t fVersionPatch
std::uint32_t Serialize(void *buffer) const
std::uint16_t fVersionEpoch
Version of the binary format supported by the writer.
std::uint16_t fVersionMinor
std::uint32_t fLenHeader
The size of the uncompressed ntuple header.
static std::uint32_t GetSize()
std::uint32_t fLenFooter
The size of the uncompressed ntuple footer.
std::uint16_t fVersionMajor
std::uint32_t fNBytesHeader
The size of the compressed ntuple header.
Wrap around a daos_oclass_id_t.
static constexpr std::size_t kOCNameMaxLength
This limit is currently not defined in any header and any call to daos_oclass_id2name() within DAOS u...
On-disk pages within a page source are identified by the column and page number.
Summarizes cluster-level information that are necessary to populate a certain page.
DescriptorId_t fClusterId
RClusterDescriptor::RPageRange::RPageInfoExtended fPageInfo
Location of the page on disk.
std::uint64_t fColumnOffset
The first element number of the page's column in the given cluster.
DescriptorId_t fPhysicalId
A range of sealed pages referring to the same column that can be used for vector commit.
A sealed page contains the bytes of a page as written to storage (packed & compressed).
RNTupleLocator payload that is common for object stores using 64bit location information.
Generic information about the physical location of data.
std::uint8_t fReserved
Reserved for use by concrete storage backends.
ELocatorType fType
For non-disk locators, the value for the Type field.
std::uint32_t fBytesOnStorage
std::variant< std::uint64_t, std::string, RNTupleLocatorObject64 > fPosition
Simple on-disk locators consisting of a 64-bit offset use variant type uint64_t; extended locators ha...
const T & GetPosition() const