l.s.i.a.IArchiveFileSet(Interface) : interface documentation

Part of lp.soyuz.interfaces.archivefile View In Hierarchy

Bulk operations on files in an archive.
Method new Create a new IArchiveFile.
Method newFromFile Create a new IArchiveFile from a file on the file system.
Method getByArchive Get files in an archive.
Method scheduleDeletion Schedule these archive files for future deletion.
Method unscheduleDeletion Unschedule these archive files for deletion.
Method getContainersToReap Return containers in this archive with files that should be reaped.
Method reap Delete archive files that are past their scheduled deletion date.
def new(archive, container, path, library_file):
Create a new IArchiveFile.
ParametersarchiveThe IArchive containing the new file.
containerAn identifier for the component that manages this file.
pathThe path to the new file within its archive.
library_fileThe ILibraryFileAlias embodying the new file.
def newFromFile(archive, container, path, fileobj, size, content_type):
Create a new IArchiveFile from a file on the file system.
ParametersarchiveThe IArchive containing the new file.
containerAn identifier for the component that manages this file.
pathThe path to the new file within its archive.
fileobjA file-like object to read the data from.
sizeThe size of the file in bytes.
content_typeThe MIME type of the file.
def getByArchive(archive, container=None, path=None, only_condemned=False, eager_load=False):
Get files in an archive.
ParametersarchiveReturn files in this IArchive.
containerReturn only files with this container.
pathReturn only files with this path.
only_condemnedIf True, return only files with a scheduled_deletion_date set.
eager_loadIf True, preload related LibraryFileAlias and LibraryFileContent rows.
ReturnsAn iterable of matched files.
def scheduleDeletion(archive_files, stay_of_execution):
Schedule these archive files for future deletion.

:param archive_files: The `IArchiveFile`s to schedule for deletion.
:param stay_of_execution: A `timedelta`; schedule files for deletion
    this amount of time in the future.
:return: An iterable of (container, path, sha256) for files that
    were scheduled for deletion.
def unscheduleDeletion(archive_files):
Unschedule these archive files for deletion.

This is useful in the case when the new content of a file is
identical to a version that was previously condemned.

:param archive_files: The `IArchiveFile`s to unschedule for deletion.
:return: An iterable of (container, path, sha256) for files that
    were unscheduled for deletion.
def getContainersToReap(archive, container_prefix=None):
Return containers in this archive with files that should be reaped.
ParametersarchiveReturn containers in this IArchive.
container_prefixReturn only containers that start with this prefix.
ReturnsAn iterable of matched container names.
def reap(archive, container=None):
Delete archive files that are past their scheduled deletion date.
ParametersarchiveDelete files from this IArchive.
containerDelete only files with this container.
ReturnsAn iterable of (container, path, sha256) for files that were deleted.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.