2023-02-14 14:14:11 +00:00
# pragma once
# include <boost/noncopyable.hpp>
# include <Core/Block.h>
# include <IO/ReadBufferFromFileBase.h>
2023-08-29 13:38:51 +00:00
# include <Storages/MergeTree/MergeTreeReadTask.h>
2023-02-14 14:14:11 +00:00
namespace DB
{
2023-08-29 13:38:51 +00:00
/// The interface that determines how tasks for reading (MergeTreeReadTask)
/// are distributed among data parts with ranges.
2023-02-14 14:14:11 +00:00
class IMergeTreeReadPool : private boost : : noncopyable
{
public :
virtual ~ IMergeTreeReadPool ( ) = default ;
2023-08-29 13:38:51 +00:00
virtual String getName ( ) const = 0 ;
2023-02-14 14:14:11 +00:00
virtual Block getHeader ( ) const = 0 ;
2023-08-29 13:38:51 +00:00
/// Returns true if tasks are returned in the same order as the order of ranges passed to pool
virtual bool preservesOrderOfRanges ( ) const = 0 ;
2023-02-14 14:14:11 +00:00
2023-08-29 14:21:58 +00:00
/// task_idx is an implementation defined identifier that helps
2023-09-05 11:03:15 +00:00
/// to get required task. E.g. it may be number of thread in case of Default reading type or an index of a part in case of InOrder/InReverseOrder reading type.
2023-08-29 13:38:51 +00:00
virtual MergeTreeReadTaskPtr getTask ( size_t task_idx , MergeTreeReadTask * previous_task ) = 0 ;
2023-02-14 14:14:11 +00:00
virtual void profileFeedback ( ReadBufferFromFileBase : : ProfileInfo info ) = 0 ;
} ;
using MergeTreeReadPoolPtr = std : : shared_ptr < IMergeTreeReadPool > ;
}