You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: batch.rb
    path of file: ./repos/gitlabhq/lib/gitlab/cleanup/orphan_job_artifact_final_objects
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Gitlab
  module Cleanup
    module OrphanJobArtifactFinalObjects
      c
    
        def orphan_objects
          objects = {}

          fog_collection.each_file_this_page do |fog_file|
            next unless in_final_location?(fog_file.key)

            objects[path_without_bucket_prefix(fog_file.key)] = fog_file
          end

          return [] unless objects.any?

          # First we exclude all objects that have matching existing job artifact record in the DB
          paths_with_job_artifact_records(objects.keys).each do |non_orphan_path|
            objects.delete(non_orphan_path)
          end

          return [] unless objects.any?

          # Next, if there were no matching job artifact record for the remaining paths, we want to
          # check if there is a pending direct upload for the given path, if found, they are not considered orphans.
          paths_with_pending_direct_uploads(objects.keys).each do |non_orphan_path|
            objects.delete(non_orphan_path)
          end

          # Just to keep the lexicographic order of objects
          objects.values.sort_by(&:key)
        end