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
end
def storage
Storage::HashedProject
.new(self, prefix: Storage::HashedProject::POOL_PATH_PREFIX)
Storage::Hashed
.new(self, prefix: Storage::Hashed::POOL_PATH_PREFIX)
end
end
......
......@@ -2288,7 +2288,7 @@ class Project < ApplicationRecord
def storage
@storage ||=
if hashed_storage?(:repository)
Storage::HashedProject.new(self)
Storage::Hashed.new(self)
else
Storage::LegacyProject.new(self)
end
......
# frozen_string_literal: true
module Storage
class HashedProject
class Hashed
attr_accessor :project
delegate :gitlab_shell, :repository_storage, to: :project
......
......@@ -36,7 +36,7 @@ class FileUploader < GitlabUploader
def self.base_dir(model, store = Store::LOCAL)
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)
end
......@@ -57,7 +57,7 @@ class FileUploader < GitlabUploader
# Returns a String without a trailing slash
def self.model_path_segment(model)
case model
when Storage::HashedProject then model.disk_path
when Storage::Hashed then model.disk_path
else
model.hashed_storage?(:attachments) ? model.disk_path : model.full_path
end
......
......@@ -36,7 +36,7 @@ module Geo
def storage
@storage ||=
if hashed_storage?(:repository)
Storage::HashedProject.new(self)
Storage::Hashed.new(self)
else
Storage::LegacyProject.new(self)
end
......
......@@ -119,7 +119,7 @@ FactoryBot.define do
project { create(:project, :repository) }
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
factory :geo_lfs_object_deleted_event, class: 'Geo::LfsObjectDeletedEvent' do
......
......@@ -10,7 +10,7 @@ describe Geo::HashedStorageAttachmentsMigrationService do
let!(:project) { create(:project, :legacy_storage) }
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(:file_uploader) { build(:file_uploader, project: project) }
......
......@@ -7,7 +7,7 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
let(:project) { create(:project, storage_version: 1) }
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(:new_attachments_path) { hashed_storage.disk_path }
......
......@@ -8,7 +8,7 @@ describe Projects::HashedStorage::MigrateRepositoryService do
let(:gitlab_shell) { Gitlab::Shell.new }
let(:project) { create(:project, :empty_repo, :wiki_repo, :design_repo, :legacy_storage) }
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(:new_disk_path) { hashed_storage.disk_path }
......
......@@ -8,7 +8,7 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis
let(:gitlab_shell) { Gitlab::Shell.new }
let(:project) { create(:project, :repository, :wiki_repo, :design_repo, storage_version: ::Project::HASHED_STORAGE_FEATURES[:repository]) }
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(:new_disk_path) { legacy_storage.disk_path }
......
......@@ -11,7 +11,7 @@ module Gitlab
module Storage
# Class that returns the disk path for a project using hashed storage
class HashedProject
class Hashed
attr_accessor :project
ROOT_PATH_PREFIX = '@hashed'
......@@ -121,7 +121,7 @@ module Gitlab
def storage
@storage ||=
if hashed_storage?
Storage::HashedProject.new(self)
Storage::Hashed.new(self)
else
Storage::LegacyProject.new(self)
end
......
......@@ -46,7 +46,7 @@ module Gitlab
module Storage
# Class that returns the disk path for a project using hashed storage
class HashedProject
class Hashed
attr_accessor :project
ROOT_PATH_PREFIX = '@hashed'
......@@ -176,7 +176,7 @@ module Gitlab
def storage
@storage ||=
if hashed_storage?
Storage::HashedProject.new(self)
Storage::Hashed.new(self)
else
Storage::LegacyProject.new(self)
end
......
......@@ -8,7 +8,7 @@ describe Gitlab::BackgroundMigration::BackfillProjectFullpathInRepoConfig, :migr
let(:group) { namespaces.create!(name: 'foo', path: 'foo') }
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) }
subject(:project_storage) { described_class.new(project) }
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe Projects::AfterRenameService do
let(:rugged_config) { rugged_repo(project.repository).config }
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!(:full_path_before_rename) { project.full_path }
let!(:path_after_rename) { "#{project.path}-renamed" }
......
......@@ -7,7 +7,7 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
let(:project) { create(:project, :repository, storage_version: 1, skip_disk_validation: true) }
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(:file_uploader) { build(:file_uploader, project: project) }
......
......@@ -8,7 +8,7 @@ describe Projects::HashedStorage::MigrateRepositoryService do
let(:gitlab_shell) { Gitlab::Shell.new }
let(:project) { create(:project, :legacy_storage, :repository, :wiki_repo) }
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) }
......
......@@ -7,7 +7,7 @@ describe Projects::HashedStorage::RollbackAttachmentsService do
let(:project) { create(:project, :repository, skip_disk_validation: true) }
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(:file_uploader) { build(:file_uploader, project: project) }
......
......@@ -8,7 +8,7 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis
let(:gitlab_shell) { Gitlab::Shell.new }
let(:project) { create(:project, :repository, :wiki_repo, storage_version: ::Project::HASHED_STORAGE_FEATURES[:repository]) }
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) }
......
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