mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 11:22:12 +00:00
fixed code style
This commit is contained in:
parent
07045bc451
commit
fcea033a07
@ -37,7 +37,7 @@ struct TrivialLRUCacheEvitPolicy
|
||||
return LRUCacheEvictStatus::CAN_EVITCT;
|
||||
}
|
||||
|
||||
inline void release(T & )
|
||||
inline void release(T &)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -317,9 +317,9 @@ private:
|
||||
|
||||
if (inserted)
|
||||
{
|
||||
auto weight = mapped ? weight_function(*mapped) : 0;
|
||||
auto value_weight = mapped ? weight_function(*mapped) : 0;
|
||||
// move removeOverflow() ahead here. In default, the final result is the same as the old implementation
|
||||
if (!removeOverflow(weight))
|
||||
if (!removeOverflow(value_weight))
|
||||
{
|
||||
// cannot find enough space to put in the new value
|
||||
cells.erase(it);
|
||||
@ -352,8 +352,8 @@ private:
|
||||
cell.value = mapped;
|
||||
cell.size = cell.value ? weight_function(*cell.value) : 0;
|
||||
current_size += cell.size;
|
||||
|
||||
removeOverflow();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -363,9 +363,9 @@ private:
|
||||
size_t queue_size = cells.size();
|
||||
auto key_it = queue.begin();
|
||||
|
||||
while ((current_size > max_size || (max_elements_size != 0 && queue_size > max_elements_size))
|
||||
while ((current_size > max_size || (max_elements_size != 0 && queue_size > max_elements_size))
|
||||
&& (queue_size > 1)
|
||||
&& key_it != queue.end())
|
||||
&& (key_it != queue.end()))
|
||||
{
|
||||
const Key & key = *key_it;
|
||||
|
||||
@ -379,7 +379,7 @@ private:
|
||||
const auto & cell = it->second;
|
||||
auto evict_status = evict_policy.canRelease(*cell.value);// in default, it is CAN_EVITCT
|
||||
if (evict_status == LRUCacheEvictStatus::CAN_EVITCT)
|
||||
{
|
||||
{
|
||||
// always call release() before erasing an element
|
||||
// in default, it's an empty action
|
||||
evict_policy.release(*cell.value);
|
||||
|
@ -16,21 +16,21 @@ RemoteFileMetadataFactory & RemoteFileMetadataFactory::instance()
|
||||
return g_factory;
|
||||
}
|
||||
|
||||
IRemoteFileMetadataPtr RemoteFileMetadataFactory::get(const String & class_name)
|
||||
IRemoteFileMetadataPtr RemoteFileMetadataFactory::get(const String & name)
|
||||
{
|
||||
auto it = class_creators.find(class_name);
|
||||
auto it = class_creators.find(name);
|
||||
if (it == class_creators.end())
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Not found metadata class:{}", class_name);
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Not found metadata class:{}", name);
|
||||
return (it->second)();
|
||||
}
|
||||
|
||||
void RemoteFileMetadataFactory::registerClass(const String & class_name, ClassCreator creator)
|
||||
void RemoteFileMetadataFactory::registerClass(const String & name, ClassCreator creator)
|
||||
{
|
||||
auto it = class_creators.find(class_name);
|
||||
auto it = class_creators.find(name);
|
||||
if (it != class_creators.end())
|
||||
{
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Class ({}) has been registered. It is a fatal error.", class_name);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Class ({}) has been registered. It is a fatal error.", name);
|
||||
}
|
||||
class_creators[class_name] = creator;
|
||||
class_creators[name] = creator;
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ public:
|
||||
~RemoteFileMetadataFactory() = default;
|
||||
|
||||
static RemoteFileMetadataFactory & instance();
|
||||
IRemoteFileMetadataPtr get(const String & class_name);
|
||||
void registerClass(const String &class_name, ClassCreator creator);
|
||||
IRemoteFileMetadataPtr get(const String & name);
|
||||
void registerClass(const String &name, ClassCreator creator);
|
||||
protected:
|
||||
RemoteFileMetadataFactory() = default;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user