Class: Gitlab::BackgroundMigration::BackfillProjectStatisticsStorageSizeWithRecentSize::Storage::Hashed

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

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.



53
54
55
# File 'lib/gitlab/background_migration/backfill_project_statistics_storage_size_with_recent_size.rb', line 53

def initialize(project)
  @project = project
end

Instance Attribute Details

#projectObject

Returns the value of attribute project.



49
50
51
# File 'lib/gitlab/background_migration/backfill_project_statistics_storage_size_with_recent_size.rb', line 49

def project
  @project
end

Instance Method Details

#disk_hashObject



61
62
63
# File 'lib/gitlab/background_migration/backfill_project_statistics_storage_size_with_recent_size.rb', line 61

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

#disk_pathObject



57
58
59
# File 'lib/gitlab/background_migration/backfill_project_statistics_storage_size_with_recent_size.rb', line 57

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