freshnessBand

fun freshnessBand(now: Instant, lastSyncedAt: Instant?, ttl: Duration, lastError: Throwable? = null): FreshnessBand(source)

Pure staleness computation. First match wins:

  1. lastError != null → FreshnessBand.VeryStale

  2. lastSyncedAt == null → FreshnessBand.Initial

  3. age <= ttl → FreshnessBand.Fresh

  4. age <= 3·ttl → FreshnessBand.Stale

  5. else → FreshnessBand.VeryStale