BudgetSnapshot

class BudgetSnapshot(val version: Int, val takenAtEpochMillis: Long, windows: List<WindowSnapshot>, val pausedUntilEpochMillis: Long)(source)

What a BudgetStore keeps between runs: the counts of the budget's hard windows, the instant they were taken and the pause in force. A plain value with a public constructor and no serializer: a store chooses its own encoding.

Stable Core. Equality is on every property; toString() prints the version, the stamp, the number of windows and the pause, never an encoding.

Parameters

version

the layout; CURRENT_VERSION today. The budget ignores (and counts as dropped) the windows of a version it does not know. At least 1.

takenAtEpochMillis

the wall clock when the snapshot was taken.

windows

the counts, one WindowSnapshot per window start; several starts of one window are allowed.

pausedUntilEpochMillis

the epoch millisecond the pause ends, or 0 for none. Not negative.

Throws

Constructors

Link copied to clipboard
constructor(version: Int, takenAtEpochMillis: Long, windows: List<WindowSnapshot>, pausedUntilEpochMillis: Long)
constructor(takenAtEpochMillis: Long, windows: List<WindowSnapshot>, pausedUntilEpochMillis: Long)

The snapshot of CURRENT_VERSION.

Types

Link copied to clipboard
object Companion

The layout version and the empty snapshot.

Properties

Link copied to clipboard

The epoch millisecond the pause ends, or 0 for none. Not negative.

Link copied to clipboard

The wall clock when the snapshot was taken, in epoch milliseconds.

Link copied to clipboard

The layout; CURRENT_VERSION today. At least 1.

Link copied to clipboard

The counts, a read-only copy.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Two BudgetSnapshots are equal when their version, takenAtEpochMillis, windows and pausedUntilEpochMillis are equal.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code consistent with equals: it is computed from the same properties.

Link copied to clipboard
open override fun toString(): String

A diagnostic string for logs: version, takenAtEpochMillis, the number of windows and pausedUntilEpochMillis. Its format is not part of the API and may change.