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