16 #ifndef ROOT7_RPageStorageRoot 
   17 #define ROOT7_RPageStorageRoot 
   31 #include <unordered_map> 
   34 namespace Experimental {
 
   40    RNTupleBlob(
int size, 
unsigned char *content) : fSize(size), fContent(content) {}
 
   41    RNTupleBlob(
const RNTupleBlob &other) = 
delete;
 
   42    RNTupleBlob &operator =(
const RNTupleBlob &other) = 
delete;
 
   43    ~RNTupleBlob() = 
default;
 
   45    std::int32_t fVersion = 0;
 
   47    unsigned char* fContent = 
nullptr; 
 
   64 class RPageSinkRoot : 
public RPageSink {
 
   66    static constexpr std::size_t kDefaultElementsPerPage = 10000;
 
   68    RNTupleMetrics fMetrics;
 
   69    std::unique_ptr<RPageAllocatorHeap> fPageAllocator;
 
   72    std::unique_ptr<TFile> fFile;
 
   73    TDirectory *fDirectory = 
nullptr;
 
   76    DescriptorId_t fLastPageIdx = 0;
 
   79    void DoCreate(
const RNTupleModel &model) 
final;
 
   80    RClusterDescriptor::RLocator DoCommitPage(ColumnHandle_t columnHandle, 
const RPage &page) 
final;
 
   81    RClusterDescriptor::RLocator DoCommitCluster(NTupleSize_t nEntries) 
final;
 
   82    void DoCommitDataset() final;
 
   85    RPageSinkRoot(std::string_view ntupleName, std::string_view path, const RNTupleWriteOptions &options);
 
   86    virtual ~RPageSinkRoot();
 
   88    RPage ReservePage(ColumnHandle_t columnHandle, std::
size_t nElements = 0) final;
 
   89    void ReleasePage(RPage &page) final;
 
   91    RNTupleMetrics &GetMetrics() final { 
return fMetrics; }
 
  102 class RPageAllocatorKey {
 
  104    static RPage NewPage(ColumnId_t columnId, 
void *mem, std::size_t elementSize, std::size_t nElements);
 
  105    static void DeletePage(
const RPage& page, ROOT::Experimental::Internal::RNTupleBlob *payload);
 
  116 class RPageSourceRoot : 
public RPageSource {
 
  118    RNTupleMetrics fMetrics;
 
  119    std::unique_ptr<RPageAllocatorKey> fPageAllocator;
 
  120    std::shared_ptr<RPagePool> fPagePool;
 
  123    std::unique_ptr<TFile> fFile;
 
  124    TDirectory *fDirectory = 
nullptr;
 
  126    RPage PopulatePageFromCluster(ColumnHandle_t columnHandle, 
const RClusterDescriptor &clusterDescriptor,
 
  127                                  ClusterSize_t::ValueType clusterIndex);
 
  130    RNTupleDescriptor DoAttach() final;
 
  133    RPageSourceRoot(std::string_view ntupleName, std::string_view path, const RNTupleReadOptions &options);
 
  134    std::unique_ptr<RPageSource> Clone() const final;
 
  135    virtual ~RPageSourceRoot();
 
  137    RPage PopulatePage(ColumnHandle_t columnHandle, NTupleSize_t globalIndex) final;
 
  138    RPage PopulatePage(ColumnHandle_t columnHandle, const RClusterIndex &clusterIndex) final;
 
  139    void ReleasePage(RPage &page) final;
 
  141    RNTupleMetrics &GetMetrics() final { 
return fMetrics; }