本文整理了Java中org.apache.helix.ZNRecord.getSimpleFields()
方法的一些代码示例,展示了ZNRecord.getSimpleFields()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZNRecord.getSimpleFields()
方法的具体详情如下:
包路径:org.apache.helix.ZNRecord
类名称:ZNRecord
方法名:getSimpleFields
[英]Get all plain key, value fields
[中]获取所有普通键、值字段
代码示例来源:origin: apache/incubator-pinot
public static boolean getClusterTenantIsolationEnabled(ZkHelixPropertyStore<ZNRecord> propertyStore) {
String controllerConfigPath = constructPropertyStorePathForControllerConfig(CLUSTER_TENANT_ISOLATION_ENABLED_KEY);
if (propertyStore.exists(controllerConfigPath, AccessOption.PERSISTENT)) {
ZNRecord znRecord = propertyStore.get(controllerConfigPath, null, AccessOption.PERSISTENT);
if (znRecord.getSimpleFields().keySet().contains(CLUSTER_TENANT_ISOLATION_ENABLED_KEY)) {
return znRecord.getBooleanField(CLUSTER_TENANT_ISOLATION_ENABLED_KEY, true);
} else {
return true;
}
} else {
return true;
}
}
}
代码示例来源:origin: apache/incubator-pinot
@Nonnull
public static TableConfig fromZnRecord(@Nonnull ZNRecord znRecord)
throws IOException {
Map<String, String> simpleFields = znRecord.getSimpleFields();
TableType tableType = TableType.valueOf(simpleFields.get(TABLE_TYPE_KEY).toUpperCase());
String tableName = TableNameBuilder.forType(tableType).tableNameWithType(simpleFields.get(TABLE_NAME_KEY));
代码示例来源:origin: apache/incubator-pinot
Map<String, String> simpleFieldMap1 = record1.getSimpleFields();
Map<String, String> simpleFieldMap2 = record2.getSimpleFields();
if (simpleFieldMap1.size() != simpleFieldMap2.size()) {
return false;
代码示例来源:origin: apache/incubator-pinot
public SegmentZKMetadata(ZNRecord znRecord) {
_segmentName = znRecord.getSimpleField(CommonConstants.Segment.SEGMENT_NAME);
_tableName = znRecord.getSimpleField(CommonConstants.Segment.TABLE_NAME);
_crypterName = znRecord.getSimpleField(CommonConstants.Segment.CRYPTER_NAME);
_segmentType = znRecord.getEnumField(CommonConstants.Segment.SEGMENT_TYPE, SegmentType.class, SegmentType.OFFLINE);
_startTime = znRecord.getLongField(CommonConstants.Segment.START_TIME, -1);
_endTime = znRecord.getLongField(CommonConstants.Segment.END_TIME, -1);
if (znRecord.getSimpleFields().containsKey(CommonConstants.Segment.TIME_UNIT) && !znRecord
.getSimpleField(CommonConstants.Segment.TIME_UNIT).equals(NULL)) {
setTimeUnit(znRecord.getEnumField(CommonConstants.Segment.TIME_UNIT, TimeUnit.class, TimeUnit.DAYS));
}
_indexVersion = znRecord.getSimpleField(CommonConstants.Segment.INDEX_VERSION);
_totalRawDocs = znRecord.getLongField(CommonConstants.Segment.TOTAL_DOCS, -1);
_crc = znRecord.getLongField(CommonConstants.Segment.CRC, -1);
_creationTime = znRecord.getLongField(CommonConstants.Segment.CREATION_TIME, -1);
try {
String partitionMetadataJson = znRecord.getSimpleField(CommonConstants.Segment.PARTITION_METADATA);
if (partitionMetadataJson != null) {
_partitionMetadata = SegmentPartitionMetadata.fromJsonString(partitionMetadataJson);
}
} catch (IOException e) {
LOGGER.error(
"Exception caught while reading partition info from zk metadata for segment '{}', partition info dropped.",
_segmentName, e);
}
_segmentUploadStartTime = znRecord.getLongField(CommonConstants.Segment.SEGMENT_UPLOAD_START_TIME, -1);
_customMap = znRecord.getMapField(CommonConstants.Segment.CUSTOM_MAP);
}
代码示例来源:origin: apache/helix
@Override
public ZNRecord update(ZNRecord znRecord) {
znRecord.getSimpleFields().putAll(contentToAddOrUpdate);
return znRecord;
}
}, AccessOption.PERSISTENT);
代码示例来源:origin: apache/helix
/**
* Determine whether the given config key is in the simple config
* @param configKey The key to check whether exists
* @return True if exists, otherwise false
*/
public boolean simpleConfigContains(String configKey) {
return getRecord().getSimpleFields().containsKey(configKey);
}
代码示例来源:origin: apache/helix
private static int getListFieldBound(ZNRecord record) {
int max = Integer.MAX_VALUE;
if (record.getSimpleFields().containsKey(ZNRecord.LIST_FIELD_BOUND)) {
String maxStr = record.getSimpleField(ZNRecord.LIST_FIELD_BOUND);
try {
max = Integer.parseInt(maxStr);
} catch (Exception e) {
logger.error("IllegalNumberFormat for list field bound: " + maxStr);
}
}
return max;
}
代码示例来源:origin: apache/helix
/**
* Get all simple configurations.
*
* @return all simple configurations.
*/
public Map<String, String> getSimpleConfigs() {
return Collections.unmodifiableMap(getRecord().getSimpleFields());
}
代码示例来源:origin: apache/helix
/**
* Get a single simple config value.
*
* @param configKey
* @return configuration value, or NULL if not exist.
*/
public String getSimpleConfig(String configKey) {
return getRecord().getSimpleFields().get(configKey);
}
代码示例来源:origin: org.apache.helix/helix-core
/**
* Get all simple configurations.
*
* @return all simple configurations.
*/
public Map<String, String> getSimpleConfigs() {
return Collections.unmodifiableMap(getRecord().getSimpleFields());
}
代码示例来源:origin: org.apache.helix/helix-core
/**
* Put a set of simple configs.
*
* @param configsMap
*/
public void putSimpleConfigs(Map<String, String> configsMap) {
getRecord().getSimpleFields().putAll(configsMap);
}
代码示例来源:origin: org.apache.helix/helix-core
/**
* Put a single simple config value.
*
* @param configKey
* @param configVal
*/
public void putSimpleConfig(String configKey, String configVal) {
getRecord().getSimpleFields().put(configKey, configVal);
}
代码示例来源:origin: apache/helix
/**
* Put a set of simple configs.
*
* @param configsMap
*/
public void putSimpleConfigs(Map<String, String> configsMap) {
getRecord().getSimpleFields().putAll(configsMap);
}
代码示例来源:origin: org.apache.helix/helix-core
public static List<ZNRecordRow> convertSimpleFields(ZNRecord record) {
List<ZNRecordRow> result = new ArrayList<ZNRecordRow>();
for (String key : record.getSimpleFields().keySet()) {
ZNRecordRow row = new ZNRecordRow();
row.putField(ZNRECORD_ID, record.getId());
row.putField(SIMPLE_KEY, key);
row.putField(SIMPLE_VALUE, record.getSimpleField(key));
result.add(row);
}
return result;
}
代码示例来源:origin: apache/helix
public static JobConfig fromHelixProperty(HelixProperty property)
throws IllegalArgumentException {
Map<String, String> configs = property.getRecord().getSimpleFields();
return Builder.fromMap(configs).build();
}
代码示例来源:origin: org.apache.helix/helix-core
public static JobConfig fromHelixProperty(HelixProperty property)
throws IllegalArgumentException {
Map<String, String> configs = property.getRecord().getSimpleFields();
return Builder.fromMap(configs).build();
}
代码示例来源:origin: apache/helix
public void removeResourceProperty(String clusterName, String resourceName, String propertyKey) {
IdealState idealState = _admin.getResourceIdealState(clusterName, resourceName);
if (idealState == null) {
throw new HelixException("Resource: " + resourceName + " has NOT been added yet");
}
idealState.getRecord().getSimpleFields().remove(propertyKey);
_admin.setResourceIdealState(clusterName, resourceName, idealState);
}
代码示例来源:origin: org.apache.helix/helix-core
public static WorkflowConfig fromHelixProperty(HelixProperty property)
throws IllegalArgumentException {
Map<String, String> configs = property.getRecord().getSimpleFields();
if (!configs.containsKey(WorkflowConfigProperty.Dag.name())) {
throw new IllegalArgumentException(
String.format("%s is an invalid WorkflowConfig", property.getId()));
}
return Builder.fromMap(configs).setWorkflowId(property.getId()).build();
}
代码示例来源:origin: apache/helix
public void testGroupCommit() throws InterruptedException {
final BaseDataAccessor<ZNRecord> accessor = new MockBaseDataAccessor();
final GroupCommit commit = new GroupCommit();
ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(400);
for (int i = 0; i < 2400; i++) {
Runnable runnable = new MyClass(accessor, commit, i);
newFixedThreadPool.submit(runnable);
}
Thread.sleep(10000);
System.out.println(accessor.get("test", null, 0));
System.out.println(accessor.get("test", null, 0).getSimpleFields().size());
}
代码示例来源:origin: apache/helix
protected static JobConfig.Builder getJobConfig(ZNRecord record) {
JobConfig.Builder jobConfig = new JobConfig.Builder().fromMap(record.getSimpleFields());
jobConfig.addTaskConfigMap(getTaskConfigMap(record.getMapFields()));
return jobConfig;
}
内容来源于网络,如有侵权,请联系作者删除!