org.apache.helix.ZNRecord.setListField()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中org.apache.helix.ZNRecord.setListField()方法的一些代码示例,展示了ZNRecord.setListField()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZNRecord.setListField()方法的具体详情如下:
包路径:org.apache.helix.ZNRecord
类名称:ZNRecord
方法名:setListField

ZNRecord.setListField介绍

[英]Set a single String --> List field
[中]设置单个字符串-->列表字段

代码示例

代码示例来源:origin: apache/incubator-pinot

statePriorityList.add(OFFLINE_STATE);
statePriorityList.add(DROPPED_STATE);
record.setListField(StateModelDefinitionProperty.STATE_PRIORITY_LIST.toString(), statePriorityList);
stateTransitionPriorityList.add("OFFLINE-DROPPED");
record.setListField(StateModelDefinitionProperty.STATE_TRANSITION_PRIORITYLIST.toString(),
  stateTransitionPriorityList);

代码示例来源:origin: apache/incubator-pinot

statePriorityList.add(OFFLINE_STATE);
statePriorityList.add(DROPPED_STATE);
record.setListField(StateModelDefinitionProperty.STATE_PRIORITY_LIST.toString(), statePriorityList);
stateTransitionPriorityList.add("OFFLINE-DROPPED");
record.setListField(StateModelDefinitionProperty.STATE_TRANSITION_PRIORITYLIST.toString(),
  stateTransitionPriorityList);

代码示例来源:origin: uber/chaperone

statePriorityList.add("OFFLINE");
statePriorityList.add("DROPPED");
record.setListField(StateModelDefinitionProperty.STATE_PRIORITY_LIST.toString(),
  statePriorityList);
for (String state : statePriorityList) {
stateTransitionPriorityList.add("OFFLINE-DROPPED");
record.setListField(StateModelDefinitionProperty.STATE_TRANSITION_PRIORITYLIST.toString(),
  stateTransitionPriorityList);
return record;

代码示例来源:origin: org.apache.helix/helix-core

/**
 * Set the preference list of a partition
 *
 * @param partitionName the name of the partition
 * @param instanceList the instance preference list
 */
public void setPreferenceList(String partitionName, List<String> instanceList) {
 _record.setListField(partitionName, instanceList);
}

代码示例来源:origin: apache/helix

/**
 * Set the preference list of a partition
 *
 * @param partitionName the name of the partition
 * @param instanceList the instance preference list
 */
public void setPreferenceList(String partitionName, List<String> instanceList) {
 _record.setListField(partitionName, instanceList);
}

代码示例来源:origin: org.apache.helix/helix-core

public void add(String partitionName) {
 if (_record.getListField(partitionName) == null) {
  _record.setListField(partitionName, new ArrayList<String>());
 }
}

代码示例来源:origin: apache/helix

public SemiAutoModeISBuilder add(String partitionName) {
 if (_record.getListField(partitionName) == null) {
  _record.setListField(partitionName, new ArrayList<String>());
 }
 return this;
}

代码示例来源:origin: apache/helix

/**
  * Add a partition, Helix will automatically assign the placement and state
  * for this partition at runtime.
  * @param partitionName
  */
 public AutoRebalanceModeISBuilder add(String partitionName) {
  if (_record.getListField(partitionName) == null) {
   _record.setListField(partitionName, new ArrayList<String>());
  }

  return this;
 }
}

代码示例来源:origin: org.apache.helix/helix-core

/**
  * Add a partition, Helix will automatically assign the placement and state
  * for this partition at runtime.
  * @param partitionName
  */
 public FullAutoModeISBuilder add(String partitionName) {
  if (_record.getListField(partitionName) == null) {
   _record.setListField(partitionName, new ArrayList<String>());
  }

  return this;
 }
}

代码示例来源:origin: org.apache.helix/helix-core

/**
  * Add a partition, Helix will automatically assign the placement and state
  * for this partition at runtime.
  * @param partitionName
  */
 public AutoRebalanceModeISBuilder add(String partitionName) {
  if (_record.getListField(partitionName) == null) {
   _record.setListField(partitionName, new ArrayList<String>());
  }

  return this;
 }
}

代码示例来源:origin: apache/helix

public void add(String partitionName) {
 if (_record.getListField(partitionName) == null) {
  _record.setListField(partitionName, new ArrayList<String>());
 }
}

代码示例来源:origin: org.apache.helix/helix-core

