Class: Projects::HashedStorage::BaseAttachmentService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/projects/hashed_storage/base_attachment_service.rb

Instance Attribute Summary collapse

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(project:, old_disk_path:, logger: nil) ⇒ BaseAttachmentService

Returns a new instance of BaseAttachmentService.


19
20
21
22
23
# File 'app/services/projects/hashed_storage/base_attachment_service.rb', line 19

def initialize(project:, old_disk_path:, logger: nil)
  @project = project
  @old_disk_path = old_disk_path
  @logger = logger || Gitlab::AppLogger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the logger currently in use


17
18
19
# File 'app/services/projects/hashed_storage/base_attachment_service.rb', line 17

def logger
  @logger
end

#new_disk_pathObject (readonly)

Returns the disk_path value after the execution


14
15
16
# File 'app/services/projects/hashed_storage/base_attachment_service.rb', line 14

def new_disk_path
  @new_disk_path
end

#old_disk_pathObject (readonly)

Returns the disk_path value before the execution


11
12
13
# File 'app/services/projects/hashed_storage/base_attachment_service.rb', line 11

def old_disk_path
  @old_disk_path
end

Instance Method Details

#skipped?Boolean

Return whether this operation was skipped or not

Returns:

  • (Boolean)

    true if skipped of false otherwise


28
29
30
# File 'app/services/projects/hashed_storage/base_attachment_service.rb', line 28

def skipped?
  @skipped
end

#target_path_discardable?(new_path) ⇒ Boolean

Check if target path has discardable content

Parameters:

  • new_path (String)

Returns:

  • (Boolean)

    whether we can discard the target path or not


36
37
38
# File 'app/services/projects/hashed_storage/base_attachment_service.rb', line 36

def target_path_discardable?(new_path)
  false
end