Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
741d21c8
Commit
741d21c8
authored
Apr 29, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor finder to find job artifacts
Remove code duplication in the finders.
parent
018dc130
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
25 deletions
+23
-25
ee/app/finders/geo/job_artifact_registry_finder.rb
ee/app/finders/geo/job_artifact_registry_finder.rb
+9
-15
ee/app/finders/geo/legacy_job_artifact_registry_finder.rb
ee/app/finders/geo/legacy_job_artifact_registry_finder.rb
+2
-10
ee/app/models/geo/fdw/geo_node.rb
ee/app/models/geo/fdw/geo_node.rb
+6
-0
ee/app/models/geo_node.rb
ee/app/models/geo_node.rb
+6
-0
No files found.
ee/app/finders/geo/job_artifact_registry_finder.rb
View file @
741d21c8
...
...
@@ -26,7 +26,7 @@ module Geo
if
use_legacy_queries_for_selective_sync?
legacy_finder
.
syncable
elsif
selective_sync?
job_artifacts
.
syncable
fdw_geo_node
.
job_artifacts
.
syncable
else
Ci
::
JobArtifact
.
syncable
end
...
...
@@ -101,19 +101,12 @@ module Geo
@fdw_geo_node
||=
Geo
::
Fdw
::
GeoNode
.
find
(
current_node
.
id
)
end
def
job_artifacts
if
selective_sync?
Geo
::
Fdw
::
Ci
::
JobArtifact
.
project_id_in
(
fdw_geo_node
.
projects
)
else
Geo
::
Fdw
::
Ci
::
JobArtifact
.
all
end
end
def
registries_for_job_artifacts
if
use_legacy_queries_for_selective_sync?
legacy_finder
.
registries_for_job_artifacts
else
job_artifacts
fdw_geo_node
.
job_artifacts
.
inner_join_job_artifact_registry
.
syncable
end
...
...
@@ -144,18 +137,19 @@ module Geo
end
def
fdw_find_unsynced
(
except_artifact_ids
:)
job_artifacts
.
missing_job_artifact_registry
fdw_geo_node
.
job_artifacts
.
syncable
.
missing_job_artifact_registry
.
id_not_in
(
except_artifact_ids
)
end
def
fdw_find_migrated_local
(
except_artifact_ids
:)
job_artifacts
fdw_geo_node
.
job_artifacts
.
inner_join_job_artifact_registry
.
with_files_stored_remotely
.
id_not_in
(
except_artifact_ids
)
.
merge
(
Geo
::
JobArtifactRegistry
.
all
)
end
def
legacy_find_unsynced
(
except_artifact_ids
:)
...
...
@@ -172,7 +166,7 @@ module Geo
registry_artifact_ids
=
Geo
::
JobArtifactRegistry
.
pluck_artifact_key
-
except_artifact_ids
legacy_inner_join_registry_ids
(
legacy_finder
.
job_artifacts
.
with_files_stored_remotely
,
current_node
.
job_artifacts
.
with_files_stored_remotely
,
registry_artifact_ids
,
Ci
::
JobArtifact
)
...
...
ee/app/finders/geo/legacy_job_artifact_registry_finder.rb
View file @
741d21c8
...
...
@@ -3,15 +3,7 @@
module
Geo
class
LegacyJobArtifactRegistryFinder
<
RegistryFinder
def
syncable
job_artifacts
.
syncable
end
def
job_artifacts
if
selective_sync?
Ci
::
JobArtifact
.
project_id_in
(
current_node
.
projects
)
else
Ci
::
JobArtifact
.
all
end
current_node
.
job_artifacts
.
syncable
end
def
job_artifacts_synced
...
...
@@ -43,7 +35,7 @@ module Geo
legacy_inner_join_registry_ids
(
Geo
::
JobArtifactRegistry
.
all
,
job_artifacts
.
pluck_primary_key
,
current_node
.
job_artifacts
.
pluck_primary_key
,
Geo
::
JobArtifactRegistry
,
foreign_key: :artifact_id
)
...
...
ee/app/models/geo/fdw/geo_node.rb
View file @
741d21c8
...
...
@@ -14,6 +14,12 @@ module Geo
has_many
:geo_node_namespace_links
,
class_name:
'Geo::Fdw::GeoNodeNamespaceLink'
has_many
:namespaces
,
class_name:
'Geo::Fdw::Namespace'
,
through: :geo_node_namespace_links
def
job_artifacts
Geo
::
Fdw
::
Ci
::
JobArtifact
.
all
unless
selective_sync?
Geo
::
Fdw
::
Ci
::
JobArtifact
.
project_id_in
(
projects
)
end
def
lfs_objects
return
Geo
::
Fdw
::
LfsObject
.
all
unless
selective_sync?
...
...
ee/app/models/geo_node.rb
View file @
741d21c8
...
...
@@ -194,6 +194,12 @@ class GeoNode < ApplicationRecord
end
end
def
job_artifacts
Ci
::
JobArtifact
.
all
unless
selective_sync?
Ci
::
JobArtifact
.
project_id_in
(
projects
)
end
def
lfs_objects
return
LfsObject
.
all
unless
selective_sync?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment