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
8294f211
Commit
8294f211
authored
Aug 03, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename GeoNode#project_ids to restricted_project_ids
parent
88a21685
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
17 deletions
+17
-17
app/models/geo_node.rb
app/models/geo_node.rb
+9
-9
app/models/geo_node_status.rb
app/models/geo_node_status.rb
+1
-1
app/views/admin/geo_nodes/index.html.haml
app/views/admin/geo_nodes/index.html.haml
+1
-1
app/workers/geo/repositories_clean_up_worker.rb
app/workers/geo/repositories_clean_up_worker.rb
+1
-1
lib/gitlab/geo/log_cursor/daemon.rb
lib/gitlab/geo/log_cursor/daemon.rb
+2
-2
spec/models/geo_node_spec.rb
spec/models/geo_node_spec.rb
+3
-3
No files found.
app/models/geo_node.rb
View file @
8294f211
...
...
@@ -108,7 +108,7 @@ class GeoNode < ActiveRecord::Base
end
end
def
project_ids
def
restricted_
project_ids
return
unless
namespaces
.
presence
relations
=
namespaces
.
map
{
|
namespace
|
namespace
.
all_projects
.
select
(
:id
)
}
...
...
@@ -119,34 +119,34 @@ class GeoNode < ActiveRecord::Base
end
def
lfs_objects
if
project_ids
LfsObject
.
joins
(
:projects
).
where
(
projects:
{
id:
project_ids
})
if
restricted_
project_ids
LfsObject
.
joins
(
:projects
).
where
(
projects:
{
id:
restricted_
project_ids
})
else
LfsObject
.
all
end
end
def
projects
if
project_ids
Project
.
where
(
id:
project_ids
)
if
restricted_
project_ids
Project
.
where
(
id:
restricted_
project_ids
)
else
Project
.
all
end
end
def
project_registries
if
project_ids
Geo
::
ProjectRegistry
.
where
(
project_id:
project_ids
)
if
restricted_
project_ids
Geo
::
ProjectRegistry
.
where
(
project_id:
restricted_
project_ids
)
else
Geo
::
ProjectRegistry
.
all
end
end
def
uploads
if
project_ids
if
restricted_
project_ids
uploads_table
=
Upload
.
arel_table
group_uploads
=
uploads_table
[
:model_type
].
eq
(
'Namespace'
).
and
(
uploads_table
[
:model_id
].
in
(
Gitlab
::
Geo
.
current_node
.
namespace_ids
))
project_uploads
=
uploads_table
[
:model_type
].
eq
(
'Project'
).
and
(
uploads_table
[
:model_id
].
in
(
project_ids
))
project_uploads
=
uploads_table
[
:model_type
].
eq
(
'Project'
).
and
(
uploads_table
[
:model_id
].
in
(
restricted_
project_ids
))
other_uploads
=
uploads_table
[
:model_type
].
not_in
(
%w[Namespace Project]
)
Upload
.
where
(
group_uploads
.
or
(
project_uploads
).
or
(
other_uploads
))
...
...
app/models/geo_node_status.rb
View file @
8294f211
...
...
@@ -54,7 +54,7 @@ class GeoNodeStatus
@lfs_objects_synced_count
||=
begin
relation
=
Geo
::
FileRegistry
.
where
(
file_type: :lfs
)
if
Gitlab
::
Geo
.
current_node
.
project_ids
if
Gitlab
::
Geo
.
current_node
.
restricted_
project_ids
relation
=
relation
.
where
(
file_id:
lfs_objects
.
pluck
(
:id
))
end
...
...
app/views/admin/geo_nodes/index.html.haml
View file @
8294f211
...
...
@@ -33,7 +33,7 @@
%span
.help-block
Primary node
-
else
=
status_loading_icon
-
if
node
.
project_ids
-
if
node
.
restricted_
project_ids
%p
%span
.help-block
Namespaces to replicate:
...
...
app/workers/geo/repositories_clean_up_worker.rb
View file @
8294f211
...
...
@@ -11,7 +11,7 @@ module Geo
try_obtain_lease
do
geo_node
=
GeoNode
.
find
(
geo_node_id
)
restricted_project_ids
=
geo_node
.
project_ids
restricted_project_ids
=
geo_node
.
restricted_
project_ids
return
unless
restricted_project_ids
Project
.
where
.
not
(
id:
restricted_project_ids
).
find_in_batches
(
batch_size:
BATCH_SIZE
)
do
|
batch
|
...
...
lib/gitlab/geo/log_cursor/daemon.rb
View file @
8294f211
...
...
@@ -98,9 +98,9 @@ module Gitlab
def
can_replay?
(
event_log
)
return
true
if
event_log
.
project_id
.
nil?
return
true
if
Gitlab
::
Geo
.
current_node
.
project_ids
.
nil?
return
true
if
Gitlab
::
Geo
.
current_node
.
restricted_
project_ids
.
nil?
Gitlab
::
Geo
.
current_node
.
project_ids
.
include?
(
event_log
.
project_id
)
Gitlab
::
Geo
.
current_node
.
restricted_
project_ids
.
include?
(
event_log
.
project_id
)
end
def
handle_repository_update
(
updated_event
)
...
...
spec/models/geo_node_spec.rb
View file @
8294f211
...
...
@@ -317,10 +317,10 @@ describe GeoNode, type: :model do
end
end
describe
'#project_ids'
do
describe
'#
restricted_
project_ids'
do
context
'without namespace restriction'
do
it
'returns nil'
do
expect
(
node
.
project_ids
).
to
be_nil
expect
(
node
.
restricted_
project_ids
).
to
be_nil
end
end
...
...
@@ -335,7 +335,7 @@ describe GeoNode, type: :model do
node
.
update_attribute
(
:namespaces
,
[
group_1
,
group_2
,
nested_group_1
])
expect
(
node
.
project_ids
).
to
match_array
([
project_1
.
id
,
project_2
.
id
,
project_3
.
id
])
expect
(
node
.
restricted_
project_ids
).
to
match_array
([
project_1
.
id
,
project_2
.
id
,
project_3
.
id
])
end
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