16#ifndef ROOT7_RClusterPool
17#define ROOT7_RClusterPool
22#include <condition_variable>
32namespace Experimental {
62 std::promise<std::unique_ptr<RCluster>>
fPromise;
70 std::promise<std::unique_ptr<RCluster>>
fPromise;
76 std::future<std::unique_ptr<RCluster>>
fFuture;
102 std::vector<std::unique_ptr<RCluster>>
fPool;
Managed a set of clusters containing compressed and packed pages.
std::mutex fLockWorkQueue
Protects the shared state between the main thread and the pipeline threads, namely the read and unzip...
RCluster * FindInPool(DescriptorId_t clusterId) const
Every cluster id has at most one corresponding RCluster pointer in the pool.
std::vector< std::unique_ptr< RCluster > > fPool
The cache of clusters around the currently active cluster.
void ExecUnzipClusters()
The unzip thread routine which takes a loaded cluster and passes it to fPageSource....
RClusterPool(RPageSource &pageSource)
size_t FindFreeSlot() const
Returns an index of an unused element in fPool; callers of this function (GetCluster() and WaitFor())...
std::mutex fLockUnzipQueue
The lock associated with the fCvHasUnzipWork conditional variable.
RClusterPool(const RClusterPool &other)=delete
RCluster * GetCluster(DescriptorId_t clusterId, const RCluster::ColumnSet_t &physicalColumns)
Returns the requested cluster either from the pool or, in case of a cache miss, lets the I/O thread l...
void WaitForInFlightClusters()
Used by the unit tests to drain the queue of clusters to be preloaded.
static constexpr unsigned int kDefaultClusterBunchSize
void ExecReadClusters()
The I/O thread routine, there is exactly one I/O thread in-flight for every cluster pool.
RClusterPool & operator=(const RClusterPool &other)=delete
std::thread fThreadUnzip
The unzip thread takes a loaded cluster and passes it to fPageSource->UnzipCluster() on it.
RPageSource & fPageSource
Every cluster pool is responsible for exactly one page source that triggers loading of the clusters (...
std::thread fThreadIo
The I/O thread calls RPageSource::LoadClusters() asynchronously.
std::condition_variable fCvHasReadWork
Signals a non-empty I/O work queue.
unsigned int fClusterBunchSize
The number of clusters that are being read in a single vector read.
RCluster * WaitFor(DescriptorId_t clusterId, const RCluster::ColumnSet_t &physicalColumns)
Returns the given cluster from the pool, which needs to contain at least the columns physicalColumns.
std::deque< RReadItem > fReadQueue
The communication channel to the I/O thread.
std::int64_t fBunchId
Used as an ever-growing counter in GetCluster() to separate bunches of clusters from each other.
std::deque< RUnzipItem > fUnzipQueue
The communication channel between the I/O thread and the unzip thread.
std::condition_variable fCvHasUnzipWork
Signals non-empty unzip work queue.
std::vector< RInFlightCluster > fInFlightClusters
The clusters that were handed off to the I/O thread.
unsigned int fWindowPre
The number of clusters before the currently active cluster that should stay in the pool if present Re...
An in-memory subset of the packed and compressed pages of a cluster.
std::unordered_set< DescriptorId_t > ColumnSet_t
Abstract interface to read data from an ntuple.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Clusters that are currently being processed by the pipeline.
bool operator<(const RInFlightCluster &other) const
First order by cluster id, then by number of columns, than by the column ids in fColumns.
bool fIsExpired
By the time a cluster has been loaded, this cluster might not be necessary anymore.
RCluster::RKey fClusterKey
bool operator!=(const RInFlightCluster &other) const
bool operator==(const RInFlightCluster &other) const
std::future< std::unique_ptr< RCluster > > fFuture
Request to load a subset of the columns of a particular cluster.
std::int64_t fBunchId
Items with different bunch ids are scheduled for different vector reads.
std::promise< std::unique_ptr< RCluster > > fPromise
RCluster::RKey fClusterKey
Request to decompress and if necessary unpack compressed pages.
std::unique_ptr< RCluster > fCluster
std::promise< std::unique_ptr< RCluster > > fPromise
The identifiers that specifies the content of a (partial) cluster.
DescriptorId_t fClusterId
ColumnSet_t fPhysicalColumnSet