HealthInfo
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace Polly.CircuitBreaker.Health
{
internal readonly struct HealthInfo : IEquatable<HealthInfo>
{
public int Throughput { get; set; }
public double FailureRate { get; set; }
public int FailureCount { get; set; }
public HealthInfo(int Throughput, double FailureRate, int FailureCount)
{
Throughput = Throughput;
FailureRate = FailureRate;
FailureCount = FailureCount;
}
public static HealthInfo Create(int successes, int failures)
{
int num = successes + failures;
if (num == 0)
return new HealthInfo(0, 0, failures);
return new HealthInfo(num, (double)failures / (double)num, failures);
}
[CompilerGenerated]
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("HealthInfo");
stringBuilder.Append(" { ");
if (PrintMembers(stringBuilder))
stringBuilder.Append(' ');
stringBuilder.Append('}');
return stringBuilder.ToString();
}
[CompilerGenerated]
private bool PrintMembers(StringBuilder builder)
{
builder.Append("Throughput = ");
int num = Throughput;
builder.Append(num.ToString());
builder.Append(", FailureRate = ");
builder.Append(FailureRate.ToString());
builder.Append(", FailureCount = ");
num = FailureCount;
builder.Append(num.ToString());
return true;
}
public static bool operator !=(HealthInfo left, HealthInfo right)
{
return !(left == right);
}
public static bool operator ==(HealthInfo left, HealthInfo right)
{
return left.Equals(right);
}
[CompilerGenerated]
public override int GetHashCode()
{
return (EqualityComparer<int>.Default.GetHashCode(Throughput) * -1521134295 + EqualityComparer<double>.Default.GetHashCode(FailureRate)) * -1521134295 + EqualityComparer<int>.Default.GetHashCode(FailureCount);
}
[CompilerGenerated]
public override bool Equals(object obj)
{
if (obj is HealthInfo)
return Equals((HealthInfo)obj);
return false;
}
[CompilerGenerated]
public bool Equals(HealthInfo other)
{
if (EqualityComparer<int>.Default.Equals(Throughput, other.Throughput) && EqualityComparer<double>.Default.Equals(FailureRate, other.FailureRate))
return EqualityComparer<int>.Default.Equals(FailureCount, other.FailureCount);
return false;
}
[CompilerGenerated]
public void Deconstruct(out int Throughput, out double FailureRate, out int FailureCount)
{
Throughput = this.Throughput;
FailureRate = this.FailureRate;
FailureCount = this.FailureCount;
}
}
}