Class: Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace_id) ⇒ BatchRootStorageStatisticsLoader

Returns a new instance of BatchRootStorageStatisticsLoader.



9
10
11
# File 'lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader.rb', line 9

def initialize(namespace_id)
  @namespace_id = namespace_id
end

Instance Attribute Details

#namespace_idObject (readonly)

Returns the value of attribute namespace_id.



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

def namespace_id
  @namespace_id
end

Instance Method Details

#findObject



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

def find
  BatchLoader::GraphQL.for(namespace_id).batch do |namespace_ids, loader|
    Namespace::RootStorageStatistics.for_namespace_ids(namespace_ids).each do |statistics|
      loader.call(statistics.namespace_id, statistics)
    end
  end
end