Examples of ClusterAccessor


Examples of org.apache.helix.api.accessor.ClusterAccessor

    }
  }

  void dropCluster(String[] optValues) {
    String clusterName = optValues[0];
    ClusterAccessor accessor = clusterAccessor(clusterName);
    accessor.dropCluster();
  }
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

  void dropResource(String[] optValues) {
    String clusterName = optValues[0];
    String resourceName = optValues[1];

    ClusterAccessor accessor = clusterAccessor(clusterName);
    accessor.dropResourceFromCluster(ResourceId.from(resourceName));
  }
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

  }

  void dropInstance(String[] optValues) {
    String clusterName = optValues[0];
    String[] instanceIds = optValues[1].split(";");
    ClusterAccessor accessor = clusterAccessor(clusterName);
    for (String instanceId : instanceIds) {
      accessor.dropParticipantFromCluster(ParticipantId.from(instanceId));
    }

  }
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

    try {
      StateModelDefinition stateModelDef =
          new StateModelDefinition(
              (ZNRecord) (new ZNRecordSerializer().deserialize(readFile(stateModelDefJsonFile))));
      ClusterAccessor accessor = clusterAccessor(clusterName);
      accessor.addStateModelDefinitionToCluster(stateModelDef);

    } catch (IOException e) {
      LOG.error("Could not parse the state model", e);
    }
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

      RebalancerContext rebalancerCtx = PartitionedRebalancerContext.from(idealState);
      ResourceConfig.Builder builder =
          new ResourceConfig.Builder(ResourceId.from(resourceName))
              .rebalancerContext(rebalancerCtx).bucketSize(idealState.getBucketSize());

      ClusterAccessor accessor = clusterAccessor(clusterName);
      accessor.addResourceToCluster(builder.build());
    } catch (IOException e) {
      e.printStackTrace();
    }

  }
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

  void enableCluster(String[] optValues) {
    String clusterName = optValues[0];
    boolean enabled = Boolean.parseBoolean(optValues[1].toLowerCase());

    ClusterAccessor accessor = clusterAccessor(clusterName);
    if (enabled) {
      accessor.resumeCluster();
    } else {
      accessor.pauseCluster();
    }
  }
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

    String clusterName = scopeArgs[0];
    Map<String, String> results = null;
    switch (scopeType) {
    case CLUSTER: {
      ClusterAccessor accessor = clusterAccessor(clusterName);
      results = keyValueMap(accessor.readUserConfig(), null, keys);
      break;
    }
    case PARTICIPANT: {
      ParticipantId participantId = ParticipantId.from(scopeArgs[1]);
      ParticipantAccessor accessor = participantAccessor(clusterName);
      results = keyValueMap(accessor.readUserConfig(participantId), null, keys);
      break;
    }
    case RESOURCE: {
      ResourceId resourceId = ResourceId.from(scopeArgs[1]);
      ResourceAccessor accessor = resourceAccessor(clusterName);
      results = keyValueMap(accessor.readUserConfig(resourceId), null, keys);
      break;
    }
    case PARTITION: {
      ResourceId resourceId = ResourceId.from(scopeArgs[1]);
      String partitionId = scopeArgs[2];
      ResourceAccessor accessor = resourceAccessor(clusterName);
      results = keyValueMap(accessor.readUserConfig(resourceId), partitionId, keys);
      break;
    }
    default:
      System.err.println("Non-recognized scopeType: " + scopeType);
      break;
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

    String clusterName = scopeArgs[0];
    Map<String, String> results = new HashMap<String, String>();
    switch (scopeType) {
    case CLUSTER: {
      ClusterAccessor accessor = clusterAccessor(clusterName);
      Scope<ClusterId> scope = Scope.cluster(ClusterId.from(clusterName));
      UserConfig userConfig = userConfig(scope, null, keyValues);
      accessor.setUserConfig(userConfig);
      break;
    }
    case PARTICIPANT: {
      ParticipantId participantId = ParticipantId.from(scopeArgs[1]);
      ParticipantAccessor accessor = participantAccessor(clusterName);
      Scope<ParticipantId> scope = Scope.participant(participantId);
      UserConfig userConfig = userConfig(scope, null, keyValues);
      accessor.setUserConfig(participantId, userConfig);
      break;
    }
    case RESOURCE: {
      ResourceId resourceId = ResourceId.from(scopeArgs[1]);
      ResourceAccessor accessor = resourceAccessor(clusterName);
      Scope<ResourceId> scope = Scope.resource(resourceId);
      UserConfig userConfig = userConfig(scope, null, keyValues);
      accessor.setUserConfig(resourceId, userConfig);
      break;
    }
    case PARTITION: {
      ResourceId resourceId = ResourceId.from(scopeArgs[1]);
      String partitionId = scopeArgs[2];
      ResourceAccessor accessor = resourceAccessor(clusterName);
      Scope<ResourceId> scope = Scope.resource(resourceId);
      UserConfig userConfig = userConfig(scope, partitionId, keyValues);
      accessor.setUserConfig(resourceId, userConfig);
      break;
    }
    default:
      System.err.println("Non-recognized scopeType: " + scopeType);
      break;
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

      System.err
          .println("fail to set constraint. missing clusterName|constraintType|constraintId|constraintAttributesMap");
      return;
    }
    ClusterId clusterId = ClusterId.from(clusterName);
    ClusterAccessor accessor = clusterAccessor(clusterName);
    Map<String, String> constraintAttributes =
        HelixUtil.parseCsvFormatedKeyValuePairs(constraintAttributesMap);
    ConstraintItem item = new ConstraintItem(constraintAttributes);
    ClusterConfig.Delta delta =
        new ClusterConfig.Delta(clusterId).addConstraintItem(
            ConstraintType.valueOf(constraintType), ConstraintId.from(constraintId), item);
    accessor.updateCluster(delta);
  }
View Full Code Here

Examples of org.apache.helix.api.accessor.ClusterAccessor

  }

  void getConstraints(String[] optValues) {
    String clusterName = optValues[0];
    ConstraintType constraintType = ConstraintType.valueOf(optValues[1]);
    ClusterAccessor accessor = clusterAccessor(clusterName);
    ClusterConstraints constraints = accessor.readConstraints(constraintType);
    System.out.println(constraints.toString());
  }
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.