Class: Gitlab::Graphql::Loaders::BatchLfsOidLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/graphql/loaders/batch_lfs_oid_loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(repository, blob_id) ⇒ BatchLfsOidLoader

Returns a new instance of BatchLfsOidLoader.



7
8
9
10
# File 'lib/gitlab/graphql/loaders/batch_lfs_oid_loader.rb', line 7

def initialize(repository, blob_id)
  @repository = repository
  @blob_id = blob_id
end

Instance Method Details

#findObject



12
13
14
15
16
17
18
# File 'lib/gitlab/graphql/loaders/batch_lfs_oid_loader.rb', line 12

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