tryParse static method

CompactionEngine? tryParse(
  1. Object? value, {
  2. required String label,
})

Parses a compaction.engine value; null when value is absent.

Anything else is a strict ConfigException — a typo must surface at boot, not silently fall back to classic.

Implementation

static CompactionEngine? tryParse(Object? value, {required String label}) {
  if (value == null) return null;
  if (value is! String) {
    throw ConfigException(
      '$label: compaction.engine must be a string, got: $value',
    );
  }
  if (value == 'classic') return CompactionEngine.classic;
  if (value == 'structured') return CompactionEngine.structured;
  throw ConfigException(
    '$label: compaction.engine must be classic or structured, '
    "got: '$value'",
  );
}