copyWith method

ResilienceConfig copyWith({
  1. CheckStrategy? strategy,
  2. int? circuitBreakerThreshold,
  3. BigInt? circuitBreakerCooldownMs,
  4. int? numJitterSamples,
  5. double? jitterThresholdPercent,
  6. int? stabilityThershold,
  7. double? criticalPacketLossPrecent,
})

Creates a copy with modified resilience parameters.

  • strategy: How multiple targets are evaluated (Consensus vs Race).
  • circuitBreakerThreshold: Failures before opening the circuit.
  • circuitBreakerCooldownMs: Wait time before retry probes.
  • numJitterSamples: Number of probes to use for jitter analysis.
  • jitterThresholdPercent: Variance threshold for marking as 'Unstable'.
  • stabilityThershold: Minimum stability score (0-100) required.
  • criticalPacketLossPrecent: Loss % that triggers an 'Offline' or 'Unstable' status.

Implementation

ResilienceConfig copyWith({
  CheckStrategy? strategy,
  int? circuitBreakerThreshold,
  BigInt? circuitBreakerCooldownMs,
  int? numJitterSamples,
  double? jitterThresholdPercent,
  int? stabilityThershold,
  double? criticalPacketLossPrecent,
}) {
  return ResilienceConfig(
    strategy: strategy ?? this.strategy,
    circuitBreakerThreshold:
        circuitBreakerThreshold ?? this.circuitBreakerThreshold,
    circuitBreakerCooldownMs:
        circuitBreakerCooldownMs ?? this.circuitBreakerCooldownMs,
    numJitterSamples: numJitterSamples ?? this.numJitterSamples,
    jitterThresholdPercent:
        jitterThresholdPercent ?? this.jitterThresholdPercent,
    stabilityThershold: stabilityThershold ?? this.stabilityThershold,
    criticalPacketLossPrecent:
        criticalPacketLossPrecent ?? this.criticalPacketLossPrecent,
  );
}