Skip to content

feat(cache): expose session byte budgets and lifecycle status - #830

Open
orut34iop wants to merge 1 commit into
superuser404notfound:mainfrom
orut34iop:codex/feat-session-cache-budget-status
Open

orut34iop wants to merge 1 commit into
superuser404notfound:mainfrom
orut34iop:codex/feat-session-cache-budget-status

Conversation

@orut34iop

Copy link
Copy Markdown
Contributor

Hosts can choose a forward window but cannot request an exact temporary VOD cache budget or tell whether cleanup succeeded. Add optional LoadOptions.sessionCacheByteBudget and a separate EngineDiagnostics.sessionCacheStatus snapshot with requested/effective budgets, resident bytes, protected-window overflow, producer parking, eviction and typed cleanup/failure results.

Nil preserves existing automatic sizing. Explicit requests reuse the quarter-of-available-space safeguard and RetentionClaims allocation after other sessions' unwritten claims. Unknown capacity keeps the conservative ceiling. Zero keeps the necessary working window rather than promising zero I/O; the software disk path keeps a bounded working spool. A protected fMP4 playback window may exceed the request, which the snapshot reports explicitly. The tvOS memory default and live DVR policy remain unchanged; live reports this VOD byte policy as unsupported.

State is sampled off-main from the segment ledger at the existing telemetry cadence. Cleanup may publish after stop, but session tokens reject callbacks from a superseded load/rebuild and an old startup callback cannot revive a stopped cache. Remote HLS is reported as AVPlayer/server managed, not successful zero-byte caching. Detailed snapshots cover fMP4 segment caching; software packets retain their existing telemetry.

Keep the existing #720 ENOSPC classification and #714 live DVR limits. A bounded stale-directory sweep retains the liveness marker, reports enumeration/deletion failures, and never reuses another session's bytes. This is not the cross-launch source cache discussed in #706. No UI settings or host-specific cache tiers are included.

This is independent of #827 (explicit packet-store selection), but both touch SoftwarePlaybackHost construction and the LoadOptions inventory. If #827 lands first, the requested-byte resolution belongs inside its disk factory; the memory branch and automatic platform choice must stay unchanged. No combined-branch or device performance acceptance is claimed.

Tests cover default equivalence, explicit/zero/unknown capacity, shared claims, actual segment writes and replacements, parking, hard-window overflow, bounded sweep, failed directory/write/adoption/cleanup, real engine load/stop cleanup and rejection of old-session updates.

Validation: 66 focused tests under the strict cooperative pool passed. Full serial host suite passed: 795 XCTest tests (1 existing skip) and 4,636 Swift Testing tests across 637 suites. Published documentation links and git diff --check passed. Existing Issue451 creation-time/liveness assertions remain unchanged, and a callback-type regression preserves the public zero-argument HLSVideoEngine.stop() API. Platform and optional-trait validation is left to CI; no new device acceptance is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant