mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
330212e0f4
The original motivation for this commit was that shared_ptr_helper used std::shared_ptr<>() which does two heap allocations instead of make_shared<>() which does a single allocation. Turned out that 1. the affected code (--> Storages/) is not on a hot path (rendering the performance argument moot ...) 2. yet copying Storage objects is potentially dangerous and was previously allowed. Hence, this change - removes shared_ptr_helper and as a result all inherited create() methods, - instead, Storage objects are now created using make_shared<>() by the caller (for that to work, many constructors had to be made public), and - all Storage classes were marked as noncopyable using boost::noncopyable. In sum, we are (likely) not making things faster but the code becomes cleaner and harder to misuse.
29 lines
669 B
C++
29 lines
669 B
C++
#pragma once
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
#include <Storages/System/IStorageSystemOneBlock.h>
|
|
|
|
namespace DB
|
|
{
|
|
class Context;
|
|
|
|
|
|
/** System table "contributors" with list of clickhouse contributors
|
|
*/
|
|
class StorageSystemContributors final : public IStorageSystemOneBlock<StorageSystemContributors>, boost::noncopyable
|
|
{
|
|
protected:
|
|
void fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo & query_info) const override;
|
|
|
|
using IStorageSystemOneBlock::IStorageSystemOneBlock;
|
|
|
|
public:
|
|
std::string getName() const override
|
|
{
|
|
return "SystemContributors";
|
|
}
|
|
|
|
static NamesAndTypesList getNamesAndTypes();
|
|
};
|
|
}
|