2021-03-05 09:38:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Common/SharedLibrary.h>
|
2022-04-27 15:05:45 +00:00
|
|
|
#include <Common/logger_useful.h>
|
2021-03-05 09:38:00 +00:00
|
|
|
#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 09:23:29 +00:00
|
|
|
SharedLibraryHandler(
|
|
|
|
const std::string & library_path_,
|
|
|
|
const std::vector<std::string> & library_settings,
|
2021-03-24 19:32:31 +00:00
|
|
|
const Block & sample_block_,
|
|
|
|
const std::vector<std::string> & attributes_names_);
|
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-05-08 15:20:40 +00:00
|
|
|
SharedLibraryHandler & operator=(const SharedLibraryHandler & other) = delete;
|
|
|
|
|
2021-03-05 15:37:43 +00:00
|
|
|
~SharedLibraryHandler();
|
2021-03-05 09:38:00 +00:00
|
|
|
|
2021-10-11 16:11:50 +00:00
|
|
|
Block loadAll();
|
2021-03-05 09:38:00 +00:00
|
|
|
|
2021-10-11 16:11:50 +00:00
|
|
|
Block loadIds(const std::vector<uint64_t> & ids);
|
2021-03-05 09:38:00 +00:00
|
|
|
|
2021-10-11 16:11:50 +00:00
|
|
|
Block loadKeys(const Columns & key_columns);
|
2021-03-07 15:23:20 +00:00
|
|
|
|
2021-03-05 10:43:47 +00:00
|
|
|
bool isModified();
|
|
|
|
|
|
|
|
bool supportsSelectiveLoad();
|
|
|
|
|
2021-03-24 08:41:42 +00:00
|
|
|
const Block & getSampleBlock() { return sample_block; }
|
|
|
|
|
2021-03-05 09:38:00 +00:00
|
|
|
private:
|
2021-03-24 08:41:42 +00:00
|
|
|
Block dataToBlock(const ClickHouseLibrary::RawClickHouseLibraryTable data);
|
2021-03-05 09:38:00 +00:00
|
|
|
|
|
|
|
std::string library_path;
|
2021-03-24 08:41:42 +00:00
|
|
|
const Block sample_block;
|
2021-03-24 09:23:29 +00:00
|
|
|
std::vector<std::string> attributes_names;
|
|
|
|
|
|
|
|
SharedLibraryPtr library;
|
2021-03-05 09:38:00 +00:00
|
|
|
std::shared_ptr<CStringsHolder> settings_holder;
|
|
|
|
void * lib_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
using SharedLibraryHandlerPtr = std::shared_ptr<SharedLibraryHandler>;
|
|
|
|
|
|
|
|
}
|