Add 'Name' property to ILoadBalancer, for future use in LoadBalancerFactory.

This commit is contained in:
David Lievrouw 2019-07-10 18:10:26 +02:00
parent 347ea7280c
commit 789782c870
6 changed files with 14 additions and 0 deletions

View File

@ -84,5 +84,7 @@ namespace Ocelot.LoadBalancer.LoadBalancers
public void Release(ServiceHostAndPort hostAndPort) public void Release(ServiceHostAndPort hostAndPort)
{ {
} }
public string Name => GetType().Name;
} }
} }

View File

@ -10,5 +10,7 @@ namespace Ocelot.LoadBalancer.LoadBalancers
Task<Response<ServiceHostAndPort>> Lease(DownstreamContext context); Task<Response<ServiceHostAndPort>> Lease(DownstreamContext context);
void Release(ServiceHostAndPort hostAndPort); void Release(ServiceHostAndPort hostAndPort);
string Name { get; }
} }
} }

View File

@ -71,6 +71,8 @@ namespace Ocelot.LoadBalancer.LoadBalancers
} }
} }
public string Name => GetType().Name;
private Lease AddConnection(Lease lease) private Lease AddConnection(Lease lease)
{ {
return new Lease(lease.HostAndPort, lease.Connections + 1); return new Lease(lease.HostAndPort, lease.Connections + 1);

View File

@ -33,5 +33,7 @@ namespace Ocelot.LoadBalancer.LoadBalancers
public void Release(ServiceHostAndPort hostAndPort) public void Release(ServiceHostAndPort hostAndPort)
{ {
} }
public string Name => GetType().Name;
} }
} }

View File

@ -38,5 +38,7 @@ namespace Ocelot.LoadBalancer.LoadBalancers
public void Release(ServiceHostAndPort hostAndPort) public void Release(ServiceHostAndPort hostAndPort)
{ {
} }
public string Name => GetType().Name;
} }
} }

View File

@ -164,6 +164,8 @@ namespace Ocelot.UnitTests.LoadBalancer
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public string Name => GetType().Name;
} }
private class FakeRoundRobinLoadBalancer : ILoadBalancer private class FakeRoundRobinLoadBalancer : ILoadBalancer
@ -177,6 +179,8 @@ namespace Ocelot.UnitTests.LoadBalancer
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public string Name => GetType().Name;
} }
} }
} }