Commit 96cd3545 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Rename FileReplication as Replication

parent 7ebcc620
......@@ -49,7 +49,7 @@ module Geo
join_statement =
arel_table
.join(file_registry_table, Arel::Nodes::OuterJoin)
.on(arel_table[:id].eq(file_registry_table[:file_id]).and(file_registry_table[:file_type].in(Gitlab::Geo::FileReplication::USER_UPLOADS_OBJECT_TYPES)))
.on(arel_table[:id].eq(file_registry_table[:file_id]).and(file_registry_table[:file_type].in(Gitlab::Geo::Replication::USER_UPLOADS_OBJECT_TYPES)))
joins(join_statement.join_sources)
end
......
......@@ -3,19 +3,19 @@
class Geo::FileRegistry < Geo::BaseRegistry
include Geo::Syncable
scope :attachments, -> { where(file_type: Gitlab::Geo::FileReplication::USER_UPLOADS_OBJECT_TYPES) }
scope :attachments, -> { where(file_type: Gitlab::Geo::Replication::USER_UPLOADS_OBJECT_TYPES) }
scope :failed, -> { where(success: false).where.not(retry_count: nil) }
scope :fresh, -> { order(created_at: :desc) }
scope :lfs_objects, -> { where(file_type: :lfs) }
scope :never, -> { where(success: false, retry_count: nil) }
scope :uploads, -> { where(file_type: Gitlab::Geo::FileReplication::UPLOAD_OBJECT_TYPE) }
scope :uploads, -> { where(file_type: Gitlab::Geo::Replication::UPLOAD_OBJECT_TYPE) }
self.inheritance_column = 'file_type'
def self.find_sti_class(file_type)
if file_type == 'lfs'
Geo::LfsObjectRegistry
elsif Gitlab::Geo::FileReplication.object_type_from_user_uploads?(file_type)
elsif Gitlab::Geo::Replication.object_type_from_user_uploads?(file_type)
Geo::UploadRegistry
end
end
......
......@@ -10,7 +10,7 @@ class Geo::UploadRegistry < Geo::FileRegistry
def self.type_condition(table = arel_table)
sti_column = arel_attribute(inheritance_column, table)
sti_names = Gitlab::Geo::FileReplication::USER_UPLOADS_OBJECT_TYPES
sti_names = Gitlab::Geo::Replication::USER_UPLOADS_OBJECT_TYPES
sti_column.in(sti_names)
end
......
......@@ -25,7 +25,7 @@ module Geo
private
def user_upload?
Gitlab::Geo::FileReplication.object_type_from_user_uploads?(object_type)
Gitlab::Geo::Replication.object_type_from_user_uploads?(object_type)
end
def job_artifact?
......
......@@ -78,7 +78,7 @@ module Geo
LfsObject.find(object_db_id).file
when :job_artifact
Ci::JobArtifact.find(object_db_id).file
when *Gitlab::Geo::FileReplication::USER_UPLOADS_OBJECT_TYPES
when *Gitlab::Geo::Replication::USER_UPLOADS_OBJECT_TYPES
Upload.find(object_db_id).build_uploader
else
raise NameError, "Unrecognized type: #{object_type}"
......
......@@ -66,7 +66,7 @@ module Geo
def job_finders
@job_finders ||= [
Geo::FileDownloadDispatchWorker::AttachmentJobFinder.new(scheduled_file_ids(Gitlab::Geo::FileReplication::USER_UPLOADS_OBJECT_TYPES)),
Geo::FileDownloadDispatchWorker::AttachmentJobFinder.new(scheduled_file_ids(Gitlab::Geo::Replication::USER_UPLOADS_OBJECT_TYPES)),
Geo::FileDownloadDispatchWorker::LfsObjectJobFinder.new(scheduled_file_ids(:lfs)),
Geo::FileDownloadDispatchWorker::JobArtifactJobFinder.new(scheduled_file_ids(:job_artifact))
]
......
......@@ -58,7 +58,7 @@ module Geo
def find_migrated_local_attachments_ids(batch_size:)
return [] unless attachments_object_store_enabled?
attachments_finder.find_migrated_local(batch_size: batch_size, except_file_ids: scheduled_file_ids(Gitlab::Geo::FileReplication::USER_UPLOADS_OBJECT_TYPES))
attachments_finder.find_migrated_local(batch_size: batch_size, except_file_ids: scheduled_file_ids(Gitlab::Geo::Replication::USER_UPLOADS_OBJECT_TYPES))
.pluck(:uploader, :id)
.map { |uploader, id| [uploader.sub(/Uploader\z/, '').underscore, id] }
end
......
......@@ -2,11 +2,11 @@
module Gitlab
module Geo
module FileReplication
module Replication
USER_UPLOADS_OBJECT_TYPES = %i[attachment avatar file import_export namespace_file personal_file favicon].freeze
UPLOAD_OBJECT_TYPE = :file
def object_type_from_user_uploads?(object_type)
def self.object_type_from_user_uploads?(object_type)
USER_UPLOADS_OBJECT_TYPES.include?(object_type.to_sym)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment