webstation-broker
DeveloperPython referenceemulatorsemulators.rom_cache

emulators.rom_cache._Budget

Paces a copy to a rate cap and enforces its deadline, one chunk at a time.

Paces a copy to a rate cap and enforces its deadline, one chunk at a time.

Functions

func__init__(self, mbps, timeout) -> None

Start the clock.

paramself
parammbpsfloat

Speed cap in MB/s, or 0 for none.

paramtimeoutOptional[float]

Seconds the whole copy may take, or None for no limit.

Returns

None
funcspend(self, n) -> None

Account for n more bytes copied, sleeping when ahead of the cap.

Raises

  • TimeoutError: When the copy has run past its deadline.
paramself
paramnint

Bytes just written.

Returns

None

On this page