Class: Projects::LfsPointers::LfsDownloadLinkListService
- Inherits:
-
BaseService
- Object
- BaseService
- Projects::LfsPointers::LfsDownloadLinkListService
- Defined in:
- app/services/projects/lfs_pointers/lfs_download_link_list_service.rb
Constant Summary collapse
- DOWNLOAD_ACTION =
'download'
- REQUEST_BATCH_SIZE =
This could be different per server, but it seems like a reasonable value to start with. github.com/git-lfs/git-lfs/issues/419
100
- DownloadLinksError =
Class.new(StandardError)
- DownloadLinkNotFound =
Class.new(StandardError)
- DownloadLinksRequestEntityTooLargeError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#remote_uri ⇒ Object
readonly
Returns the value of attribute remote_uri.
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
-
#each_link(oids, &block) ⇒ Object
-
oids: hash of oids to query.
-
-
#initialize(project, remote_uri: nil) ⇒ LfsDownloadLinkListService
constructor
A new instance of LfsDownloadLinkListService.
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
Constructor Details
#initialize(project, remote_uri: nil) ⇒ LfsDownloadLinkListService
Returns a new instance of LfsDownloadLinkListService.
20 21 22 23 24 |
# File 'app/services/projects/lfs_pointers/lfs_download_link_list_service.rb', line 20 def initialize(project, remote_uri: nil) super(project) @remote_uri = remote_uri end |
Instance Attribute Details
#remote_uri ⇒ Object (readonly)
Returns the value of attribute remote_uri.
18 19 20 |
# File 'app/services/projects/lfs_pointers/lfs_download_link_list_service.rb', line 18 def remote_uri @remote_uri end |
Instance Method Details
#each_link(oids, &block) ⇒ Object
-
oids: hash of oids to query. The structure is { lfs_file_oid => lfs_file_size }
Yields operation for each link batch-by-batch
28 29 30 31 32 |
# File 'app/services/projects/lfs_pointers/lfs_download_link_list_service.rb', line 28 def each_link(oids, &block) return unless project&.lfs_enabled? && remote_uri && oids.present? download_links_in_batches(oids, &block) end |