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
763fb416
Commit
763fb416
authored
Aug 13, 2019
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor finders to define unscoped base model
parent
8e7c1f16
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
6 deletions
+20
-6
ee/app/finders/geo/attachment_registry_finder.rb
ee/app/finders/geo/attachment_registry_finder.rb
+8
-2
ee/app/finders/geo/job_artifact_registry_finder.rb
ee/app/finders/geo/job_artifact_registry_finder.rb
+8
-2
ee/app/finders/geo/lfs_object_registry_finder.rb
ee/app/finders/geo/lfs_object_registry_finder.rb
+2
-0
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
+2
-2
No files found.
ee/app/finders/geo/attachment_registry_finder.rb
View file @
763fb416
...
...
@@ -2,6 +2,8 @@
module
Geo
class
AttachmentRegistryFinder
<
FileRegistryFinder
# Counts all existing registries independent
# of any change on filters / selective sync
def
count_registry
Geo
::
FileRegistry
.
attachments
.
count
end
...
...
@@ -54,7 +56,7 @@ module Geo
# rubocop: disable CodeReuse/ActiveRecord
def
find_migrated_local
(
batch_size
:,
except_file_ids:
[])
attachments
a
ll_a
ttachments
.
inner_join_file_registry
.
with_files_stored_remotely
.
merge
(
Geo
::
FileRegistry
.
attachments
)
...
...
@@ -89,7 +91,11 @@ module Geo
private
def
attachments
local_storage_only?
?
current_node
.
attachments
.
with_files_stored_locally
:
current_node
.
attachments
local_storage_only?
?
all_attachments
.
with_files_stored_locally
:
all_attachments
end
def
all_attachments
current_node
.
attachments
end
def
registries_for_attachments
...
...
ee/app/finders/geo/job_artifact_registry_finder.rb
View file @
763fb416
...
...
@@ -2,6 +2,8 @@
module
Geo
class
JobArtifactRegistryFinder
<
FileRegistryFinder
# Counts all existing registries independent
# of any change on filters / selective sync
def
count_registry
Geo
::
JobArtifactRegistry
.
count
end
...
...
@@ -52,7 +54,7 @@ module Geo
# rubocop: disable CodeReuse/ActiveRecord
def
find_migrated_local
(
batch_size
:,
except_artifact_ids:
[])
current_node
.
job_artifacts
all_
job_artifacts
.
inner_join_job_artifact_registry
.
with_files_stored_remotely
.
id_not_in
(
except_artifact_ids
)
...
...
@@ -84,7 +86,11 @@ module Geo
private
def
job_artifacts
local_storage_only?
?
current_node
.
job_artifacts
.
with_files_stored_locally
:
current_node
.
job_artifacts
local_storage_only?
?
all_job_artifacts
.
with_files_stored_locally
:
all_job_artifacts
end
def
all_job_artifacts
current_node
.
job_artifacts
end
def
registries_for_job_artifacts
...
...
ee/app/finders/geo/lfs_object_registry_finder.rb
View file @
763fb416
...
...
@@ -2,6 +2,8 @@
module
Geo
class
LfsObjectRegistryFinder
<
FileRegistryFinder
# Counts all existing registries independent
# of any change on filters / selective sync
def
count_registry
Geo
::
FileRegistry
.
lfs_objects
.
count
end
...
...
ee/spec/finders/geo/job_artifact_registry_finder_spec.rb
View file @
763fb416
...
...
@@ -219,7 +219,7 @@ describe Geo::JobArtifactRegistryFinder, :geo_fdw do
context
'with object storage sync disabled'
do
let
(
:secondary
)
{
create
(
:geo_node
,
:local_storage
)
}
it
'
does not apply the selective sync restriction
'
do
it
'
counts file registries for job artifacts ignoring remote artifacts
'
do
expect
(
subject
.
count_registry
).
to
eq
4
end
end
...
...
@@ -265,7 +265,7 @@ describe Geo::JobArtifactRegistryFinder, :geo_fdw do
context
'with object storage sync disabled'
do
let
(
:secondary
)
{
create
(
:geo_node
,
:local_storage
)
}
it
'returns job artifacts without an entry on the tracking database, ignoring expired ones'
do
it
'returns job artifacts without an entry on the tracking database, ignoring expired ones
and remotes
'
do
job_artifacts
=
subject
.
find_unsynced
(
batch_size:
10
)
expect
(
job_artifacts
).
to
match_ids
(
job_artifact_2
,
job_artifact_4
)
...
...
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