ClickHouse/programs/library-bridge/SharedLibraryHandler.h

46 lines
1.2 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
{
2021-03-22 14:39:17 +00:00
/// A class that manages all operations with library dictionary.
/// Every library dictionary source has its own object of this class, accessed by UUID.
2021-03-05 09:38:00 +00:00
class SharedLibraryHandler
{
public:
2021-03-24 07:53:15 +00:00
SharedLibraryHandler(const std::string & library_path_, const std::vector<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
2021-03-23 15:41:53 +00:00
BlockInputStreamPtr loadAll(const Block & sample_block, size_t num_attributes);
2021-03-05 09:38:00 +00:00
2021-03-24 07:53:15 +00:00
BlockInputStreamPtr loadIds(const std::vector<uint64_t> & ids, const Block & sample_block, size_t num_attributes);
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>;
}