l.a.d.DiskPoolEntry : class documentation

Part of lp.archivepublisher.diskpool View In Hierarchy

Represents a single file in the pool, across all components.

Creating a DiskPoolEntry performs disk reads, so don't create an instance of this class unless you need to know what's already on the disk for this file.

'tempath' must be in the same filesystem as 'rootpath', it will be used to store the instalation candidate while it is being downloaded from the Librarian.

Remaining files in the 'temppath' indicated installation failures and require manual removal after further investigation.

Method __init__ Undocumented
Method debug Undocumented
Method pathFor Return the path for this file in the given component.
Method preferredComponent Return the appropriate component for the real file.
Method file_hash Return the SHA1 sum of this file.
Method addFile See DiskPool.addFile.
Method removeFile Remove a file from a given component; return bytes freed.
Method _reallyRemove Remove file and return file size.
Method _shufflesymlinks Shuffle the symlinks for filename so that targetcomponent contains
Method _sanitiseLinks Ensure the real file is in the most preferred component.
def __init__(self, rootpath, temppath, source, filename, logger):
Undocumented
def debug(self, *args, **kwargs):
Undocumented
def pathFor(self, component):
Return the path for this file in the given component.
def preferredComponent(self, add=None, remove=None):
Return the appropriate component for the real file.

If add is passed, add it to the list before calculating. If remove is passed, remove it before calculating. Thus, we can calcuate which component should contain the main file after the addition or removal we are working on.

@cachedproperty
def file_hash(self):
Return the SHA1 sum of this file.
def addFile(self, component, sha1, contents):
See DiskPool.addFile.
def removeFile(self, component):

Remove a file from a given component; return bytes freed.

This method handles three situations:

  1. Remove a symlink
  2. Remove the main file and there are no symlinks left.
  3. Remove the main file and there are symlinks left.
def _reallyRemove(self, component):
Remove file and return file size.

Remove the file from the filesystem and from our data structures.

def _shufflesymlinks(self, targetcomponent):
Shuffle the symlinks for filename so that targetcomponent contains the real file and the rest are symlinks to the right place...
def _sanitiseLinks(self):
Ensure the real file is in the most preferred component.

If this file is in more than one component, ensure the real file is in the most preferred component and the other components use symlinks.

It's important that the real file be in the most preferred component because partial mirrors may only take a subset of components, and these partial mirrors must not have broken symlinks where they should have working files.

API Documentation for Launchpad, generated by pydoctor at 2019-10-15 00:00:11.