s365b.jobs.repair ================= .. py:module:: s365b.jobs.repair .. autoapi-nested-parse:: Find unreadable blobs in a repository and repair the backup around them. A blob can become unreadable through disk faults or (before it was fixed) a compression bug. Its content cannot be recovered from the repository, but the item usually still exists in Microsoft 365. Repair therefore: 1. removes the catalog versions that use an unreadable blob (items left without versions are removed too), 2. resets the sync state of the affected objects, so the next backup reads them in full and stores those items again, 3. deletes the unreadable blobs, and only those, from the repository. This matters: storage is deduplicated by content, so as long as a blob ID is in the index, a new backup of the same content would reuse the broken copy. It holds the repository's lock exclusively, like retention. Classes ------- .. autoapisummary:: s365b.jobs.repair.RepairReport Functions --------- .. autoapisummary:: s365b.jobs.repair.check_repository Module Contents --------------- .. py:class:: RepairReport What a check found and (unless a dry run) repaired. :ivar blobs: Blobs checked. :ivar unreadable: Unreadable blob IDs. :ivar versions: Item versions that use them. :ivar objects: Affected objects, as "module: name" with a version count. :ivar repaired: Whether the repair was applied. .. py:attribute:: blobs :type: int :value: 0 .. py:attribute:: unreadable :type: list[str] :value: [] .. py:attribute:: versions :type: int :value: 0 .. py:attribute:: objects :type: dict[str, int] .. py:attribute:: repaired :type: bool :value: False .. py:function:: check_repository(services: s365b.core.services.Services, repository_fk: int, *, repair: bool, actor: str = 'cli') -> RepairReport :async: Read every blob; optionally repair around the unreadable ones. :param services: Process services. :param repository_fk: Repository. :param repair: Apply the repair (otherwise only report). :param actor: Who ran it, for the audit log. :returns: The report.