Class: Gitlab::BackgroundMigration::BackfillProjectRepositories::Storage::Hashed
- Inherits:
-
Object
- Object
- Gitlab::BackgroundMigration::BackfillProjectRepositories::Storage::Hashed
- 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
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #disk_hash ⇒ Object
- #disk_path ⇒ Object
-
#initialize(project) ⇒ Hashed
constructor
A new instance of Hashed.
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
#project ⇒ Object
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_hash ⇒ Object
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_path ⇒ Object
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 |