-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename space and adjust implementation for spec
- Loading branch information
Showing
8 changed files
with
99 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import | ||
import logging | ||
|
||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from common import utils | ||
|
||
from .location import Location | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class OfflineReplicaStaging(models.Model): | ||
"""Space for storing packages for write-only offline replication. | ||
Uncompressed packages in this Space will be packaged as a tarball | ||
prior to storing. | ||
""" | ||
|
||
packaged_space = True | ||
|
||
space = models.OneToOneField("Space", to_field="uuid", on_delete=models.CASCADE) | ||
|
||
class Meta: | ||
verbose_name = _("Write-Only Replica Staging on Local Filesystem") | ||
app_label = _("locations") | ||
|
||
ALLOWED_LOCATION_PURPOSE = [Location.REPLICATOR] | ||
|
||
def browse(self, path): | ||
raise NotImplementedError( | ||
_("Write-Only Offline Staging does not implement browse") | ||
) | ||
|
||
def delete_path(self, delete_path): | ||
raise NotImplementedError( | ||
_("Write-Only Offline Staging does not implement deletion") | ||
) | ||
|
||
def move_to_storage_service(self, src_path, dest_path, dest_space): | ||
""" Moves src_path to dest_space.staging_path/dest_path. """ | ||
raise NotImplementedError( | ||
_("Write-Only Offline Staging does not implement fetching packages") | ||
) | ||
|
||
def move_from_storage_service(self, src_path, dest_path, package=None): | ||
""" Moves self.staging_path/src_path to dest_path.""" | ||
self.space.create_local_directory(dest_path) | ||
if not self.is_packaged(src_path): | ||
try: | ||
utils.create_tar(src_path, extension=True) | ||
except utils.TARException: | ||
# If tar creation fails, send package back to its source. | ||
self.space.move_rsync(dest_path, src_path, try_mv_local=True) | ||
raise | ||
self.space.move_rsync(src_path, dest_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.