mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 11:52:27 +00:00
fixed code style
This commit is contained in:
parent
dd70209623
commit
d4dcbd59fb
@ -5,6 +5,7 @@ namespace DB
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
IRemoteFileMetadata::~IRemoteFileMetadata() {}
|
||||
@ -15,11 +16,11 @@ RemoteFileMetadataFactory & RemoteFileMetadataFactory::instance()
|
||||
return g_factory;
|
||||
}
|
||||
|
||||
IRemoteFileMetadataPtr RemoteFileMetadataFactory::createClass(const String & class_name)
|
||||
IRemoteFileMetadataPtr RemoteFileMetadataFactory::get(const String & class_name)
|
||||
{
|
||||
auto it = class_creators.find(class_name);
|
||||
if (it == class_creators.end())
|
||||
return nullptr;
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Not found metadata class:{}", class_name);
|
||||
return (it->second)();
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ using IRemoteFileMetadataPtr = std::shared_ptr<IRemoteFileMetadata>;
|
||||
|
||||
/*
|
||||
* How to register a subclass into the factory and use it ?
|
||||
* 1) define your own subclass derive from IRemoteFileMetadata. Notice! the getClassName() must be the same
|
||||
* 1) define your own subclass derive from IRemoteFileMetadata. Notice! the getName() must be the same
|
||||
* as your subclass name.
|
||||
* 2) in a .cpp file, call REGISTTER_REMOTE_FILE_META_DATA_CLASS(subclass),
|
||||
* 3) call RemoteFileMetadataFactory::instance().createClass(subclass_name) where you want to make a new object
|
||||
@ -56,7 +56,7 @@ public:
|
||||
~RemoteFileMetadataFactory() = default;
|
||||
|
||||
static RemoteFileMetadataFactory & instance();
|
||||
IRemoteFileMetadataPtr createClass(const String & class_name);
|
||||
IRemoteFileMetadataPtr get(const String & class_name);
|
||||
void registerClass(const String &class_name, ClassCreator creator);
|
||||
protected:
|
||||
RemoteFileMetadataFactory() = default;
|
||||
|
@ -57,7 +57,7 @@ std::shared_ptr<RemoteCacheController> RemoteCacheController::recover(const std:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cache_controller->file_metadata_ptr = RemoteFileMetadataFactory::instance().createClass(cache_controller->metadata_class);
|
||||
cache_controller->file_metadata_ptr = RemoteFileMetadataFactory::instance().get(cache_controller->metadata_class);
|
||||
if (!cache_controller->file_metadata_ptr)
|
||||
{
|
||||
// do not load this invalid cached file and clear it. the clear action is in
|
||||
|
Loading…
Reference in New Issue
Block a user