synology_apm_repo.sdk.api.export module¶
run_export: the one way to export a restorable unit’s content to an
ExportSink.
- type synology_apm_repo.sdk.api.export.ExportProgressCallback = Callable[[int, int], Awaitable[None]]¶
Receives an export’s
(done, total)byte counts as data is written.
- async synology_apm_repo.sdk.api.export.run_export(content, sink, *, sparse=True, progress=None, tuning=None)¶
Exports
contentintosink: opens the sink at the content’s size, writes every byte into it, then commits it. On any failure — cancellation included — the sink is aborted and the error re-raised; call the sink’sabort()again (idempotent) for itsAbortOutcome.A sink with a
segment_sizeis fed one segment at a time, each written in full and then completed before the next is requested, so the sink decides when the export may go on.- Parameters:
content (ContentSource) – The content to export.
sink (ExportSink) – The destination; a fresh one, not yet opened.
sparse (bool) – Leave
ZERO/HOLEranges unwritten where the sink allows it.progress (ExportProgressCallback | None) – Receives
(done, total)byte counts as data is written;totaliscontent.planned_bytesover the whole content, which can be less than its size (dedup-backed content counts onlyDATAbytes).tuning (ExportTuning | None) – How dedup-backed content decodes (default
ExportTuning(): in this process, several reads at once); ignored by other content.
- Returns:
What was written, and how much of the content was holes or zeros.
- Raises:
ValueError – The content’s size is unknown even after a read, or the sink’s
segment_sizeis not a positive multiple of 4096.- Return type: