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
84f9311a
Commit
84f9311a
authored
Nov 06, 2019
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor Upload methods
Shorten names that are already unambiguous.
parent
9967fc58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
ee/app/finders/geo/attachment_registry_finder.rb
ee/app/finders/geo/attachment_registry_finder.rb
+3
-3
ee/app/models/geo/fdw/upload.rb
ee/app/models/geo/fdw/upload.rb
+9
-9
ee/lib/gitlab/geo/fdw/upload_registry_query_builder.rb
ee/lib/gitlab/geo/fdw/upload_registry_query_builder.rb
+8
-8
No files found.
ee/app/finders/geo/attachment_registry_finder.rb
View file @
84f9311a
...
...
@@ -47,7 +47,7 @@ module Geo
# rubocop: disable CodeReuse/ActiveRecord
def
find_unsynced
(
batch_size
:,
except_file_ids:
[])
attachments
.
missing_
file_
registry
.
missing_registry
.
id_not_in
(
except_file_ids
)
.
limit
(
batch_size
)
end
...
...
@@ -56,7 +56,7 @@ module Geo
# rubocop: disable CodeReuse/ActiveRecord
def
find_migrated_local
(
batch_size
:,
except_file_ids:
[])
all_attachments
.
inner_join_
file_
registry
.
inner_join_registry
.
with_files_stored_remotely
.
id_not_in
(
except_file_ids
)
.
limit
(
batch_size
)
...
...
@@ -95,7 +95,7 @@ module Geo
end
def
registries_for_attachments
attachments
.
inner_join_
file_
registry
attachments
.
inner_join_registry
end
end
end
ee/app/models/geo/fdw/upload.rb
View file @
84f9311a
...
...
@@ -15,17 +15,17 @@ module Geo
class
<<
self
def
for_model
(
model
)
inner_join_
file_
registry
inner_join_registry
.
where
(
model_id:
model
.
id
,
model_type:
model
.
class
.
name
)
end
def
inner_join_
file_
registry
def
inner_join_registry
joins
(
:registry
)
end
def
missing_
file_
registry
left_outer_join_
file_
registry
.
where
(
file_
registry_table
[
:id
].
eq
(
nil
))
def
missing_registry
left_outer_join_registry
.
where
(
registry_table
[
:id
].
eq
(
nil
))
end
# Searches for a list of uploads based on the query given in `query`.
...
...
@@ -40,15 +40,15 @@ module Geo
private
def
file_
registry_table
def
registry_table
Geo
::
UploadRegistry
.
arel_table
end
def
left_outer_join_
file_
registry
def
left_outer_join_registry
join_statement
=
arel_table
.
join
(
file_
registry_table
,
Arel
::
Nodes
::
OuterJoin
)
.
on
(
arel_table
[
:id
].
eq
(
file_
registry_table
[
:file_id
]))
.
join
(
registry_table
,
Arel
::
Nodes
::
OuterJoin
)
.
on
(
arel_table
[
:id
].
eq
(
registry_table
[
:file_id
]))
joins
(
join_statement
.
join_sources
)
end
...
...
ee/lib/gitlab/geo/fdw/upload_registry_query_builder.rb
View file @
84f9311a
...
...
@@ -17,8 +17,8 @@ module Gitlab
query
.
joins
(
fdw_inner_join_uploads
)
.
where
(
fdw_
upload_
table
[
:model_id
].
eq
(
model
.
id
)
.
and
(
fdw_
upload_
table
[
:model_type
].
eq
(
model
.
class
.
name
))
fdw_table
[
:model_id
].
eq
(
model
.
id
)
.
and
(
fdw_table
[
:model_type
].
eq
(
model
.
class
.
name
))
)
)
end
...
...
@@ -27,21 +27,21 @@ module Gitlab
private
def
base
::
Geo
::
UploadRegistry
.
select
(
file_
registry_table
[
Arel
.
star
])
::
Geo
::
UploadRegistry
.
select
(
registry_table
[
Arel
.
star
])
end
def
file_
registry_table
def
registry_table
::
Geo
::
UploadRegistry
.
arel_table
end
def
fdw_
upload_
table
def
fdw_table
::
Geo
::
Fdw
::
Upload
.
arel_table
end
def
fdw_inner_join_uploads
file_
registry_table
.
join
(
fdw_
upload_
table
,
Arel
::
Nodes
::
InnerJoin
)
.
on
(
file_registry_table
[
:file_id
].
eq
(
fdw_upload
_table
[
:id
]))
registry_table
.
join
(
fdw_table
,
Arel
::
Nodes
::
InnerJoin
)
.
on
(
registry_table
[
:file_id
].
eq
(
fdw
_table
[
:id
]))
.
join_sources
end
end
...
...
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