snapshot method

CockpitRebuildSnapshot snapshot({
  1. int maxEntries = 8,
})

Implementation

CockpitRebuildSnapshot snapshot({int maxEntries = 8}) {
  final sortedEntries = _entries.values.toList(growable: false)
    ..sort((left, right) {
      final rebuildCompare = right.rebuildCount.compareTo(left.rebuildCount);
      if (rebuildCompare != 0) {
        return rebuildCompare;
      }
      return left.signature.compareTo(right.signature);
    });
  final boundedEntries = sortedEntries
      .take(maxEntries)
      .map((entry) => entry.freeze())
      .toList(growable: false);
  return CockpitRebuildSnapshot(
    totalRebuildCount: _totalRebuildCount,
    uniqueElementCount: _entries.length,
    capturedEntryCount: boundedEntries.length,
    truncated: sortedEntries.length > boundedEntries.length,
    entries: boundedEntries,
  );
}