ResourceState class
What a provider found when it looked at one resource on a node.
The status vocabulary is FormulaStatus, reused rather than reinvented: its
values — unknown, absent, installed, running, stopped, failed —
were already the general ones, and a second enum saying the same words would
only have to be mapped onto the first. (If a later provider needs a word this
set lacks, the honest move is to rename the enum, not to fork it.)
The FormulaStatus.unknown rule carries over intact and matters more here
than it did for a single formula: a probe that could not run has said
nothing about whether the resource is there. Reporting absent on that basis
invites a create, and creating over something that already works is how a
failed probe becomes an outage.
- Annotations
-
- @immutable
Constructors
- ResourceState({required ResourceId id, required FormulaStatus status, required DateTime checkedAt, String? version, String message = '', String? fingerprint})
-
Creates a resource state.
const
- ResourceState.unknown(ResourceId id, DateTime at, {String message = ''})
-
A resource whose probe could not run.
factory
Properties
- checkedAt → DateTime
-
When the node looked.
final
- fingerprint → String?
-
A digest of the resource's contents, for types where "the same" is more
than "present" — a file's bytes, a cron line. Null when presence is the
whole story.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → ResourceId
-
Which resource this is about.
final
- isPresent → bool
-
Whether the resource is on the node at all.
no setter
- message → String
-
A short note — what the probe saw, or why it could not look.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → FormulaStatus
-
What the provider found.
final
- version → String?
-
The version detected, when the resource could say.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
satisfies(
Ensure ensure) → bool -
Whether this reading already satisfies
ensure. -
toJson(
) → Map< String, dynamic> - JSON form.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromJson(
Map< String, dynamic> json) → ResourceState - Decodes from JSON.