fixed code style

This commit is contained in:
lgbo-ustc 2021-12-07 12:17:47 +08:00 committed by liangjiabiao
parent 07045bc451
commit fcea033a07
3 changed files with 16 additions and 16 deletions

View File

@ -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;
}
@ -365,7 +365,7 @@ private:
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;

View File

@ -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;
}
}

View File

@ -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;