Rename count_synced_missing_on_primary method

Refactor code to make the finder class
closer to a Geo replicator.
parent 23ff6196
......@@ -2,10 +2,10 @@
module Geo
class FileRegistryFinder < RegistryFinder
# @!method count_synced_missing_on_primary
# @!method synced_missing_on_primary_count
# Return a count of the registry records for the tracked file_type(s)
# that are synced and missing on the primary
def count_synced_missing_on_primary
def synced_missing_on_primary_count
registry_class.synced.missing_on_primary.count
end
......
......@@ -483,7 +483,7 @@ class GeoNodeStatus < ApplicationRecord
self.lfs_objects_synced_count = lfs_objects_finder.synced_count
self.lfs_objects_failed_count = lfs_objects_finder.failed_count
self.lfs_objects_registry_count = lfs_objects_finder.registry_count
self.lfs_objects_synced_missing_on_primary_count = lfs_objects_finder.count_synced_missing_on_primary
self.lfs_objects_synced_missing_on_primary_count = lfs_objects_finder.synced_missing_on_primary_count
end
def load_job_artifacts_data
......@@ -493,7 +493,7 @@ class GeoNodeStatus < ApplicationRecord
self.job_artifacts_synced_count = job_artifacts_finder.synced_count
self.job_artifacts_failed_count = job_artifacts_finder.failed_count
self.job_artifacts_registry_count = job_artifacts_finder.registry_count
self.job_artifacts_synced_missing_on_primary_count = job_artifacts_finder.count_synced_missing_on_primary
self.job_artifacts_synced_missing_on_primary_count = job_artifacts_finder.synced_missing_on_primary_count
end
def load_attachments_data
......@@ -503,7 +503,7 @@ class GeoNodeStatus < ApplicationRecord
self.attachments_synced_count = attachments_finder.synced_count
self.attachments_failed_count = attachments_finder.failed_count
self.attachments_registry_count = attachments_finder.registry_count
self.attachments_synced_missing_on_primary_count = attachments_finder.count_synced_missing_on_primary
self.attachments_synced_missing_on_primary_count = attachments_finder.synced_missing_on_primary_count
end
def load_container_registry_data
......
......@@ -75,7 +75,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
end
end
describe '#count_synced_missing_on_primary' do
describe '#synced_missing_on_primary_count' do
it 'counts registries that have been synced and are missing on the primary, excluding not synced ones' do
create(:geo_upload_registry, :attachment, :failed, file_id: upload_1.id)
create(:geo_upload_registry, :attachment, file_id: upload_2.id, missing_on_primary: true)
......@@ -86,7 +86,7 @@ RSpec.describe Geo::AttachmentRegistryFinder, :geo do
create(:geo_upload_registry, :attachment, file_id: upload_7.id, missing_on_primary: true)
create(:geo_upload_registry, :attachment, :never_synced, file_id: upload_8.id)
expect(subject.count_synced_missing_on_primary).to eq 3
expect(subject.synced_missing_on_primary_count).to eq 3
end
end
......
......@@ -75,7 +75,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
end
end
describe '#count_synced_missing_on_primary' do
describe '#synced_missing_on_primary_count' do
it 'counts registries that have been synced and are missing on the primary, excluding not synced ones' do
create(:geo_job_artifact_registry, :failed, artifact_id: ci_job_artifact_1.id)
create(:geo_job_artifact_registry, artifact_id: ci_job_artifact_2.id, missing_on_primary: true)
......@@ -86,7 +86,7 @@ RSpec.describe Geo::JobArtifactRegistryFinder, :geo do
create(:geo_job_artifact_registry, artifact_id: ci_job_artifact_remote_2.id, missing_on_primary: true)
create(:geo_job_artifact_registry, :never_synced, artifact_id: ci_job_artifact_remote_3.id)
expect(subject.count_synced_missing_on_primary).to eq 3
expect(subject.synced_missing_on_primary_count).to eq 3
end
end
......
......@@ -65,7 +65,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
end
end
describe '#count_synced_missing_on_primary' do
describe '#synced_missing_on_primary_count' do
it 'counts registries that have been synced and are missing on the primary, excluding not synced ones' do
create(:geo_lfs_object_registry, :failed, lfs_object_id: lfs_object_1.id)
create(:geo_lfs_object_registry, lfs_object_id: lfs_object_2.id, missing_on_primary: true)
......@@ -76,7 +76,7 @@ RSpec.describe Geo::LfsObjectRegistryFinder, :geo do
create(:geo_lfs_object_registry, lfs_object_id: lfs_object_remote_2.id, missing_on_primary: true)
create(:geo_lfs_object_registry, :never_synced, lfs_object_id: lfs_object_remote_3.id)
expect(subject.count_synced_missing_on_primary).to eq 3
expect(subject.synced_missing_on_primary_count).to eq 3
end
end
......
......@@ -7,7 +7,7 @@ RSpec.shared_examples 'a file registry finder' do
registry_count
synced_count
failed_count
count_synced_missing_on_primary
synced_missing_on_primary_count
find_retryable_failed_registries
find_retryable_synced_missing_on_primary_registries
}
......
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