Class: Gitlab::BackgroundMigration::BackfillProjectRepositories::Storage::Hashed

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/backfill_project_repositories.rb

Overview

Class that returns the disk path for a project using hashed storage

Constant Summary collapse

ROOT_PATH_PREFIX =
'@hashed'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ Hashed

Returns a new instance of Hashed.



54
55
56
# File 'lib/gitlab/background_migration/backfill_project_repositories.rb', line 54

def initialize(project)
  @project = project
end

Instance Attribute Details

#projectObject

Returns the value of attribute project.



50
51
52
# File 'lib/gitlab/background_migration/backfill_project_repositories.rb', line 50

def project
  @project
end

Instance Method Details

#disk_hashObject



62
63
64
# File 'lib/gitlab/background_migration/backfill_project_repositories.rb', line 62

def disk_hash
  @disk_hash ||= Digest::SHA2.hexdigest(project.id.to_s)
end

#disk_pathObject



58
59
60
# File 'lib/gitlab/background_migration/backfill_project_repositories.rb', line 58

def disk_path
  "#{ROOT_PATH_PREFIX}/#{disk_hash[0..1]}/#{disk_hash[2..3]}/#{disk_hash}"
end