gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-16 05:24:40 27 4
gpt4 key购买 nike

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

ZNRecord.setListFields介绍

[英]Set all fields whose values are a list of values
[中]设置其值为值列表的所有字段

代码示例

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

public ZNRecord toZNRecord() {
 ZNRecord record = new ZNRecord(_tableNameWithType);
 record.setListFields(_parentGroupToChildrenGroupsMap);
 Map<String, Map<String, String>> groupToSegmentsMap = new HashMap<>();
 for (Map.Entry<Integer, Map<String, List<String>>> entry : _levelToGroupToSegmentsMap.entrySet()) {
  String key = LEVEL_KEY_PREFIX + entry.getKey();
  Map<String, String> groupSegmentsForLevel = new HashMap<>();
  for (Map.Entry<String, List<String>> groupEntry : entry.getValue().entrySet()) {
   String groupId = groupEntry.getKey();
   String segments = String.join(SEGMENT_DELIMITER, groupEntry.getValue());
   groupSegmentsForLevel.put(groupId, segments);
  }
  groupToSegmentsMap.put(key, groupSegmentsForLevel);
 }
 record.setMapFields(groupToSegmentsMap);
 return record;
}

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

/**
 * Write the replica group partition assignment to property store
 *
 * @param partitionAssignment a replica group partition assignment
 */
public void writeReplicaGroupPartitionAssignment(ReplicaGroupPartitionAssignment partitionAssignment) {
 String tableNameWithType = partitionAssignment.getTableName();
 ZNRecord znRecord = new ZNRecord(tableNameWithType);
 znRecord.setListFields(partitionAssignment.getPartitionToInstances());
 String path = ZKMetadataProvider.constructPropertyStorePathForInstancePartitions(tableNameWithType);
 _propertyStore.set(path, znRecord, AccessOption.PERSISTENT);
}

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

/**
 * Set the preference lists for all partitions in this resource.
 *
 * @param instanceLists the map of instance preference lists.
 */
public void setPreferenceLists(Map<String, List<String>> instanceLists) {
 _record.setListFields(instanceLists);
}

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

/**
 * Set the preference lists for all partitions in this resource.
 *
 * @param instanceLists the map of instance preference lists.
 */
public void setPreferenceLists(Map<String, List<String>> instanceLists) {
 _record.setListFields(instanceLists);
}

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

/**
 * Set the user-specified preference lists for all partitions in this resource.
 *
 * @param instanceLists the map of instance preference lists.N
 */
public void setPreferenceLists(Map<String, List<String>> instanceLists) {
 _record.setListFields(instanceLists);
}

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

/**
 * Set the user-specified preference lists for all partitions in this resource.
 *
 * @param instanceLists the map of instance preference lists.N
 */
public void setPreferenceLists(Map<String, List<String>> instanceLists) {
 _record.setListFields(instanceLists);
}

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

private ZNRecord generateZNRecord(String resource, List<String> partitions,
  Map<String, Map<String, List<Node>>> partitionStateMapping) {
 Map<String, List<String>> newPreferences = new HashMap<String, List<String>>();
 for (int i = 0; i < partitions.size(); i++) {
  String partitionName = partitions.get(i);
  Map<String, List<Node>> stateNodeMap = partitionStateMapping.get(partitionName);
  for (String state : _stateCountMap.keySet()) {
   List<Node> nodes = stateNodeMap.get(state);
   List<String> nodeList = new ArrayList<String>();
   for (int j = 0; j < nodes.size(); j++) {
    nodeList.add(nodes.get(j).getName());
   }
   if (!newPreferences.containsKey(partitionName)) {
    newPreferences.put(partitionName, new ArrayList<String>());
   }
   newPreferences.get(partitionName).addAll(nodeList);
  }
 }
 ZNRecord result = new ZNRecord(resource);
 result.setListFields(newPreferences);
 return result;
}

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

private ZNRecord generateZNRecord(String resource, List<String> partitions,
  Map<String, Map<String, List<Node>>> partitionStateMapping, String eventId) {
 Map<String, List<String>> newPreferences = new HashMap<>();
 for (int i = 0; i < partitions.size(); i++) {
  String partitionName = partitions.get(i);
  Map<String, List<Node>> stateNodeMap = partitionStateMapping.get(partitionName);
  for (String state : _stateCountMap.keySet()) {
   List<Node> nodes = stateNodeMap.get(state);
   List<String> nodeList = new ArrayList<>();
   for (int j = 0; j < nodes.size(); j++) {
    Node selectedNode = nodes.get(j);
    if (selectedNode instanceof InstanceNode) {
     nodeList.add(((InstanceNode) selectedNode).getInstanceName());
    } else {
     LogUtil.logError(Log, eventId,
       "Selected node is not associated with an instance: " + selectedNode.toString());
    }
   }
   if (!newPreferences.containsKey(partitionName)) {
    newPreferences.put(partitionName, new ArrayList<String>());
   }
   newPreferences.get(partitionName).addAll(nodeList);
  }
 }
 ZNRecord result = new ZNRecord(resource);
 result.setListFields(newPreferences);
 return result;
}

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

result.setListFields(newPreferences);

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

result.setListFields(preferenceList);
result.setMapFields(idealStateMap);
return result;

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

result.setListFields(newPreferences);

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

newIdealState.getRecord().setSimpleFields(currentIdealState.getRecord().getSimpleFields());
newIdealState.setRebalanceMode(RebalanceMode.FULL_AUTO);
newIdealState.getRecord().setListFields(newMapping.getListFields());

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

private IdealState generateNewIdealState(String resourceName, IdealState currentIdealState,
  ZNRecord newMapping) {
 IdealState newIdealState = new IdealState(resourceName);
 newIdealState.getRecord().setSimpleFields(currentIdealState.getRecord().getSimpleFields());
 newIdealState.setRebalanceMode(currentIdealState.getRebalanceMode());
 newIdealState.getRecord().setListFields(newMapping.getListFields());
 return newIdealState;
}

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

private IdealState generateNewIdealState(String resourceName, IdealState currentIdealState,
  ZNRecord newMapping) {
 IdealState newIdealState = new IdealState(resourceName);
 newIdealState.getRecord().setSimpleFields(currentIdealState.getRecord().getSimpleFields());
 newIdealState.setRebalanceMode(currentIdealState.getRebalanceMode());
 newIdealState.getRecord().setListFields(newMapping.getListFields());
 return newIdealState;
}

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

idealState.getRecord().setListFields(newIdealState.getListFields());

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

curIdealState.setListFields(idealState.getListFields());
_gZkClient.writeData(idealPath, curIdealState);

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

targetExternalView.getRecord().setListFields(preferenceLists);
needPersist = true;

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

targetExternalView.getRecord().setListFields(preferenceLists);
needPersist = true;

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

_record.setListFields(listFields);

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

_record.setListFields(listFields);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com