Package org.apache.helix.api

Examples of org.apache.helix.api.Partition


  private static ResourceConfig getResource(StateModelDefinition stateModelDef) {
    // identify the resource
    ResourceId resourceId = ResourceId.from("exampleResource");

    // create a partition
    Partition partition1 = new Partition(PartitionId.from(resourceId, "1"));

    // create a second partition
    Partition partition2 = new Partition(PartitionId.from(resourceId, "2"));

    // specify the rebalancer configuration
    // this resource will be rebalanced in FULL_AUTO mode, so use the FullAutoRebalancerContext
    // builder
    FullAutoRebalancerContext.Builder rebalanceContextBuilder =
View Full Code Here


    if (idealState.getNumPartitions() > 0 && idealState.getPartitionIdSet().size() == 0) {
      // backwards compatibility: partition sets were based on pref lists/maps previously
      builder.addPartitions(idealState.getNumPartitions());
    } else {
      for (PartitionId partitionId : idealState.getPartitionIdSet()) {
        builder.addPartition(new Partition(partitionId));
      }
    }
    builder.anyLiveParticipant(anyLiveParticipant).replicaCount(replicaCount)
        .maxPartitionsPerParticipant(idealState.getMaxPartitionsPerInstance())
        .participantGroupTag(idealState.getInstanceGroupTag())
View Full Code Here

     * @param partitionCount number of partitions to add
     * @return Builder
     */
    public T addPartitions(int partitionCount) {
      for (int i = 0; i < partitionCount; i++) {
        addPartition(new Partition(PartitionId.from(_resourceId, Integer.toString(i))));
      }
      return self();
    }
View Full Code Here

    context.setAnyLiveParticipant(false);
    context.setMaxPartitionsPerParticipant(Integer.MAX_VALUE);
    Map<PartitionId, Partition> partitionMap = Maps.newHashMap();
    ResourceId resourceId = ResourceId.from("testResource");
    PartitionId partitionId = PartitionId.from(resourceId, "0");
    partitionMap.put(partitionId, new Partition(partitionId));
    context.setPartitionMap(partitionMap);
    Map<PartitionId, Map<ParticipantId, State>> preferenceMaps = Maps.newHashMap();
    ParticipantId participant1 = ParticipantId.from("participant1");
    ParticipantId participant2 = ParticipantId.from("participant2");
    Map<ParticipantId, State> preferenceMap =
View Full Code Here

          continue;
        }

        if (!message.getBatchMessageMode()) {
          PartitionId partitionId = message.getPartitionId();
          Partition partition = resource.getSubUnit(partitionId);
          if (partition != null) {
            currentStateOutput.setPendingState(resourceId, partitionId, participantId,
                message.getTypedToState());
          } else {
            // log
          }
        } else {
          List<PartitionId> partitionNames = message.getPartitionIds();
          if (!partitionNames.isEmpty()) {
            for (PartitionId partitionId : partitionNames) {
              Partition partition = resource.getSubUnit(partitionId);
              if (partition != null) {
                currentStateOutput.setPendingState(resourceId, partitionId, participantId,
                    message.getTypedToState());
              } else {
                // log
View Full Code Here

          resCfgBuilderMap.put(resourceId, resCfgBuilder);
        }

        PartitionedRebalancerContext.Builder rebCtxBuilder = rebCtxBuilderMap.get(resourceId);
        for (PartitionId partitionId : currentState.getTypedPartitionStateMap().keySet()) {
          rebCtxBuilder.addPartition(new Partition(partitionId));
        }
      }
    }

    Map<ResourceId, ResourceConfig> resCfgMap = new HashMap<ResourceId, ResourceConfig>();
View Full Code Here

TOP

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

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.