ClickHouse/src/Interpreters/ExternalUserDefinedExecutableFunctionsLoader.h

39 lines
1.2 KiB
C++

#pragma once
#include <memory>
#include <Interpreters/Context_fwd.h>
#include <Interpreters/ExternalLoader.h>
#include <Interpreters/UserDefinedExecutableFunction.h>
namespace DB
{
class IExternalLoaderConfigRepository;
/// Manages external user-defined functions.
class ExternalUserDefinedExecutableFunctionsLoader : public ExternalLoader, WithContext
{
public:
using UserDefinedExecutableFunctionPtr = std::shared_ptr<const UserDefinedExecutableFunction>;
/// External user-defined functions will be loaded immediately and then will be updated in separate thread, each 'reload_period' seconds.
explicit ExternalUserDefinedExecutableFunctionsLoader(ContextPtr global_context_);
UserDefinedExecutableFunctionPtr getUserDefinedFunction(const std::string & user_defined_function_name) const;
UserDefinedExecutableFunctionPtr tryGetUserDefinedFunction(const std::string & user_defined_function_name) const;
void reloadFunction(const std::string & user_defined_function_name) const;
protected:
LoadablePtr create(const std::string & name,
const Poco::Util::AbstractConfiguration & config,
const std::string & key_in_config,
const std::string & repository_name) const override;
};
}