tryParse static method

RigLabels? tryParse(
  1. Map<String, String> labels
)

Read rig's labels off labels, or null when rig did not make this container.

Implementation

static RigLabels? tryParse(Map<String, String> labels) {
  if (labels[rigMarkerLabel] != '1') return null;

  final hash = labels[rigHashLabel];
  if (hash == null || hash.isEmpty) return null;

  return RigLabels(
    hash: hash,
    lifetime: _parseLifetime(labels[rigLifetimeLabel]),
    project: labels[rigProjectLabel] ?? '',
    summary: labels[rigSummaryLabel] ?? '',
  );
}