Package org.apache.helix.api

Examples of org.apache.helix.api.Resource


   * @param participantGroupTag the new participant group tag (or null to use the existing one)
   * @return true if assignment successful, false otherwise
   */
  public boolean generateDefaultAssignment(ResourceId resourceId, int replicaCount,
      String participantGroupTag) {
    Resource resource = readResource(resourceId);
    RebalancerConfig config = resource.getRebalancerConfig();
    PartitionedRebalancerContext context =
        config.getRebalancerContext(PartitionedRebalancerContext.class);
    if (context == null) {
      LOG.error("Only partitioned resource types are supported");
      return false;
View Full Code Here


      rebalancerContext = rebalancerConfig.getRebalancerContext(RebalancerContext.class);
    }
    if (rebalancerContext == null) {
      rebalancerContext = new PartitionedRebalancerContext();
    }
    return new Resource(resourceId, type, idealState, resourceAssignment, externalView,
        rebalancerContext, userConfig, bucketSize, batchMessageMode);
  }
View Full Code Here

          stateModelDefMap.get(resource.getRebalancerConfig()
              .getRebalancerContext(RebalancerContext.class).getStateModelDefId());

      // TODO have a logical model for transition
      Map<String, Integer> stateTransitionPriorities = getStateTransitionPriorityMap(stateModelDef);
      Resource configResource = cluster.getResource(resourceId);

      // if configResource == null, the resource has been dropped
      Map<State, Bounds> stateConstraints =
          computeStateConstraints(stateModelDef,
              configResource == null ? null : configResource.getRebalancerConfig(), cluster);

      // TODO fix it
      for (PartitionId partitionId : bestPossibleStateOutput.getResourceAssignment(resourceId)
          .getMappedPartitionIds()) {
        List<Message> messages = messageGenOutput.getMessages(resourceId, partitionId);
View Full Code Here

        resCfgMap.put(resourceId, csResCfgMap.get(resourceId));
      }
    }

    for (ResourceId resourceId : cluster.getResourceMap().keySet()) {
      Resource resource = cluster.getResource(resourceId);
      RebalancerConfig rebalancerCfg = resource.getRebalancerConfig();

      ResourceConfig.Builder resCfgBuilder = new ResourceConfig.Builder(resourceId);
      resCfgBuilder.bucketSize(resource.getBucketSize());
      resCfgBuilder.batchMessageMode(resource.getBatchMessageMode());
      resCfgBuilder.schedulerTaskConfig(resource.getSchedulerTaskConfig());
      resCfgBuilder.rebalancerContext(rebalancerCfg.getRebalancerContext(RebalancerContext.class));
      resCfgMap.put(resourceId, resCfgBuilder.build());
    }

    event.addAttribute(AttributeName.RESOURCES.toString(), resCfgMap);
View Full Code Here

TOP

Related Classes of org.apache.helix.api.Resource

Copyright © 2018 www.massapicom. 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.