synology_apm_repo.sdk.units.content.readahead module¶
SequentialReadahead: few large reads for a reader that asks for one
small block at a time and waits for each (Dissect parsing a disk image
through disk_fs’s bridge), where every read is a storage round trip.
Once a stream of consecutive reads is seen, the read that continues it
fetches a window from its own offset in one read, and later reads inside
that window are served from it. A read no window covers, or whose window
failed or came back short, goes to the source as asked; random reads
fetch nothing extra. Windows are dropped once reads stop for
IDLE_SECONDS.
- synology_apm_repo.sdk.units.content.readahead.TRIGGER = 2¶
Consecutive reads that make a stream sequential.
- synology_apm_repo.sdk.units.content.readahead.FIRST_WINDOW = 262144¶
The first window of a stream; each window read past doubles the next.
- synology_apm_repo.sdk.units.content.readahead.MAX_WINDOW = 4194304¶
The largest window. A read at least this big is passed through, being one large read already.
- synology_apm_repo.sdk.units.content.readahead.MAX_BYTES = 16777216¶
The most bytes held over all streams, windows still loading included.
- synology_apm_repo.sdk.units.content.readahead.IDLE_SECONDS = 2.0¶
Seconds with no read in progress after which every window is dropped.
- synology_apm_repo.sdk.units.content.readahead.MIN_WINDOW = 65536¶
Smaller windows are not worth a read of their own.
- synology_apm_repo.sdk.units.content.readahead.STREAMS = 4¶
Sequential streams tracked at once; the least recently used goes.
- class synology_apm_repo.sdk.units.content.readahead.SequentialReadahead(read, size)¶
Bases:
objectReads ahead for sequential readers of
read, a source ofsizebytes that never changes. Every call runs on one event loop, which is what makes its bookkeeping safe without a lock.- Parameters:
- async read(offset, length)¶
lengthbytes atoffset, from windows when they cover it, else from the source (the source’s errors propagate unchanged).