32 Ports
(require denxi/port) | package: denxi |
denxi/port reprovides all bindings from racket/port, in addition to the bindings defined in this section.
procedure
(mebibytes->bytes mebibytes) → exact-nonnegative-integer?
mebibytes : real?
procedure
(transfer bytes-source bytes-sink #:on-status on-status #:max-size max-size #:buffer-size buffer-size #:transfer-name transfer-name #:est-size est-size #:timeout-ms timeout-ms) → void? bytes-source : input-port? bytes-sink : output-port? on-status : (-> $transfer? any) max-size : (or/c +inf.0 exact-positive-integer?) buffer-size : exact-positive-integer? transfer-name : non-empty-string? est-size : (or/c +inf.0 real?) timeout-ms : (>=/c 0)
transfer applies on-status repeatedly and synchronously with $transfer messages.
transfer reads no more than N bytes from bytes-source, and will wait no longer than timeout-ms for the next available byte.
The value of N is computed using est-size and max-size. max-size is the prescribed upper limit for total bytes to copy. est-size is an estimated for the number of bytes that bytes-source will actually produce (this is typically not decided by the user). If (> est-size max-size), then the transfer will not start. Otherwise N is bound to est-size to hold bytes-source accountable for the estimate.
If est-size and max-size are both +inf.0, then transfer will not terminate if bytes-source does not produce eof.
struct
(struct $transfer:scope $transfer (name message) #:prefab) name : string? message : (and/c $transfer? (not/c $transfer:scope?))
struct
(struct $transfer:progress $transfer ( bytes-read max-size timestamp) #:prefab) bytes-read : exact-nonnegative-integer? max-size : (or/c +inf.0 exact-positive-integer?) timestamp : exact-positive-integer?
Unless max-size is +inf.0, (/ bytes-read max-size) approaches 1. You can use this along with the timestamp (in seconds) to reactively compute an estimated time to complete.
struct
(struct $transfer:budget $transfer () #:prefab)
struct
(struct $transfer:budget:exceeded $message (size) #:prefab) size : exact-positive-integer?
See DENXI_FETCH_TOTAL_SIZE_MB and DENXI_FETCH_PKGDEF_SIZE_MB.
struct
(struct $transfer:budget:rejected $message ( proposed-max-size allowed-max-size) #:prefab) proposed-max-size : (or/c +inf.0 exact-positive-integer?) allowed-max-size : exact-positive-integer?
See DENXI_FETCH_TOTAL_SIZE_MB and DENXI_FETCH_PKGDEF_SIZE_MB.
struct
(struct $transfer:timeout $message (bytes-read wait-time) #:prefab) bytes-read : exact-nonnegative-integer? wait-time : (>=/c 0)