[go: up one dir, main page]

Container image virtual registry: cache entry service layer

🗒️ Goal

Create the necessary services to handle VirtualRegistries::Containers::Image::Cache::Entry objects.

CreateOrUpdateService

This service is called when we need to create a new cache entry. Given the high chances to run things in parallel (eg. having multiple web requests for the exact same file/object), we could run into race condition issues. Thus, the service should be ready to find an existing entry and simply update it.

To cope with this requirement, we have a .create_or_update_by! function in the cache entry (https://gitlab.com/gitlab-org/gitlab/-/blob/ea6256f802369b25c57e32fe9940ddcb35ab74f1/ee/app/models/virtual_registries/packages/maven/cache/entry.rb#L67).

The service should correctly handle errors and user permissions. It should mirror this service.

🔮 Other considerations

Take this opportunity to centralize the logic, functions or aspects with the Maven virtual registry objects.

🛠️ Implementation plan

Edited by 🤖 GitLab Bot 🤖