Commit 25cf5c54 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fj-rename-hashed-project-to-hashed' into 'master'

Rename Storage::HashedProject to Storage::Hashed

See merge request gitlab-org/gitlab!24071
parents 4b909f29 496c2a8d
...@@ -110,8 +110,8 @@ class PoolRepository < ApplicationRecord ...@@ -110,8 +110,8 @@ class PoolRepository < ApplicationRecord
end end
def storage def storage
Storage::HashedProject Storage::Hashed
.new(self, prefix: Storage::HashedProject::POOL_PATH_PREFIX) .new(self, prefix: Storage::Hashed::POOL_PATH_PREFIX)
end end
end end
......
...@@ -2288,7 +2288,7 @@ class Project < ApplicationRecord ...@@ -2288,7 +2288,7 @@ class Project < ApplicationRecord
def storage def storage
@storage ||= @storage ||=
if hashed_storage?(:repository) if hashed_storage?(:repository)
Storage::HashedProject.new(self) Storage::Hashed.new(self)
else else
Storage::LegacyProject.new(self) Storage::LegacyProject.new(self)
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module Storage module Storage
class HashedProject class Hashed
attr_accessor :project attr_accessor :project
delegate :gitlab_shell, :repository_storage, to: :project delegate :gitlab_shell, :repository_storage, to: :project
......
...@@ -36,7 +36,7 @@ class FileUploader < GitlabUploader ...@@ -36,7 +36,7 @@ class FileUploader < GitlabUploader
def self.base_dir(model, store = Store::LOCAL) def self.base_dir(model, store = Store::LOCAL)
decorated_model = model decorated_model = model
decorated_model = Storage::HashedProject.new(model) if store == Store::REMOTE decorated_model = Storage::Hashed.new(model) if store == Store::REMOTE
model_path_segment(decorated_model) model_path_segment(decorated_model)
end end
...@@ -57,7 +57,7 @@ class FileUploader < GitlabUploader ...@@ -57,7 +57,7 @@ class FileUploader < GitlabUploader
# Returns a String without a trailing slash # Returns a String without a trailing slash
def self.model_path_segment(model) def self.model_path_segment(model)
case model case model
when Storage::HashedProject then model.disk_path when Storage::Hashed then model.disk_path
else else
model.hashed_storage?(:attachments) ? model.disk_path : model.full_path model.hashed_storage?(:attachments) ? model.disk_path : model.full_path
end end
......
...@@ -36,7 +36,7 @@ module Geo ...@@ -36,7 +36,7 @@ module Geo
def storage def storage
@storage ||= @storage ||=
if hashed_storage?(:repository) if hashed_storage?(:repository)
Storage::HashedProject.new(self) Storage::Hashed.new(self)
else else
Storage::LegacyProject.new(self) Storage::LegacyProject.new(self)
end end
......
...@@ -119,7 +119,7 @@ FactoryBot.define do ...@@ -119,7 +119,7 @@ FactoryBot.define do
project { create(:project, :repository) } project { create(:project, :repository) }
old_attachments_path { Storage::LegacyProject.new(project).disk_path } old_attachments_path { Storage::LegacyProject.new(project).disk_path }
new_attachments_path { Storage::HashedProject.new(project).disk_path } new_attachments_path { Storage::Hashed.new(project).disk_path }
end end
factory :geo_lfs_object_deleted_event, class: 'Geo::LfsObjectDeletedEvent' do factory :geo_lfs_object_deleted_event, class: 'Geo::LfsObjectDeletedEvent' do
......
...@@ -10,7 +10,7 @@ describe Geo::HashedStorageAttachmentsMigrationService do ...@@ -10,7 +10,7 @@ describe Geo::HashedStorageAttachmentsMigrationService do
let!(:project) { create(:project, :legacy_storage) } let!(:project) { create(:project, :legacy_storage) }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
let!(:upload) { Upload.find_by(path: file_uploader.upload_path) } let!(:upload) { Upload.find_by(path: file_uploader.upload_path) }
let(:file_uploader) { build(:file_uploader, project: project) } let(:file_uploader) { build(:file_uploader, project: project) }
......
...@@ -7,7 +7,7 @@ describe Projects::HashedStorage::MigrateAttachmentsService do ...@@ -7,7 +7,7 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
let(:project) { create(:project, storage_version: 1) } let(:project) { create(:project, storage_version: 1) }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
let(:old_attachments_path) { legacy_storage.disk_path } let(:old_attachments_path) { legacy_storage.disk_path }
let(:new_attachments_path) { hashed_storage.disk_path } let(:new_attachments_path) { hashed_storage.disk_path }
......
...@@ -8,7 +8,7 @@ describe Projects::HashedStorage::MigrateRepositoryService do ...@@ -8,7 +8,7 @@ describe Projects::HashedStorage::MigrateRepositoryService do
let(:gitlab_shell) { Gitlab::Shell.new } let(:gitlab_shell) { Gitlab::Shell.new }
let(:project) { create(:project, :empty_repo, :wiki_repo, :design_repo, :legacy_storage) } let(:project) { create(:project, :empty_repo, :wiki_repo, :design_repo, :legacy_storage) }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
let(:old_disk_path) { legacy_storage.disk_path } let(:old_disk_path) { legacy_storage.disk_path }
let(:new_disk_path) { hashed_storage.disk_path } let(:new_disk_path) { hashed_storage.disk_path }
......
...@@ -8,7 +8,7 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis ...@@ -8,7 +8,7 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis
let(:gitlab_shell) { Gitlab::Shell.new } let(:gitlab_shell) { Gitlab::Shell.new }
let(:project) { create(:project, :repository, :wiki_repo, :design_repo, storage_version: ::Project::HASHED_STORAGE_FEATURES[:repository]) } let(:project) { create(:project, :repository, :wiki_repo, :design_repo, storage_version: ::Project::HASHED_STORAGE_FEATURES[:repository]) }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
let(:old_disk_path) { hashed_storage.disk_path } let(:old_disk_path) { hashed_storage.disk_path }
let(:new_disk_path) { legacy_storage.disk_path } let(:new_disk_path) { legacy_storage.disk_path }
......
...@@ -11,7 +11,7 @@ module Gitlab ...@@ -11,7 +11,7 @@ module Gitlab
module Storage module Storage
# Class that returns the disk path for a project using hashed storage # Class that returns the disk path for a project using hashed storage
class HashedProject class Hashed
attr_accessor :project attr_accessor :project
ROOT_PATH_PREFIX = '@hashed' ROOT_PATH_PREFIX = '@hashed'
...@@ -121,7 +121,7 @@ module Gitlab ...@@ -121,7 +121,7 @@ module Gitlab
def storage def storage
@storage ||= @storage ||=
if hashed_storage? if hashed_storage?
Storage::HashedProject.new(self) Storage::Hashed.new(self)
else else
Storage::LegacyProject.new(self) Storage::LegacyProject.new(self)
end end
......
...@@ -46,7 +46,7 @@ module Gitlab ...@@ -46,7 +46,7 @@ module Gitlab
module Storage module Storage
# Class that returns the disk path for a project using hashed storage # Class that returns the disk path for a project using hashed storage
class HashedProject class Hashed
attr_accessor :project attr_accessor :project
ROOT_PATH_PREFIX = '@hashed' ROOT_PATH_PREFIX = '@hashed'
...@@ -176,7 +176,7 @@ module Gitlab ...@@ -176,7 +176,7 @@ module Gitlab
def storage def storage
@storage ||= @storage ||=
if hashed_storage? if hashed_storage?
Storage::HashedProject.new(self) Storage::Hashed.new(self)
else else
Storage::LegacyProject.new(self) Storage::LegacyProject.new(self)
end end
......
...@@ -8,7 +8,7 @@ describe Gitlab::BackgroundMigration::BackfillProjectFullpathInRepoConfig, :migr ...@@ -8,7 +8,7 @@ describe Gitlab::BackgroundMigration::BackfillProjectFullpathInRepoConfig, :migr
let(:group) { namespaces.create!(name: 'foo', path: 'foo') } let(:group) { namespaces.create!(name: 'foo', path: 'foo') }
let(:subgroup) { namespaces.create!(name: 'bar', path: 'bar', parent_id: group.id) } let(:subgroup) { namespaces.create!(name: 'bar', path: 'bar', parent_id: group.id) }
describe described_class::Storage::HashedProject do describe described_class::Storage::Hashed do
let(:project) { double(id: 555) } let(:project) { double(id: 555) }
subject(:project_storage) { described_class.new(project) } subject(:project_storage) { described_class.new(project) }
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe Projects::AfterRenameService do describe Projects::AfterRenameService do
let(:rugged_config) { rugged_repo(project.repository).config } let(:rugged_config) { rugged_repo(project.repository).config }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
let!(:path_before_rename) { project.path } let!(:path_before_rename) { project.path }
let!(:full_path_before_rename) { project.full_path } let!(:full_path_before_rename) { project.full_path }
let!(:path_after_rename) { "#{project.path}-renamed" } let!(:path_after_rename) { "#{project.path}-renamed" }
......
...@@ -7,7 +7,7 @@ describe Projects::HashedStorage::MigrateAttachmentsService do ...@@ -7,7 +7,7 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
let(:project) { create(:project, :repository, storage_version: 1, skip_disk_validation: true) } let(:project) { create(:project, :repository, storage_version: 1, skip_disk_validation: true) }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
let!(:upload) { Upload.find_by(path: file_uploader.upload_path) } let!(:upload) { Upload.find_by(path: file_uploader.upload_path) }
let(:file_uploader) { build(:file_uploader, project: project) } let(:file_uploader) { build(:file_uploader, project: project) }
......
...@@ -8,7 +8,7 @@ describe Projects::HashedStorage::MigrateRepositoryService do ...@@ -8,7 +8,7 @@ describe Projects::HashedStorage::MigrateRepositoryService do
let(:gitlab_shell) { Gitlab::Shell.new } let(:gitlab_shell) { Gitlab::Shell.new }
let(:project) { create(:project, :legacy_storage, :repository, :wiki_repo) } let(:project) { create(:project, :legacy_storage, :repository, :wiki_repo) }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
subject(:service) { described_class.new(project: project, old_disk_path: project.disk_path) } subject(:service) { described_class.new(project: project, old_disk_path: project.disk_path) }
......
...@@ -7,7 +7,7 @@ describe Projects::HashedStorage::RollbackAttachmentsService do ...@@ -7,7 +7,7 @@ describe Projects::HashedStorage::RollbackAttachmentsService do
let(:project) { create(:project, :repository, skip_disk_validation: true) } let(:project) { create(:project, :repository, skip_disk_validation: true) }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
let!(:upload) { Upload.find_by(path: file_uploader.upload_path) } let!(:upload) { Upload.find_by(path: file_uploader.upload_path) }
let(:file_uploader) { build(:file_uploader, project: project) } let(:file_uploader) { build(:file_uploader, project: project) }
......
...@@ -8,7 +8,7 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis ...@@ -8,7 +8,7 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis
let(:gitlab_shell) { Gitlab::Shell.new } let(:gitlab_shell) { Gitlab::Shell.new }
let(:project) { create(:project, :repository, :wiki_repo, storage_version: ::Project::HASHED_STORAGE_FEATURES[:repository]) } let(:project) { create(:project, :repository, :wiki_repo, storage_version: ::Project::HASHED_STORAGE_FEATURES[:repository]) }
let(:legacy_storage) { Storage::LegacyProject.new(project) } let(:legacy_storage) { Storage::LegacyProject.new(project) }
let(:hashed_storage) { Storage::HashedProject.new(project) } let(:hashed_storage) { Storage::Hashed.new(project) }
subject(:service) { described_class.new(project: project, old_disk_path: project.disk_path) } subject(:service) { described_class.new(project: project, old_disk_path: project.disk_path) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment