synology_apm_repo.sdk.positional_io module

Positional read and write on a raw file descriptor, shared by the local store’s reads and the local-file export’s writes.

POSIX uses os.pread/os.pwrite. Windows has neither, so there each call is a ReadFile/WriteFile carrying its offset in an OVERLAPPED. Neither path depends on the file pointer, so several threads can share one fd on every platform.

synology_apm_repo.sdk.positional_io.O_BINARY: int = 0

os.O_BINARY on Windows, where an os.open without it is in text mode and translates line endings; 0 elsewhere. Every raw-fd open of repository or export data includes it.

synology_apm_repo.sdk.positional_io.pread(fd, length, offset)

Reads length bytes at offset, continuing after a short read: fewer only when the file ends first, b"" at or past its end.

Raises:

OSError – The read failed.

synology_apm_repo.sdk.positional_io.pwrite(fd, data, offset)

Writes all of data at offset, continuing after a short write.

Raises:

OSError – The write failed, or made no progress.