[go: up one dir, main page]

Skip to content

Refactor access to repository storage and weights

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem

Currently, in order to access information for repository storage configuration (like name, path, gitaly_address) we use the settings Hash directly: Gitlab.config.repositories.storages (or Settings.repositories.storages).

To load stored repository storage weight we then use the settings Hash and and lookup the stored weights ApplicationSettings#repository_storages_weighted[<name>] in ApplicationsHelper#storage_weights.

Proposed Solution

Instead of using underlying implementation directly to lookup storage attributes and their weights we should it in a Object Repositories::Storage having methods like #name, #path, #gitaly_address, #weight etc. A collection of storages could be wrapped in Repositories::Storages instead.

Why?

In this case, the use of primitive data types (see PrimitveObsession) is not very convenient and can be error-prone leading to subtle bugs. See !75993 (comment 895124425)

Edited by 🤖 GitLab Bot 🤖