Function probeOfflineStorageBudget

  • Read the origin's real storage estimate and derive a conservative logical budget, or report explicitly that the platform cannot estimate.

    Performs no network I/O, writes nothing, and never calls StorageManager.persist(). persisted() is read when the platform offers it because persisted state changes the eviction risk of every cached region; a platform that does not offer it yields persistence: "unknown" rather than an assumption.

    Derivation is deterministic integer arithmetic over the reported values:

    remaining = max(0, quota - usage)
    reserve   = min(remaining, max(minimumReserveBytes, floor(remaining * headroomRatio)))
    budget    = remaining - reserve
    

    so the budget can never exceed the platform-reported remaining quota, and a nearly full origin yields 0 instead of a number that cannot be honoured.

    Parameters

    Returns Promise<OfflineStorageBudgetV1>