synology_apm_repo.sdk.presentation.export_report module

How an export is described to the user, shared by the CLI’s export command and the Browser’s export worker: its byte counts, what a failed sink left on disk, and which failures mean “no room left”.

synology_apm_repo.sdk.presentation.export_report.NO_SPACE_ERRNOS = frozenset({28, 122})

errno values that mean the destination has no room left, from a full filesystem or the user’s quota on it.

class synology_apm_repo.sdk.presentation.export_report.LeftoverOutcome(*args, **kwargs)

Bases: Protocol

What ExportSink.abort reports (AbortOutcome satisfies this).

property kept: bool
property ever_written: bool
class synology_apm_repo.sdk.presentation.export_report.AbortableSink(*args, **kwargs)

Bases: Protocol

A sink an unfinished export can abort (LocalFileSink satisfies this).

property path: Path
async abort()
class synology_apm_repo.sdk.presentation.export_report.ExportSizes(*args, **kwargs)

Bases: Protocol

An export’s byte counts (ExportResult satisfies this).

property bytes_written: int
property logical_size: int
property holes: int
property zeros: int
synology_apm_repo.sdk.presentation.export_report.size_summary(sizes)

"<written> written, <logical> logical, <holes> holes, <zeros> zero-fill".

synology_apm_repo.sdk.presentation.export_report.is_out_of_space(exc)

Whether exc is an OSError for a full filesystem or an exceeded quota.

synology_apm_repo.sdk.presentation.export_report.leftover_note(outcome, part_name, *, keep_partial_hint=False)

What an unfinished export left on disk, phrased from the sink’s abort() outcome. keep_partial_hint adds the --keep-partial advice where the surface has that option.

synology_apm_repo.sdk.presentation.export_report.out_of_space_message(output, exc, outcome, part_name, *, keep_partial_hint=False)

The message for an export that ran out of room writing output, with what it left behind. exc satisfies is_out_of_space.

class synology_apm_repo.sdk.presentation.export_report.ExportTracker(destination, sink=None, label='', done=0, total=None)

Bases: object

What an export in flight is writing — the current item’s sink, destination and label, and for a folder how many files are done — so a cancel or a full disk reports on the right file. Updated as the export runs, hence not frozen.

Variables:
  • destination (pathlib.Path) – Where the current item is written.

  • sink (synology_apm_repo.sdk.presentation.export_report.AbortableSink | None) – The current item’s sink; None before it starts and once it is committed, when a cancel has nothing of it to report.

  • label (str) – The current item’s name within a folder export ("" for one item).

  • done (int) – Folder files exported so far.

  • total (int | None) – The folder’s file count; None for a single item.

destination: Path
sink: AbortableSink | None = None
label: str = ''
done: int = 0
total: int | None = None
item_started(sink, destination, label)

A folder export moved on to the item label, written through sink to destination.

item_finished()

The current folder item was committed.

files_note()

"<done> of <total> files had been exported" for a folder export, else None.

async leftover(*, keep_partial_hint=False)

Aborts the current item’s sink (idempotent) and says what it left on disk (leftover_note); None when no item is in flight.

async out_of_space(exc, *, keep_partial_hint=False)

out_of_space_message for the current item, aborting its sink; without an item in flight, just the reason. exc satisfies is_out_of_space.