s365b.jobs.restore¶
Restoring backed-up items into Microsoft 365.
A restore is asked for in Browse: some items, or everything in a folder (or
a whole mailbox) matching what was shown, as it was at a point in time. The
API records it as a queued job run (queue_restore()); a worker runs it
(run_restore()) with the Restore app, and the module writes the items
back. Like a backup, it shows live progress, can be stopped, is audited and
ends with a notification.
An item that was deleted by the chosen time is restored from its last version before the deletion.
Attributes¶
Classes¶
Which items: picked ones, or everything shown in Browse. |
|
A restore: which items, into which object, where in it. |
|
An item to restore, with the version to restore. |
|
What a restore would do. |
|
Runs queued restores. |
Functions¶
|
Find the item versions a restore covers. |
|
Whether a version has all the extra copies a module restores from. |
|
Count what a restore covers, before starting it. |
|
Record a restore as a queued run and hand it to a worker. |
|
The SDK's view of a catalog object. |
|
A chosen version as the SDK's stored item, read from its repository. |
|
Run a queued restore (the worker task's body). |
Module Contents¶
- class s365b.jobs.restore.RestoreScope[source]¶
Bases:
pydantic.BaseModelWhich items: picked ones, or everything shown in Browse.
- class s365b.jobs.restore.RestoreSpec[source]¶
Bases:
RestoreScopeA restore: which items, into which object, where in it.
- async s365b.jobs.restore.choose(s: sqlalchemy.ext.asyncio.AsyncSession, scope: RestoreScope, at: datetime.datetime, *, item_types: set[str] | None = None, limit: int | None = None) list[Chosen][source]¶
Find the item versions a restore covers.
- Parameters:
s – Session.
scope – What to restore.
at – The point in time.
item_types – Only items of these types.
limit – Read at most this many items (to refuse too many cheaply).
- Returns:
One version per item; for items deleted by then, the last version before the deletion.
- s365b.jobs.restore.has_copies(version: s365b.db.models.ItemVersionRow, names: tuple[str, ...]) bool[source]¶
Whether a version has all the extra copies a module restores from.
- async s365b.jobs.restore.preview(services: s365b.core.services.Services, scope: RestoreScope) Preview[source]¶
Count what a restore covers, before starting it.
- Parameters:
services – Services.
scope – What to restore.
- Returns:
Counts.
- async s365b.jobs.restore.queue_restore(services: s365b.core.services.Services, spec: RestoreSpec, requested_by: str, *, ip: str | None = None) s365b.db.models.JobRun[source]¶
Record a restore as a queued run and hand it to a worker.
- Parameters:
services – Services.
spec – The restore.
requested_by – Username.
ip – The requester’s address, for the audit log.
- Returns:
The queued run.
- Raises:
LookupError – If an object does not exist.
ValueError – If the restore is not possible as asked.
- class s365b.jobs.restore.Restorer(services: s365b.core.services.Services)[source]¶
Runs queued restores.
- Parameters:
services – Process services.
- s365b.jobs.restore.protected_object(row: s365b.db.models.ProtectedObjectRow) s365b.modules.sdk.ProtectedObject[source]¶
The SDK’s view of a catalog object.
- s365b.jobs.restore.stored_item(c: Chosen, obj: s365b.modules.sdk.ProtectedObject, repo: s365b.storage.repository.Repository) s365b.modules.sdk.StoredItem[source]¶
A chosen version as the SDK’s stored item, read from its repository.
- async s365b.jobs.restore.run_restore(services: s365b.core.services.Services, run_id: int) None[source]¶
Run a queued restore (the worker task’s body).
- Parameters:
services – Services.
run_id – The queued run.