mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Remove orphan header files
This commit is contained in:
parent
beb0f6c5c1
commit
9bf62dd622
@ -1,75 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Common/HashTable/ClearableHashMap.h>
|
||||
#include <Common/HashTable/FixedHashMap.h>
|
||||
|
||||
|
||||
template <typename Key, typename TMapped>
|
||||
struct FixedClearableHashMapCell
|
||||
{
|
||||
using Mapped = TMapped;
|
||||
using State = ClearableHashSetState;
|
||||
|
||||
using value_type = PairNoInit<Key, Mapped>;
|
||||
using mapped_type = Mapped;
|
||||
|
||||
UInt32 version;
|
||||
Mapped mapped;
|
||||
|
||||
FixedClearableHashMapCell() {} /// NOLINT
|
||||
FixedClearableHashMapCell(const Key &, const State & state) : version(state.version) {}
|
||||
FixedClearableHashMapCell(const value_type & value_, const State & state) : version(state.version), mapped(value_.second) {}
|
||||
|
||||
const VoidKey getKey() const { return {}; } /// NOLINT
|
||||
Mapped & getMapped() { return mapped; }
|
||||
const Mapped & getMapped() const { return mapped; }
|
||||
|
||||
bool isZero(const State & state) const { return version != state.version; }
|
||||
void setZero() { version = 0; }
|
||||
|
||||
struct CellExt
|
||||
{
|
||||
CellExt() {} /// NOLINT
|
||||
CellExt(Key && key_, FixedClearableHashMapCell * ptr_) : key(key_), ptr(ptr_) {}
|
||||
void update(Key && key_, FixedClearableHashMapCell * ptr_)
|
||||
{
|
||||
key = key_;
|
||||
ptr = ptr_;
|
||||
}
|
||||
Key key;
|
||||
FixedClearableHashMapCell * ptr;
|
||||
const Key & getKey() const { return key; }
|
||||
Mapped & getMapped() { return ptr->mapped; }
|
||||
const Mapped & getMapped() const { return *ptr->mapped; }
|
||||
const value_type getValue() const { return {key, *ptr->mapped}; } /// NOLINT
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <typename Key, typename Mapped, typename Allocator = HashTableAllocator>
|
||||
class FixedClearableHashMap : public FixedHashMap<Key, Mapped, FixedClearableHashMapCell<Key, Mapped>, Allocator>
|
||||
{
|
||||
public:
|
||||
using Base = FixedHashMap<Key, Mapped, FixedClearableHashMapCell<Key, Mapped>, Allocator>;
|
||||
using Self = FixedClearableHashMap;
|
||||
using LookupResult = typename Base::LookupResult;
|
||||
|
||||
using Base::Base;
|
||||
|
||||
Mapped & operator[](const Key & x)
|
||||
{
|
||||
LookupResult it;
|
||||
bool inserted;
|
||||
this->emplace(x, it, inserted);
|
||||
if (inserted)
|
||||
new (&it->getMapped()) Mapped();
|
||||
|
||||
return it->getMapped();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
++this->version;
|
||||
this->m_size = 0;
|
||||
}
|
||||
};
|
@ -1,89 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <Core/Block.h>
|
||||
#include <Columns/IColumn.h>
|
||||
#include <boost/smart_ptr/intrusive_ptr.hpp>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/// Allows you refer to the row in the block and hold the block ownership,
|
||||
/// and thus avoid creating a temporary row object.
|
||||
/// Do not use std::shared_ptr, since there is no need for a place for `weak_count` and `deleter`;
|
||||
/// does not use Poco::SharedPtr, since you need to allocate a block and `refcount` in one piece;
|
||||
/// does not use Poco::AutoPtr, since it does not have a `move` constructor and there are extra checks for nullptr;
|
||||
/// The reference counter is not atomic, since it is used from one thread.
|
||||
namespace detail
|
||||
{
|
||||
struct SharedBlock : Block
|
||||
{
|
||||
int refcount = 0;
|
||||
|
||||
ColumnRawPtrs all_columns;
|
||||
ColumnRawPtrs sort_columns;
|
||||
|
||||
explicit SharedBlock(Block && block) : Block(std::move(block)) {}
|
||||
};
|
||||
}
|
||||
|
||||
inline void intrusive_ptr_add_ref(detail::SharedBlock * ptr)
|
||||
{
|
||||
++ptr->refcount;
|
||||
}
|
||||
|
||||
inline void intrusive_ptr_release(detail::SharedBlock * ptr)
|
||||
{
|
||||
if (0 == --ptr->refcount)
|
||||
delete ptr;
|
||||
}
|
||||
|
||||
using SharedBlockPtr = boost::intrusive_ptr<detail::SharedBlock>;
|
||||
|
||||
struct SharedBlockRowRef
|
||||
{
|
||||
ColumnRawPtrs * columns = nullptr;
|
||||
size_t row_num = 0;
|
||||
SharedBlockPtr shared_block;
|
||||
|
||||
void swap(SharedBlockRowRef & other)
|
||||
{
|
||||
std::swap(columns, other.columns);
|
||||
std::swap(row_num, other.row_num);
|
||||
std::swap(shared_block, other.shared_block);
|
||||
}
|
||||
|
||||
/// The number and types of columns must match.
|
||||
bool operator==(const SharedBlockRowRef & other) const
|
||||
{
|
||||
size_t size = columns->size();
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
if (0 != (*columns)[i]->compareAt(row_num, other.row_num, *(*other.columns)[i], 1))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator!=(const SharedBlockRowRef & other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
SharedBlockRowRef empty;
|
||||
swap(empty);
|
||||
}
|
||||
|
||||
bool empty() const { return columns == nullptr; }
|
||||
size_t size() const { return empty() ? 0 : columns->size(); }
|
||||
|
||||
void set(SharedBlockPtr & shared_block_, ColumnRawPtrs * columns_, size_t row_num_)
|
||||
{
|
||||
shared_block = shared_block_;
|
||||
columns = columns_;
|
||||
row_num = row_num_;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
class SimpleActionLock;
|
||||
|
||||
|
||||
/// Similar to ActionBlocker, but without weak_ptr magic
|
||||
class SimpleActionBlocker
|
||||
{
|
||||
using Counter = std::atomic<int>;
|
||||
Counter counter = 0;
|
||||
|
||||
public:
|
||||
|
||||
SimpleActionBlocker() = default;
|
||||
|
||||
bool isCancelled() const { return counter > 0; }
|
||||
|
||||
/// Temporarily blocks corresponding actions (while the returned object is alive)
|
||||
friend class SimpleActionLock;
|
||||
inline SimpleActionLock cancel();
|
||||
|
||||
/// Cancel the actions forever.
|
||||
void cancelForever() { ++counter; }
|
||||
};
|
||||
|
||||
|
||||
/// Blocks related action while a SimpleActionLock instance exists
|
||||
class SimpleActionLock
|
||||
{
|
||||
SimpleActionBlocker * block = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
SimpleActionLock() = default;
|
||||
|
||||
explicit SimpleActionLock(SimpleActionBlocker & block_) : block(&block_)
|
||||
{
|
||||
++block->counter;
|
||||
}
|
||||
|
||||
SimpleActionLock(const SimpleActionLock &) = delete;
|
||||
|
||||
SimpleActionLock(SimpleActionLock && rhs) noexcept
|
||||
{
|
||||
*this = std::move(rhs);
|
||||
}
|
||||
|
||||
SimpleActionLock & operator=(const SimpleActionLock &) = delete;
|
||||
|
||||
SimpleActionLock & operator=(SimpleActionLock && rhs) noexcept
|
||||
{
|
||||
if (block)
|
||||
--block->counter;
|
||||
|
||||
block = rhs.block;
|
||||
rhs.block = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
~SimpleActionLock()
|
||||
{
|
||||
if (block)
|
||||
--block->counter;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
SimpleActionLock SimpleActionBlocker::cancel()
|
||||
{
|
||||
return SimpleActionLock(*this);
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Common/Arena.h>
|
||||
#include <base/unaligned.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/** Can allocate memory objects of fixed size with deletion support.
|
||||
* For small `object_size`s allocated no less than pointer size.
|
||||
*/
|
||||
class SmallObjectPool
|
||||
{
|
||||
private:
|
||||
const size_t object_size;
|
||||
Arena pool;
|
||||
char * free_list = nullptr;
|
||||
|
||||
public:
|
||||
explicit SmallObjectPool(size_t object_size_)
|
||||
: object_size{std::max(object_size_, sizeof(char *))}
|
||||
{
|
||||
}
|
||||
|
||||
char * alloc()
|
||||
{
|
||||
if (free_list)
|
||||
{
|
||||
char * res = free_list;
|
||||
free_list = unalignedLoad<char *>(free_list);
|
||||
return res;
|
||||
}
|
||||
|
||||
return pool.alloc(object_size);
|
||||
}
|
||||
|
||||
void free(char * ptr)
|
||||
{
|
||||
unalignedStore<char *>(ptr, free_list);
|
||||
free_list = ptr;
|
||||
}
|
||||
|
||||
/// The size of the allocated pool in bytes
|
||||
size_t size() const
|
||||
{
|
||||
return pool.size();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Parsers/IAST_fwd.h>
|
||||
#include <Poco/AutoPtr.h>
|
||||
#include <Poco/Util/AbstractConfiguration.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
struct DictionaryAttachInfo
|
||||
{
|
||||
ASTPtr create_query;
|
||||
Poco::AutoPtr<Poco::Util::AbstractConfiguration> config;
|
||||
time_t modification_time;
|
||||
};
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Interpreters/IExternalLoaderConfigRepository.h>
|
||||
#include <Databases/IDatabase.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/// Repository from database, which stores dictionary definitions on disk.
|
||||
/// Tracks update time and existence of .sql files through IDatabase.
|
||||
class ExternalLoaderDatabaseConfigRepository : public IExternalLoaderConfigRepository, WithContext
|
||||
{
|
||||
public:
|
||||
ExternalLoaderDatabaseConfigRepository(IDatabase & database_, ContextPtr global_context_);
|
||||
|
||||
std::string getName() const override { return database_name; }
|
||||
|
||||
std::set<std::string> getAllLoadablesDefinitionNames() override;
|
||||
|
||||
bool exists(const std::string & loadable_definition_name) override;
|
||||
|
||||
Poco::Timestamp getUpdateTime(const std::string & loadable_definition_name) override;
|
||||
|
||||
LoadablesConfigurationPtr load(const std::string & loadable_definition_name) override;
|
||||
|
||||
private:
|
||||
const String database_name;
|
||||
IDatabase & database;
|
||||
};
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/// An interface for read progress callback.
|
||||
class IReadProgressCallback
|
||||
{
|
||||
public:
|
||||
virtual ~IReadProgressCallback() = default;
|
||||
virtual bool onProgress(uint64_t read_rows, uint64_t read_bytes) = 0;
|
||||
};
|
||||
|
||||
using ReadProgressCallbackPtr = std::unique_ptr<IReadProgressCallback>;
|
||||
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Processors/IProcessor.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/// Look for first Ready or Async processor by depth-first search in needed input ports and full output ports.
|
||||
/// NOTE: Pipeline must not have cycles.
|
||||
//template <typename Visit>
|
||||
//void traverse(IProcessor & processor, Visit && visit)
|
||||
//{
|
||||
// IProcessor::Status status = visit(processor);
|
||||
//
|
||||
// if (status == IProcessor::Status::Ready || status == IProcessor::Status::Async)
|
||||
// return;
|
||||
//
|
||||
// if (status == IProcessor::Status::NeedData)
|
||||
// for (auto & input : processor.getInputs())
|
||||
// if (input.isNeeded() && !input.hasData())
|
||||
// traverse(input.getOutputPort().getProcessor(), std::forward<Visit>(visit));
|
||||
//
|
||||
// if (status == IProcessor::Status::PortFull)
|
||||
// for (auto & output : processor.getOutputs())
|
||||
// if (output.hasData())
|
||||
// traverse(output.getInputPort().getProcessor(), std::forward<Visit>(visit));
|
||||
//}
|
||||
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <queue>
|
||||
#include <Processors/IAccumulatingTransform.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/** Reads all data into queue.
|
||||
* After all data has been read - output it in the same order.
|
||||
*/
|
||||
class QueueBuffer final : public IAccumulatingTransform
|
||||
{
|
||||
private:
|
||||
std::queue<Chunk> chunks;
|
||||
public:
|
||||
String getName() const override { return "QueueBuffer"; }
|
||||
|
||||
explicit QueueBuffer(Block header)
|
||||
: IAccumulatingTransform(header, header)
|
||||
{
|
||||
}
|
||||
|
||||
void consume(Chunk block) override
|
||||
{
|
||||
chunks.push(std::move(block));
|
||||
}
|
||||
|
||||
Chunk generate() override
|
||||
{
|
||||
if (chunks.empty())
|
||||
return {};
|
||||
|
||||
auto res = std::move(chunks.front());
|
||||
chunks.pop();
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -422,3 +422,7 @@ find $ROOT_PATH/{src,programs,utils} -name '*.h' -or -name '*.cpp' | xargs grep
|
||||
|
||||
# Cyrillic characters hiding inside Latin.
|
||||
find $ROOT_PATH/{src,programs,utils} -name '*.h' -or -name '*.cpp' | xargs grep -P --line-number '[a-zA-Z][а-яА-ЯёЁ]|[а-яА-ЯёЁ][a-zA-Z]' && echo "^ Cyrillic characters found in unexpected place."
|
||||
|
||||
# Orphaned header files.
|
||||
join -v1 <(find $ROOT_PATH/{src,programs,utils} -name '*.h' -printf '%f\n' | sort | uniq) <(find $ROOT_PATH/{src,programs,utils} -name '*.cpp' -or -name '*.c' -or -name '*.h' -or -name '*.S' | xargs grep --no-filename -o -P '[\w-]+\.h' | sort | uniq) |
|
||||
grep . && echo '^ Found orphan header files.'
|
||||
|
Loading…
Reference in New Issue
Block a user