Expand description
Shared, dependency-light helpers for chunked HTTP streaming and retry backoff, used by every reqwest-based provider.
These helpers were previously copy-pasted into the daimon crate’s built-in
providers and into each external provider crate (daimon-provider-gemini,
daimon-provider-azure). They could not live in a shared location before
because the copies were tangled together with reqwest-specific header
parsing, and daimon-core deliberately does not depend on reqwest.
Everything here is std-only. The reqwest-aware Retry-After header wrapper
stays in each provider crate and delegates to parse_retry_after_secs.
Structs§
- Line
Buffer - Accumulates raw stream bytes and yields complete newline-terminated lines.
Constants§
- BASE_
DELAY_ MS - Base delay for the first retry, in milliseconds.
- MAX_
DELAY_ MS - Upper bound on the exponential term (before jitter), in milliseconds.
Functions§
- backoff_
delay - Computes the delay to wait before the next retry attempt.
- full_
jitter - Returns a pseudo-random value in
[0, cap_ms]. - parse_
retry_ after_ secs - Parses a
Retry-Aftervalue expressed in integer seconds.