l.a.d.DiskPool : class documentation

Part of lp.archivepublisher.diskpool View In Hierarchy

Scan a pool on the filesystem and record information about it.

Its constructor receives 'rootpath', which is the pool path where the files will be installed, and the 'temppath', which is a temporary directory used to store the installation candidate from librarian.

'rootpath' and 'temppath' must be in the same filesystem, see DiskPoolEntry for further information.

Method __init__ Undocumented
Method pathFor Return the path for the given pool folder or file.
Method addFile Add a file with the given contents to the pool.
Method removeFile Remove the specified file from the pool.
Method _getEntry Return a new DiskPoolEntry for the given sourcename and file.
def __init__(self, rootpath, temppath, logger):
Undocumented
def _getEntry(self, sourcename, file):
Return a new DiskPoolEntry for the given sourcename and file.
def pathFor(self, comp, source, file=None):
Return the path for the given pool folder or file.

If file is none, the path to the folder containing all packages for the given component and source package name will be returned.

If file is specified, the path to the specific package file will be returned.

def addFile(self, component, sourcename, filename, sha1, contents):
Add a file with the given contents to the pool.

Component, sourcename and filename are used to calculate the
on-disk location.

sha1 is used to compare with the existing file's checksum, if
a file already exists for any component.

contents is a file-like object containing the contents we want
to write.

There are four possible outcomes:
- If the file doesn't exist in the pool for any component, it will
be written from the given contents and results.ADDED_FILE will be
returned.

- If the file already exists in the pool, in this or any other
component, the checksum of the file on disk will be calculated and
compared with the checksum provided. If they fail to match,
PoolFileOverwriteError will be raised.

- If the file already exists but not in this component, and the
checksum test above passes, a symlink will be added, and
results.SYMLINK_ADDED will be returned. Also, the symlinks will be
checked and sanitised, to ensure the real copy of the file is in the
most preferred component, according to HARDCODED_COMPONENT_ORDER.

- If the file already exists and is already in this component,
either as a file or a symlink, and the checksum check passes,
results.NONE will be returned and nothing will be done.
def removeFile(self, component, sourcename, filename):
Remove the specified file from the pool.

There are three possible outcomes:
- If the specified file does not exist, NotInPool will be raised.

- If the specified file exists and is a symlink, or is the only
copy of the file in the pool, it will simply be deleted, and its
size will be returned.

- If the specified file is a real file and there are symlinks
referencing it, the symlink in the next most preferred component
will be deleted, and the file will be moved to replace it. The
size of the deleted symlink will be returned.
API Documentation for Launchpad, generated by pydoctor at 2019-10-15 00:00:11.