Examples of ConsistentHashKeyMapper


Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

  public static void testBuildAllPartitionsRequest(RestliRequestOptions options) throws ServiceUnavailableException, URISyntaxException, RestException
  {

    final int PARTITION_NUM = 10;

    ConsistentHashKeyMapper mapper = getKeyToHostMapper(PARTITION_NUM);

    AllPartitionsRequestBuilder<CollectionResponse<Greeting>> searchRB = new AllPartitionsRequestBuilder<CollectionResponse<Greeting>>(mapper);
    FindRequestBuilder<Long, Greeting> findRB = new FindRequestBuilder<Long, Greeting>(TEST_URI,
                                                                                       Greeting.class,
                                                                                       _COLL_SPEC,
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "restliRequestOptions")
  public static void testSendAllPartitionsRequests(RestliRequestOptions options) throws ServiceUnavailableException, URISyntaxException, RestException, InterruptedException
  {
    final int PARTITION_NUM = 10;
    ConsistentHashKeyMapper mapper = getKeyToHostMapper(PARTITION_NUM);
    AllPartitionsRequestBuilder<Greeting> searchRB = new AllPartitionsRequestBuilder<Greeting>(mapper);
    ActionRequestBuilder<Long, Greeting> builder = new ActionRequestBuilder<Long, Greeting>(TEST_URI,
                                                                                            Greeting.class,
                                                                                            _COLL_SPEC,
                                                                                            options);
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

    {
      final ConsistentHashRing<URI> ring = new ConsistentHashRing<URI>(map);
      rings.add(ring);
    }

    return new ConsistentHashKeyMapper(new StaticRingProvider(rings), new TestPartitionInfoProvider());
  }
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

    _shutdownAsynchronously = shutdownAsynchronously;
    _isSymlinkAware = isSymlinkAware;

    _executor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("D2 PropertyEventExecutor"));
    _keyMapper = new ConsistentHashKeyMapper(this, this);
    _delayedExecution = 1000;
  }
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

                                         int partitionNum,
                                         RootBuilderWrapper<Long, Greeting> builders)
    throws URISyntaxException, RestException, ServiceUnavailableException
  {
    final int NUM_ENDPOINTS = endPointsNum;
    ConsistentHashKeyMapper mapper;
    if (partitionNum > 0)
    {
      mapper = getKeyToHostMapper(endPointsNum, partitionNum);
    }
    else
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

                                         int partitionNum,
                                         RootBuilderWrapper<Long, Greeting> builders)
      throws URISyntaxException, RestException, ServiceUnavailableException
  {
    final int NUM_ENDPOINTS = endPointsNum;
    ConsistentHashKeyMapper mapper;
    if (partitionNum > 0)
    {
      mapper = getKeyToHostMapper(endPointsNum, partitionNum);
    }
    else
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

                                               int partitionNum,
                                               RootBuilderWrapper<Long, Greeting> builders)
    throws URISyntaxException, RestException, ServiceUnavailableException
  {
    final int NUM_ENDPOINTS = endPointsNum;
    ConsistentHashKeyMapper mapper;
    if (partitionNum > 0)
    {
      mapper = getKeyToHostMapper(endPointsNum, partitionNum);
    }
    else
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

  @Test(dataProvider = "requestBuilderDataProvider")
  public static void testSendSGRequests(RootBuilderWrapper<Long, Greeting> builders)
    throws URISyntaxException, InterruptedException, RemoteInvocationException
  {
    final int NUM_ENDPOINTS = 4;
    ConsistentHashKeyMapper mapper = getKeyToHostMapper(NUM_ENDPOINTS);
    ScatterGatherBuilder<Greeting> sg = new ScatterGatherBuilder<Greeting>(mapper);

    final int NUM_IDS = 20;

    List<Greeting> entities = generateCreate(NUM_IDS);
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

  @Test(dataProvider = "requestBuilderDataProvider")
  public static void testScatterGatherLoadBalancerIntegration(RootBuilderWrapper<Long, Greeting> builders) throws Exception
  {
    SimpleLoadBalancer loadBalancer = MockLBFactory.createLoadBalancer();

    KeyMapper keyMapper = new ConsistentHashKeyMapper(loadBalancer, new TestPartitionInfoProvider());

    try
    {
      @SuppressWarnings("deprecation")
      Map<URI, Set<String>> result = keyMapper.mapKeys(URI.create("http://badurischeme/"), new HashSet<String>());
      Assert.fail("keyMapper should reject non-D2 URI scheme");
    }
    catch (IllegalArgumentException e)
    {
      //expected
View Full Code Here

Examples of com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper

  @Test(dataProvider = "requestBuilderDataProvider")
  public static void testScatterGatherKVLoadBalancerIntegration(RootBuilderWrapper<Long, Greeting> builders) throws Exception
  {
    SimpleLoadBalancer loadBalancer = MockLBFactory.createLoadBalancer();

    KeyMapper keyMapper = new ConsistentHashKeyMapper(loadBalancer, new TestPartitionInfoProvider());

    try
    {
      @SuppressWarnings("deprecation")
      Map<URI, Set<String>> result = keyMapper.mapKeys(URI.create("http://badurischeme/"), new HashSet<String>());
      Assert.fail("keyMapper should reject non-D2 URI scheme");
    }
    catch (IllegalArgumentException e)
    {
      //expected
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.