Welcome to mirror list, hosted at ThFree Co, Russian Federation.

batch_lfs_oid_loader.rb « loaders « graphql « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 67511c124e405383246e570a20b6a920675d7edc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Gitlab
  module Graphql
    module Loaders
      class BatchLfsOidLoader
        def initialize(repository, blob_id)
          @repository, @blob_id = repository, blob_id
        end

        def find
          BatchLoader::GraphQL.for(blob_id).batch(key: repository) do |blob_ids, loader, batch_args|
            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