Commit e6a64aac authored by Michael Kozono's avatar Michael Kozono

Replace `with_files_stored_locally` with `geo_syncable`

parent e5fc2b1e
......@@ -9,7 +9,7 @@ module Geo
end
def local_attachments
attachments.with_files_stored_locally
attachments.geo_syncable
end
def count_local_attachments
......@@ -161,7 +161,7 @@ module Geo
def fdw_find_local_attachments
fdw_attachments.joins("INNER JOIN file_registry ON file_registry.file_id = #{fdw_attachments_table}.id")
.with_files_stored_locally
.geo_syncable
.merge(Geo::FileRegistry.attachments)
end
......@@ -171,7 +171,7 @@ module Geo
fdw_attachments.joins("LEFT OUTER JOIN file_registry
ON file_registry.file_id = #{fdw_attachments_table}.id
AND file_registry.file_type IN (#{upload_types})")
.with_files_stored_locally
.geo_syncable
.where(file_registry: { id: nil })
.where.not(id: except_file_ids)
end
......
......@@ -73,7 +73,7 @@ module Geo
end
def local_job_artifacts
job_artifacts.with_files_stored_locally
job_artifacts.geo_syncable
end
def find_retryable_failed_job_artifacts_registries(batch_size:, except_artifact_ids: [])
......@@ -134,13 +134,13 @@ module Geo
def fdw_find_job_artifacts
fdw_job_artifacts.joins("INNER JOIN job_artifact_registry ON job_artifact_registry.artifact_id = #{fdw_job_artifacts_table}.id")
.with_files_stored_locally
.geo_syncable
end
def fdw_find_unsynced_job_artifacts(except_artifact_ids:)
fdw_job_artifacts.joins("LEFT OUTER JOIN job_artifact_registry
ON job_artifact_registry.artifact_id = #{fdw_job_artifacts_table}.id")
.with_files_stored_locally
.geo_syncable
.where(job_artifact_registry: { artifact_id: nil })
.where.not(id: except_artifact_ids)
end
......
......@@ -73,7 +73,7 @@ module Geo
end
def local_lfs_objects
lfs_objects.with_files_stored_locally
lfs_objects.geo_syncable
end
def find_retryable_failed_lfs_objects_registries(batch_size:, except_file_ids: [])
......@@ -122,7 +122,7 @@ module Geo
def fdw_find_lfs_objects
fdw_lfs_objects.joins("INNER JOIN file_registry ON file_registry.file_id = #{fdw_lfs_objects_table}.id")
.with_files_stored_locally
.geo_syncable
.merge(Geo::FileRegistry.lfs_objects)
end
......@@ -130,7 +130,7 @@ module Geo
fdw_lfs_objects.joins("LEFT OUTER JOIN file_registry
ON file_registry.file_id = #{fdw_lfs_objects_table}.id
AND file_registry.file_type = 'lfs'")
.with_files_stored_locally
.geo_syncable
.where(file_registry: { id: nil })
.where.not(id: except_file_ids)
end
......
......@@ -8,6 +8,8 @@ module EE
prepended do
after_destroy :log_geo_event
scope :geo_syncable, -> { with_files_stored_locally }
end
private
......
......@@ -8,6 +8,8 @@ module EE
prepended do
after_destroy :log_geo_event
scope :geo_syncable, -> { with_files_stored_locally }
end
private
......
......@@ -8,6 +8,8 @@ module EE
prepended do
after_destroy :log_geo_event
scope :geo_syncable, -> { with_files_stored_locally }
end
private
......
......@@ -6,6 +6,7 @@ module Geo
scope :with_files_stored_locally, -> { where(file_store: [nil, JobArtifactUploader::Store::LOCAL]) }
scope :with_files_stored_remotely, -> { where(file_store: JobArtifactUploader::Store::REMOTE) }
scope :geo_syncable, -> { with_files_stored_locally }
end
end
end
......
......@@ -5,6 +5,7 @@ module Geo
scope :with_files_stored_locally, -> { where(file_store: [nil, LfsObjectUploader::Store::LOCAL]) }
scope :with_files_stored_remotely, -> { where(file_store: LfsObjectUploader::Store::REMOTE) }
scope :geo_syncable, -> { with_files_stored_locally }
end
end
end
......@@ -5,6 +5,7 @@ module Geo
scope :with_files_stored_locally, -> { where(store: [nil, ObjectStorage::Store::LOCAL]) }
scope :with_files_stored_remotely, -> { where(store: ObjectStorage::Store::REMOTE) }
scope :geo_syncable, -> { with_files_stored_locally }
end
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