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

@ -317,9 +317,9 @@ private:
if (inserted) 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 // 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 // cannot find enough space to put in the new value
cells.erase(it); cells.erase(it);
@ -352,8 +352,8 @@ private:
cell.value = mapped; cell.value = mapped;
cell.size = cell.value ? weight_function(*cell.value) : 0; cell.size = cell.value ? weight_function(*cell.value) : 0;
current_size += cell.size; current_size += cell.size;
removeOverflow(); removeOverflow();
return true; return true;
} }
@ -365,7 +365,7 @@ private:
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) && (queue_size > 1)
&& key_it != queue.end()) && (key_it != queue.end()))
{ {
const Key & key = *key_it; const Key & key = *key_it;

View File

@ -16,21 +16,21 @@ RemoteFileMetadataFactory & RemoteFileMetadataFactory::instance()
return g_factory; 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()) 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)(); 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()) 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; ~RemoteFileMetadataFactory() = default;
static RemoteFileMetadataFactory & instance(); static RemoteFileMetadataFactory & instance();
IRemoteFileMetadataPtr get(const String & class_name); IRemoteFileMetadataPtr get(const String & name);
void registerClass(const String &class_name, ClassCreator creator); void registerClass(const String &name, ClassCreator creator);
protected: protected:
RemoteFileMetadataFactory() = default; RemoteFileMetadataFactory() = default;