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: pending_direct_upload.rb
    path of file: ./repos/gitlabhq/lib/object_storage
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module ObjectStorage
  class PendingDirectUpload
    include ObjectStorage::FogHelpers

    KEY = 'pending_direct_uploads'
    MAX_UPLOAD_DURATION = 3.hours.freeze

    def self.prepare(location_identifier, object_storage_path)
      with_redis do |redis|
        # We need to store the location_identifier together with the timestamp to properly delete
        # this object if ever this upload gets stal
    
    def self.each
      with_redis do |redis|
        redis.hscan_each(KEY) do |entry|
          redis_key, timestamp = entry
          storage_location_identifier, object_storage_path = redis_key.split(':')

          object = new(
            redis_key: redis_key,
            storage_location_identifier: storage_location_identifier,
            object_storage_path: object_storage_path,
            timestamp: timestamp
          )

          yield(object)
        end
      end
    end