summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2019-08-22 22:08:29 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2019-08-22 22:08:29 +0000
commit01696b9d7df0bcc4c453b5c109ba7f811cda4d2f (patch)
treebfaee792fd551070a3581c77bc52164610f03b2a /lib
parentc65ea080ba8637f0e83ea97b091e4ab3ebbce635 (diff)
parent606a1d2d31aff69ddabe7e3794f61f3e778da3e8 (diff)
downloadgitlab-ce-01696b9d7df0bcc4c453b5c109ba7f811cda4d2f.tar.gz
Merge branch 'ac-graphql-root-namespace-stats' into 'master'
Expose namespace storage statistics with GraphQL See merge request gitlab-org/gitlab-ce!32012
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader.rb b/lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader.rb
new file mode 100644
index 00000000000..a0312366d66
--- /dev/null
+++ b/lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Graphql
+ module Loaders
+ class BatchRootStorageStatisticsLoader
+ attr_reader :namespace_id
+
+ def initialize(namespace_id)
+ @namespace_id = namespace_id
+ end
+
+ def find
+ BatchLoader.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
+ end
+ end
+ end
+end