Search in sources :

Example 11 with RingBasedUriMapper

use of com.linkedin.d2.balancer.util.hashing.RingBasedUriMapper in project rest.li by linkedin.

the class TestRestLiScatterGather method getURIMapper.

private static URIMapper getURIMapper(boolean sticky, boolean partitioned, String regex) throws ServiceUnavailableException {
    int partitionCount = partitioned ? 10 : 1;
    int totalHostCount = 100;
    HashRingProvider ringProvider = createStaticHashRingProvider(totalHostCount, partitionCount, getHashFunction(sticky));
    PartitionInfoProvider infoProvider = createHashBasedPartitionInfoProvider(partitionCount, regex);
    return new RingBasedUriMapper(ringProvider, infoProvider);
}
Also used : HashRingProvider(com.linkedin.d2.balancer.util.hashing.HashRingProvider) URIMapperTestUtil.createStaticHashRingProvider(com.linkedin.d2.balancer.util.hashing.URIMapperTestUtil.createStaticHashRingProvider) URIMapperTestUtil.createHashBasedPartitionInfoProvider(com.linkedin.d2.balancer.util.hashing.URIMapperTestUtil.createHashBasedPartitionInfoProvider) PartitionInfoProvider(com.linkedin.d2.balancer.util.partitions.PartitionInfoProvider) RingBasedUriMapper(com.linkedin.d2.balancer.util.hashing.RingBasedUriMapper)

Aggregations

PartitionInfoProvider (com.linkedin.d2.balancer.util.partitions.PartitionInfoProvider)11 URIMapper (com.linkedin.d2.balancer.URIMapper)10 Test (org.testng.annotations.Test)10 URIKeyPair (com.linkedin.d2.balancer.util.URIKeyPair)9 URI (java.net.URI)9 HashSet (java.util.HashSet)7 Set (java.util.Set)7 URIRequest (com.linkedin.d2.balancer.util.URIRequest)3 Request (com.linkedin.r2.message.Request)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 PartitionAccessException (com.linkedin.d2.balancer.util.partitions.PartitionAccessException)2 ArrayList (java.util.ArrayList)2 ServiceUnavailableException (com.linkedin.d2.balancer.ServiceUnavailableException)1 URIMappingResult (com.linkedin.d2.balancer.util.URIMappingResult)1 HashRingProvider (com.linkedin.d2.balancer.util.hashing.HashRingProvider)1 RingBasedUriMapper (com.linkedin.d2.balancer.util.hashing.RingBasedUriMapper)1 URIMapperTestUtil (com.linkedin.d2.balancer.util.hashing.URIMapperTestUtil)1 URIMapperTestUtil.createHashBasedPartitionInfoProvider (com.linkedin.d2.balancer.util.hashing.URIMapperTestUtil.createHashBasedPartitionInfoProvider)1 URIMapperTestUtil.createStaticHashRingProvider (com.linkedin.d2.balancer.util.hashing.URIMapperTestUtil.createStaticHashRingProvider)1