Class: Resolvers::BlobsResolver
- Inherits:
-
BaseResolver
- Object
- GraphQL::Schema::Resolver
- BaseResolver
- Resolvers::BlobsResolver
- Defined in:
- app/graphql/resolvers/blobs_resolver.rb
Constant Summary
Constants included from Gitlab::Graphql::Authorize::AuthorizeResource
Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR
Class Method Summary collapse
-
.resolver_complexity(args, child_complexity:) ⇒ Object
We fetch blobs from Gitaly efficiently but it still scales O(N) with the number of paths being fetched, so apply a scaling limit to that.
Instance Method Summary collapse
Methods included from Gitlab::Graphql::Authorize::AuthorizeResource
#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!
Methods inherited from BaseResolver
as_single, authorization, authorized?, before_connection_authorization, before_connection_authorization_block, calls_gitaly!, complexity, complexity_multiplier, #current_user, field_options, last, #object, #offset_pagination, requires_argument!, #select_result, single, #single?, single_definition_blocks, singular_type, when_single
Methods included from Gitlab::Utils::Override
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
Methods included from Gitlab::Graphql::GlobalIDCompatibility
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Class Method Details
.resolver_complexity(args, child_complexity:) ⇒ Object
We fetch blobs from Gitaly efficiently but it still scales O(N) with the number of paths being fetched, so apply a scaling limit to that.
23 24 25 |
# File 'app/graphql/resolvers/blobs_resolver.rb', line 23 def self.resolver_complexity(args, child_complexity:) super + (args[:paths] || []).size end |
Instance Method Details
#resolve(paths:, ref:) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'app/graphql/resolvers/blobs_resolver.rb', line 27 def resolve(paths:, ref:) (repository.container) return [] if repository.empty? ref ||= repository.root_ref validate_ref(ref) repository.blobs_at(paths.map { |path| [ref, path] }) end |