debian-mirror-gitlab/lib/gitlab/graphql/loaders/batch_lfs_oid_loader.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
642 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
module Gitlab
module Graphql
module Loaders
class BatchLfsOidLoader
def initialize(repository, blob_id)
2021-04-29 21:17:54 +05:30
@repository = repository
@blob_id = blob_id
2019-09-04 21:01:54 +05:30
end
def find
2019-12-04 20:38:33 +05:30
BatchLoader::GraphQL.for(blob_id).batch(key: repository) do |blob_ids, loader, batch_args|
2019-09-04 21:01:54 +05:30
Gitlab::Git::Blob.batch_lfs_pointers(batch_args[:key], blob_ids).each do |loaded_blob|
loader.call(loaded_blob.id, loaded_blob.lfs_oid)
end
end
end
private
attr_reader :repository, :blob_id
end
end
end
end