use of alluxio.conf.Source in project alluxio by Alluxio.
the class DefaultBlockWorker method getConfiguration.
@Override
public Configuration getConfiguration(GetConfigurationPOptions options) {
// NOTE(cc): there is no guarantee that the returned cluster and path configurations are
// consistent snapshot of the system's state at a certain time, the path configuration might
// be in a newer state. But it's guaranteed that the hashes are respectively correspondent to
// the properties.
Configuration.Builder builder = Configuration.newBuilder();
if (!options.getIgnoreClusterConf()) {
Set<PropertyKey> keys = ServerConfiguration.keySet();
for (PropertyKey key : ServerConfiguration.keySet()) {
if (key.isBuiltIn()) {
Source source = ServerConfiguration.getSource(key);
Object value = ServerConfiguration.getOrDefault(key, null, ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(options.getRawValue()));
builder.addClusterProperty(key.getName(), value, source);
}
}
// NOTE(cc): assumes that ServerConfiguration is read-only when master is running, otherwise,
// the following hash might not correspond to the above cluster configuration.
builder.setClusterConfHash(ServerConfiguration.hash());
}
return builder.build();
}
use of alluxio.conf.Source in project alluxio by Alluxio.
the class DefaultMetaMaster method getConfiguration.
@Override
public Configuration getConfiguration(GetConfigurationPOptions options) {
// NOTE(cc): there is no guarantee that the returned cluster and path configurations are
// consistent snapshot of the system's state at a certain time, the path configuration might
// be in a newer state. But it's guaranteed that the hashes are respectively correspondent to
// the properties.
Configuration.Builder builder = Configuration.newBuilder();
if (!options.getIgnoreClusterConf()) {
for (PropertyKey key : ServerConfiguration.keySet()) {
if (key.isBuiltIn()) {
Source source = ServerConfiguration.getSource(key);
Object value = ServerConfiguration.getOrDefault(key, null, ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(options.getRawValue()));
builder.addClusterProperty(key.getName(), value, source);
}
}
// NOTE(cc): assumes that ServerConfiguration is read-only when master is running, otherwise,
// the following hash might not correspond to the above cluster configuration.
builder.setClusterConfHash(ServerConfiguration.hash());
}
if (!options.getIgnorePathConf()) {
PathPropertiesView pathProperties = mPathProperties.snapshot();
pathProperties.getProperties().forEach((path, properties) -> properties.forEach((key, value) -> builder.addPathProperty(path, key, value)));
builder.setPathConfHash(pathProperties.getHash());
}
return builder.build();
}
Aggregations