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
fc39da08
Commit
fc39da08
authored
May 20, 2020
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a class method to delete registries
parent
2e1fff6c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
3 deletions
+25
-3
ee/app/models/geo/base_registry.rb
ee/app/models/geo/base_registry.rb
+4
-0
ee/app/models/geo/job_artifact_registry.rb
ee/app/models/geo/job_artifact_registry.rb
+9
-3
ee/app/models/geo/lfs_object_registry.rb
ee/app/models/geo/lfs_object_registry.rb
+6
-0
ee/app/models/geo/upload_registry.rb
ee/app/models/geo/upload_registry.rb
+6
-0
No files found.
ee/app/models/geo/base_registry.rb
View file @
fc39da08
...
...
@@ -30,4 +30,8 @@ class Geo::BaseRegistry < Geo::TrackingBase
bulk_insert!
(
records
,
returns: :ids
)
end
def
self
.
delete_for_model_ids
(
ids
)
raise
NotImplementedError
,
"
#{
self
.
class
}
does not implement
#{
__method__
}
"
end
end
ee/app/models/geo/job_artifact_registry.rb
View file @
fc39da08
...
...
@@ -33,14 +33,20 @@ class Geo::JobArtifactRegistry < Geo::BaseRegistry
# TODO: remove once `success` column has a default value set
# https://gitlab.com/gitlab-org/gitlab/-/issues/214407
def
self
.
insert_for_model_ids
(
id
s
)
records
=
ids
.
map
do
|
id
|
new
(
artifact_id:
id
,
success:
false
,
created_at:
Time
.
zone
.
now
)
def
self
.
insert_for_model_ids
(
attr
s
)
records
=
attrs
.
map
do
|
artifact_id
,
_
|
new
(
artifact_id:
artifact_
id
,
success:
false
,
created_at:
Time
.
zone
.
now
)
end
bulk_insert!
(
records
,
returns: :ids
)
end
def
self
.
delete_for_model_ids
(
attrs
)
records
=
attrs
.
map
do
|
artifact_id
,
_
|
::
Geo
::
FileRegistryRemovalWorker
.
perform_async
(
:job_artifact
,
artifact_id
)
# rubocop:disable CodeReuse/Worker
end
end
def
self
.
replication_enabled?
JobArtifactUploader
.
object_store_enabled?
?
Gitlab
::
Geo
.
current_node
.
sync_object_storage?
:
true
end
...
...
ee/app/models/geo/lfs_object_registry.rb
View file @
fc39da08
...
...
@@ -26,4 +26,10 @@ class Geo::LfsObjectRegistry < Geo::BaseRegistry
def
self
.
has_create_events?
false
end
def
self
.
delete_for_model_ids
(
ids
)
ids
.
map
do
|
id
|
::
Geo
::
FileRegistryRemovalWorker
.
perform_async
(
:lfs
,
id
)
# rubocop:disable CodeReuse/Worker
end
end
end
ee/app/models/geo/upload_registry.rb
View file @
fc39da08
...
...
@@ -36,6 +36,12 @@ class Geo::UploadRegistry < Geo::BaseRegistry
bulk_insert!
(
records
,
returns: :ids
)
end
def
self
.
delete_for_model_ids
(
attrs
)
attrs
.
map
do
|
file_id
,
file_type
|
::
Geo
::
FileRegistryRemovalWorker
.
perform_async
(
file_type
,
file_id
)
# rubocop:disable CodeReuse/Worker
end
end
def
self
.
with_search
(
query
)
return
all
if
query
.
nil?
...
...
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