public SemiAutoModeISBuilder add(String partitionName) {
 if (_record.getListField(partitionName) == null) {
  _record.setListField(partitionName, new ArrayList<String>());
 }
 return this;
}

代码示例来源:origin: apache/helix

/**
  * Add a partition, Helix will automatically assign the placement and state
  * for this partition at runtime.
  * @param partitionName
  */
 public FullAutoModeISBuilder add(String partitionName) {
  if (_record.getListField(partitionName) == null) {
   _record.setListField(partitionName, new ArrayList<String>());
  }

  return this;
 }
}

代码示例来源:origin: org.apache.helix/helix-core

private ZNRecord emptyMapping(IdealState idealState) {
 ZNRecord emptyMapping = new ZNRecord(idealState.getResourceName());
 for (String partition : idealState.getPartitionSet()) {
  emptyMapping.setListField(partition, new ArrayList<String>());
 }
 return emptyMapping;
}

代码示例来源:origin: apache/helix

private ZNRecord emptyMapping(IdealState idealState) {
 ZNRecord emptyMapping = new ZNRecord(idealState.getResourceName());
 for (String partition : idealState.getPartitionSet()) {
  emptyMapping.setListField(partition, new ArrayList<String>());
 }
 return emptyMapping;
}

代码示例来源:origin: org.apache.helix/helix-core

public void setLastScheduledSingleWorkflow(String workflow) {
 _record.setSimpleField(WorkflowContextProperties.LAST_SCHEDULED_WORKFLOW.name(), workflow);
 // Record scheduled workflow into the history list as well
 List<String> workflows = getScheduledWorkflows();
 if (workflows == null) {
  workflows = new ArrayList<String>();
  _record.setListField(WorkflowContextProperties.SCHEDULED_WORKFLOWS.name(), workflows);
 }
 workflows.add(workflow);
}

代码示例来源:origin: apache/helix

public void setLastScheduledSingleWorkflow(String workflow) {
 _record.setSimpleField(WorkflowContextProperties.LAST_SCHEDULED_WORKFLOW.name(), workflow);
 // Record scheduled workflow into the history list as well
 List<String> workflows = getScheduledWorkflows();
 if (workflows == null) {
  workflows = new ArrayList<String>();
  _record.setListField(WorkflowContextProperties.SCHEDULED_WORKFLOWS.name(), workflows);
 }
 workflows.add(workflow);
}

代码示例来源:origin: org.apache.helix/helix-core

private IdealState buildWorkflowIdealState(String workflow) {
 CustomModeISBuilder IsBuilder = new CustomModeISBuilder(workflow);
 IsBuilder.setRebalancerMode(IdealState.RebalanceMode.TASK).setNumReplica(1)
   .setNumPartitions(1).setStateModel(TaskConstants.STATE_MODEL_NAME).disableExternalView();
 IdealState is = IsBuilder.build();
 is.getRecord().setListField(workflow, new ArrayList<String>());
 is.getRecord().setMapField(workflow, new HashMap<String, String>());
 is.setRebalancerClassName(WorkflowRebalancer.class.getName());
 return is;
}

代码示例来源:origin: apache/helix

private IdealState buildWorkflowIdealState(String workflow) {
 CustomModeISBuilder IsBuilder = new CustomModeISBuilder(workflow);
 IsBuilder.setRebalancerMode(IdealState.RebalanceMode.TASK).setNumReplica(1)
   .setNumPartitions(1).setStateModel(TaskConstants.STATE_MODEL_NAME).disableExternalView();
 IdealState is = IsBuilder.build();
 is.getRecord().setListField(workflow, new ArrayList<String>());
 is.getRecord().setMapField(workflow, new HashMap<String, String>());
 is.setRebalancerClassName(WorkflowRebalancer.class.getName());
 return is;
}

代码示例来源:origin: apache/helix

private void createIS(HelixDataAccessor accessor, String resourceId, String stateModelDefRef,
  RebalanceMode rebalanceMode) {
 IdealState idealState = new IdealState(resourceId);
 idealState.setRebalanceMode(rebalanceMode);
 idealState.setStateModelDefRef(stateModelDefRef);
 idealState.setNumPartitions(1);
 idealState.setReplicas("1");
 idealState.getRecord().setListField(resourceId + "_0", ImmutableList.of(PARTICIPANT));
 idealState.getRecord().setMapField(resourceId + "_0", ImmutableMap.of(PARTICIPANT, STATE));
 accessor.setProperty(accessor.keyBuilder().idealStates(resourceId), idealState);
}

相关文章