Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-archiver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Platform
Development
swh-archiver
Commits
61b6796a
Commit
61b6796a
authored
8 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
archiver: Simplify update on content
parent
115050d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/archiver/worker.py
+2
-22
2 additions, 22 deletions
swh/archiver/worker.py
with
2 additions
and
22 deletions
swh/archiver/worker.py
+
2
−
22
View file @
61b6796a
...
...
@@ -159,7 +159,7 @@ class BaseArchiveWorker(config.SWHConfig, metaclass=abc.ABCMeta):
# as they cannot be retrieved correctly.
content_ids
.
remove
(
content_id
)
# Update their status to reflect their real state.
self
.
content_archive_update
(
self
.
archiver_db
.
content_archive_update
(
content_id
,
archive_id
=
source
,
new_status
=
real_status
)
# Now perform the copy on the remaining contents
...
...
@@ -171,7 +171,7 @@ class BaseArchiveWorker(config.SWHConfig, metaclass=abc.ABCMeta):
if
ac
.
run
():
# Once the archival complete, update the database.
for
content_id
in
content_ids
:
self
.
content_archive_update
(
self
.
archiver_db
.
content_archive_update
(
content_id
,
archive_id
=
destination
,
new_status
=
'
present
'
)
def
get_contents_error
(
self
,
content_ids
,
source_storage
):
...
...
@@ -206,26 +206,6 @@ class BaseArchiveWorker(config.SWHConfig, metaclass=abc.ABCMeta):
return
content_status
def
content_archive_update
(
self
,
content_id
,
archive_id
,
new_status
=
None
):
"""
Update the status of a archive content and set its mtime to now.
Change the last modification time of an archived content and change
its status to the given one.
Args:
content_id (str): The content id.
archive_id (str): The id of the concerned archive.
new_status (str): One of missing, ongoing or present, this
status will replace the previous one. If not given, the
function only changes the mtime of the content.
"""
db_obj_id
=
r
'
\x
'
+
hashutil
.
hash_to_hex
(
content_id
)
self
.
archiver_db
.
content_archive_update
(
db_obj_id
,
archive_id
,
new_status
)
@abc.abstractmethod
def
need_archival
(
self
,
content_data
):
"""
Indicate if the content needs to be archived.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment