@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof alluxio.grpc.ConfigProperty)) { return super.equals(obj); } alluxio.grpc.ConfigProperty other = (alluxio.grpc.ConfigProperty) obj; boolean result = true; result = result && (hasName() == other.hasName()); if (hasName()) { result = result && getName() .equals(other.getName()); } result = result && (hasSource() == other.hasSource()); if (hasSource()) { result = result && getSource() .equals(other.getSource()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && unknownFields.equals(other.unknownFields); return result; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {
public alluxio.grpc.ConfigProperty buildPartial() { alluxio.grpc.ConfigProperty result = new alluxio.grpc.ConfigProperty(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.name_ = name_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.source_ = source_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.value_ = value_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
/** * <code>optional string source = 2;</code> */ public Builder clearSource() { bitField0_ = (bitField0_ & ~0x00000002); source_ = getDefaultInstance().getSource(); onChanged(); return this; } /**
/** * <code>optional string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
/** * <code>optional string value = 3;</code> */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000004); value_ = getDefaultInstance().getValue(); onChanged(); return this; } /**
client.getConfiguration().forEach(prop -> confMap.put(prop.getName(), prop)); } catch (IOException e) { System.out.println("Unable to get master-side configuration: " + e.getMessage()); ConfigProperty.Builder config = ConfigProperty.newBuilder().setName(key.getName()) .setSource(alluxioConf.getSource(key).toString()); String val = alluxioConf.getOrDefault(key, null, properties.sort(Comparator.comparing(ConfigProperty::getName)); for (ConfigProperty property : properties) { String value = ConfigurationUtils.valueAsString(property.getValue()); output.append(String.format("%s=%s", property.getName(), value)); if (cmd.hasOption(SOURCE_OPTION_NAME)) { output.append(String.format(" (%s)", property.getSource())); if (property.getValue() == null) { System.out.println(property.getSource()); } else if (cmd.hasOption(UNIT_OPTION_NAME)) { String arg = cmd.getOptionValue(UNIT_OPTION_NAME).toUpperCase(); byteUnit = ByteUnit.valueOf(arg); System.out.println( FormatUtils.parseSpaceSize(property.getValue()) / byteUnit.getValue()); break; } catch (Exception e) { timeUnit = TimeUnit.valueOf(arg); System.out.println(
/** * Registers new configuration information. * * @param address the node address * @param configList the configuration of this node */ public synchronized void registerNewConf(Address address, List<ConfigProperty> configList) { Preconditions.checkNotNull(address, "address should not be null"); Preconditions.checkNotNull(configList, "configuration list should not be null"); // Instead of recording property name, we record property key. mConfMap.put(address, configList.stream().map(c -> new ConfigRecord() .setKey(toPropertyKey(c.getName())).setSource(c.getSource()) .setValue(c.getValue())).collect(Collectors.toList())); mLostNodes.remove(address); for (Runnable function : mChangeListeners) { function.run(); } }
.setConsistencyCheckLevel(PropertyKey.ConsistencyCheckLevel.ENFORCE) .setScope(Scope.MASTER).build(); ConfigProperty masterEnforceProp = ConfigProperty.newBuilder() .setName(keyMasterEnforce.getName()).setSource("Test").setValue("Value").build(); .setConsistencyCheckLevel(PropertyKey.ConsistencyCheckLevel.WARN) .setScope(Scope.WORKER).build(); ConfigProperty workerWarnProp = ConfigProperty.newBuilder() .setName(keyWorkerWarn.getName()).setSource("Test").setValue("Value").build(); .setConsistencyCheckLevel(PropertyKey.ConsistencyCheckLevel.ENFORCE) .setScope(Scope.SERVER).build(); ConfigProperty serverEnforceProp = ConfigProperty.newBuilder() .setName(keyServerEnforce.getName()).setSource("Test").setValue("Value").build(); ConfigProperty.newBuilder().setName(workerWarnProp.getName()) .setSource(workerWarnProp.getSource()).setValue("WrongValue").build(); mRecordOne.registerNewConf(addressOne, Arrays.asList(masterEnforceProp, wrongWorkerWarnProp)); checkResults(0, 1, ConfigStatus.WARN); ConfigProperty wrongMasterEnforceProp = ConfigProperty.newBuilder() .setName(masterEnforceProp.getName()) .setSource(masterEnforceProp.getSource()).setValue("WrongValue").build(); mRecordTwo.registerNewConf(addressTwo, Arrays.asList(wrongMasterEnforceProp, workerWarnProp)); checkResults(1, 1, ConfigStatus.FAILED); ConfigProperty wrongServerEnforceProp = ConfigProperty.newBuilder() .setName(serverEnforceProp.getName()) .setSource(serverEnforceProp.getSource()).setValue("WrongValue").build();
String name = property.getName(); if (PropertyKey.isValid(name) && property.hasValue()) { PropertyKey key = PropertyKey.fromString(name); if (!GrpcUtils.contains(key.getScope(), Scope.CLIENT)) { String value = property.getValue(); clusterProps.put(key, value); LOG.debug("Loading cluster default: {} ({}) -> {}", key, key.getScope(), value);
public Builder mergeFrom(alluxio.grpc.ConfigProperty other) { if (other == alluxio.grpc.ConfigProperty.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasSource()) { bitField0_ |= 0x00000002; source_ = other.source_; onChanged(); } if (other.hasValue()) { bitField0_ |= 0x00000004; value_ = other.value_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * Gets Web UI ServerConfiguration page data. * * @return the response object */ @GET @Path(WEBUI_CONFIG) @ReturnType("alluxio.wire.MasterWebUIConfiguration") public Response getWebUIConfiguration() { return RestUtils.call(() -> { MasterWebUIConfiguration response = new MasterWebUIConfiguration(); response.setWhitelist(mFileSystemMaster.getWhiteList()); TreeSet<Triple<String, String, String>> sortedProperties = new TreeSet<>(); Set<String> alluxioConfExcludes = Sets.newHashSet(PropertyKey.MASTER_WHITELIST.toString()); for (ConfigProperty configProperty : mMetaMaster .getConfiguration(GetConfigurationPOptions.newBuilder().setRawValue(true).build())) { String confName = configProperty.getName(); if (!alluxioConfExcludes.contains(confName)) { sortedProperties.add(new ImmutableTriple<>(confName, ConfigurationUtils.valueAsString(configProperty.getValue()), configProperty.getSource())); } } response.setConfiguration(sortedProperties); return response; }, ServerConfiguration.global()); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasSource()) { hash = (37 * hash) + SOURCE_FIELD_NUMBER; hash = (53 * hash) + getSource().hashCode(); } if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * Gets all configuration properties filtered by the specified scope. * * @param conf the configuration to use * @param scope the scope to filter by * @return the properties */ public static List<ConfigProperty> getConfiguration(AlluxioConfiguration conf, Scope scope) { ConfigurationValueOptions useRawDisplayValue = ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(true); List<ConfigProperty> configs = new ArrayList<>(); List<PropertyKey> selectedKeys = conf.keySet().stream() .filter(key -> GrpcUtils.contains(key.getScope(), scope)) .filter(key -> key.isValid(key.getName())) .collect(toList()); for (PropertyKey key : selectedKeys) { ConfigProperty.Builder configProp = ConfigProperty.newBuilder().setName(key.getName()) .setSource(conf.getSource(key).toString()); if (conf.isSet(key)) { configProp.setValue(conf.get(key, useRawDisplayValue)); } configs.add(configProp.build()); } return configs; }
@Override public List<ConfigProperty> getConfiguration(GetConfigurationPOptions options) { List<ConfigProperty> configInfoList = new ArrayList<>(); for (PropertyKey key : ServerConfiguration.keySet()) { if (key.isBuiltIn()) { String source = ServerConfiguration.getSource(key).toString(); String value = ServerConfiguration.getOrDefault(key, null, ConfigurationValueOptions.defaults().useDisplayValue(true) .useRawValue(options.getRawValue())); ConfigProperty.Builder config = ConfigProperty.newBuilder().setName(key.getName()).setSource(source); if (value != null) { config.setValue(value); } configInfoList.add(config.build()); } } return configInfoList; }
@Test public void registerNewConfUnknownProperty() { Address testAddress = new Address("test", 0); ServerConfigurationStore configStore = new ServerConfigurationStore(); configStore.registerNewConf(testAddress, Arrays.asList(ConfigProperty.newBuilder().setName("unknown.property").build() )); Map<Address, List<ConfigRecord>> confMap = configStore.getConfMap(); assertTrue(confMap.containsKey(testAddress)); assertEquals("unknown.property", confMap.get(testAddress).get(0).getKey().getName()); }
@Before public void before() { PropertyKey keyEnforce = PropertyKey.ZOOKEEPER_ELECTION_PATH; PropertyKey keyWarn = PropertyKey.WORKER_FREE_SPACE_TIMEOUT; mConfigListOne = Arrays.asList( ConfigProperty.newBuilder().setName(keyEnforce.getName()).setSource("Test") .setValue("Value").build(), ConfigProperty.newBuilder().setName(keyWarn.getName()).setSource("Test").setValue("Value2") .build()); mConfigListTwo = Arrays.asList( ConfigProperty.newBuilder().setName(keyEnforce.getName()).setSource("Test") .setValue("Value3").build(), ConfigProperty.newBuilder().setName(keyWarn.getName()).setSource("Test").setValue("Value4") .build()); Random random = new Random(); mAddressOne = new Address(RandomStringUtils.randomAlphanumeric(10), random.nextInt()); mAddressTwo = new Address(RandomStringUtils.randomAlphanumeric(10), random.nextInt()); }