Ledger class

What this system put on this machine.

Written by the node after every apply, and the reason a blueprint can be edited rather than only added to. Delete a resource from a blueprint and the document no longer mentions it — so the document cannot ask for its removal. The ledger can: it is the record of what was declared last time, and the difference between it and the blueprint is what has to be undone.

Without it, removing a line from a blueprint would leave that software running on every server it was ever applied to, forever.

Annotations
  • @immutable

Constructors

Ledger({required BlueprintId blueprint, required String hash, required DateTime appliedAt, Map<ResourceId, LedgerEntry> entries = const {}})
Creates a ledger.
const
Ledger.empty(BlueprintId blueprint, DateTime at)
An empty ledger for a node that has never applied blueprint.
factory

Properties

appliedAt DateTime
When it was applied.
final
blueprint BlueprintId
Which blueprint this records.
final
entries Map<ResourceId, LedgerEntry>
What is managed, keyed by resource.
final
hash String
The resolved hash that was applied.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orphansOf(ResolvedBlueprint resolved) List<LedgerEntry>
The resources this ledger holds that resolved no longer declares.
recording(ResolvedBlueprint resolved, DateTime at, {required Set<ResourceId> adopted, Map<ResourceId, ResourceState> states = const {}, Set<ResourceId> retain = const {}}) Ledger
A ledger recording resolved as applied, carrying forward what is known about each resource.
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) Ledger
Decodes from JSON.