ClickHouse/programs/library-bridge/SharedLibraryHandler.h

44 lines
1.1 KiB
C++
Raw Normal View History

2021-03-05 09:38:00 +00:00
#pragma once
#include <Common/SharedLibrary.h>
#include <common/logger_useful.h>
#include <DataStreams/OneBlockInputStream.h>
#include "LibraryUtils.h"
namespace DB
{
class SharedLibraryHandler
{
public:
2021-03-06 18:21:40 +00:00
SharedLibraryHandler(const std::string & library_path_, const std::string & library_settings);
2021-03-05 09:38:00 +00:00
2021-03-05 15:37:43 +00:00
SharedLibraryHandler(const SharedLibraryHandler & other);
2021-03-05 09:38:00 +00:00
2021-03-05 15:37:43 +00:00
~SharedLibraryHandler();
2021-03-05 09:38:00 +00:00
BlockInputStreamPtr loadAll(const std::string & attributes_string, const Block & sample_block);
2021-03-10 21:14:09 +00:00
BlockInputStreamPtr loadIds(const std::string & attributes_string, const std::string & ids_string, const Block & sample_block);
2021-03-05 09:38:00 +00:00
2021-03-10 13:10:05 +00:00
BlockInputStreamPtr loadKeys(const Columns & key_columns, const Block & sample_block);
2021-03-07 15:23:20 +00:00
2021-03-05 10:43:47 +00:00
bool isModified();
bool supportsSelectiveLoad();
2021-03-05 09:38:00 +00:00
private:
2021-03-17 08:20:14 +00:00
static Block dataToBlock(const Block & sample_block, const ClickHouseLibrary::RawClickHouseLibraryTable data);
2021-03-05 09:38:00 +00:00
std::string library_path;
SharedLibraryPtr library;
std::shared_ptr<CStringsHolder> settings_holder;
void * lib_data;
};
using SharedLibraryHandlerPtr = std::shared_ptr<SharedLibraryHandler>;
}