layer-wizard/lib/history/layer_node.dart
Philip Peterson b935ab01b2 Track our own layer history in a local SQLite DB
rpm-ostree/ostree only retain a couple of deployments, so there's no
durable record of what's been layered since the stock image. Add a
local history DB (lib/history/) keyed on the ostree deployment
checksum, with a parent pointer forming a tree, plus named "current"
and "last_known_safe" pointers.

Reconciling against live `rpm-ostree status --json` on every launch
means the history stays correct even across manual rpm-ostree/bootc
changes made outside this app: any booted checksum we don't recognize
gets recorded as a "detected" node rather than silently ignored.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-06 10:30:59 -08:00

35 lines
1.1 KiB
Dart

/// One row in the `nodes` table: a single ostree deployment checksum we know
/// about, and what we believe produced it. `checksum` is the same string
/// `rpm-ostree status --json` / `ostree log` use, so a row can always be
/// cross-referenced against the live system rather than trusted blindly.
class LayerNode {
final int id;
final String checksum;
final String? baseChecksum;
final int? parentId;
final String action; // 'install' | 'uninstall' | 'rollback' | 'detected'
final String? packageName;
final String? version;
final String? containerImageRef;
final List<String> requestedPackages;
final String source; // 'layer_wizard' | 'detected'
final DateTime createdAt;
final DateTime? appliedAt;
final String? notes;
LayerNode({
required this.id,
required this.checksum,
this.baseChecksum,
this.parentId,
required this.action,
this.packageName,
this.version,
this.containerImageRef,
this.requestedPackages = const [],
required this.source,
required this.createdAt,
this.appliedAt,
this.notes,
});
}