Extract a base Geo::RegistryFinder

parent 4a131756
module Geo
class FileRegistryFinder
attr_reader :current_node
def initialize(current_node: nil)
@current_node = current_node
end
class FileRegistryFinder < RegistryFinder
def find_failed_objects(batch_size:)
Geo::FileRegistry
.failed
......@@ -28,7 +22,7 @@ module Geo
# Selective project replication adds a wrinkle to FDW queries, so
# we fallback to the legacy version for now.
relation =
if Gitlab::Geo.fdw? && !selective_sync
if fdw?
fdw_find_nonreplicated_lfs_objects
else
legacy_find_nonreplicated_lfs_objects(except_registry_ids: except_registry_ids)
......@@ -54,7 +48,7 @@ module Geo
# Selective project replication adds a wrinkle to FDW queries, so
# we fallback to the legacy version for now.
relation =
if Gitlab::Geo.fdw? && !selective_sync
if fdw?
fdw_find_nonreplicated_uploads
else
legacy_find_nonreplicated_uploads(except_registry_ids: except_registry_ids)
......@@ -68,10 +62,6 @@ module Geo
protected
def selective_sync
current_node.restricted_project_ids
end
#
# FDW accessors
#
......
module Geo
class ProjectRegistryFinder
attr_reader :current_node
def initialize(current_node: nil)
@current_node = current_node
end
class ProjectRegistryFinder < RegistryFinder
def find_unsynced_projects(batch_size:)
relation =
if fdw?
......@@ -30,20 +24,10 @@ module Geo
protected
def fdw?
# Selective project replication adds a wrinkle to FDW
# queries, so we fallback to the legacy version for now.
Gitlab::Geo.fdw? && !selective_sync
end
def fdw_table
Geo::Fdw::Project.table_name
end
def selective_sync
current_node.restricted_project_ids
end
#
# FDW accessors
#
......
module Geo
class RegistryFinder
attr_reader :current_node
def initialize(current_node: nil)
@current_node = current_node
end
protected
def fdw?
# Selective project replication adds a wrinkle to FDW
# queries, so we fallback to the legacy version for now.
Gitlab::Geo.fdw? && !selective_sync
end
def selective_sync
current_node.restricted_project_ids
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