Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,6 @@ public final class HddsConfigKeys {
public static final String HDDS_SECRET_KEY_ROTATE_CHECK_DURATION_DEFAULT
= "10m";

/**
* Do not instantiate.
*/
private HddsConfigKeys() {
}

// Enable TLS for GRPC clients/server in ozone.
public static final String HDDS_GRPC_TLS_ENABLED = "hdds.grpc.tls.enabled";
public static final boolean HDDS_GRPC_TLS_ENABLED_DEFAULT = false;
Expand Down Expand Up @@ -426,4 +420,7 @@ private HddsConfigKeys() {
public static final String HDDS_METRICS_PERCENTILES_INTERVALS_KEY =
"hdds.metrics.percentiles.intervals";

/** Do not instantiate. */
private HddsConfigKeys() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
* HDDS Id generator.
*/
public final class HddsIdFactory {
private static final AtomicLong LONG_COUNTER = new AtomicLong(System.currentTimeMillis());

private HddsIdFactory() {
}

private static final AtomicLong LONG_COUNTER = new AtomicLong(
System.currentTimeMillis());

/**
* Returns an incrementing long. This class doesn't
* persist initial value for long Id's, so incremental id's after restart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@
* Simple utility class to collection string conversion methods.
*/
public final class StringUtils {
private static final Charset UTF8 = StandardCharsets.UTF_8;

private StringUtils() {
}

private static final Charset UTF8 = StandardCharsets.UTF_8;

/**
* Decode a specific range of bytes of the given byte array to a string
* using UTF8.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ public class ECReplicationConfig implements ReplicationConfig {

public static final String EC_REPLICATION_PARAMS_DELIMITER = "-";

// Acceptable patterns are like:
// rs-3-2-1024k
// RS-3-2-2048
// XOR-10-4-4096K
private static final Pattern STRING_FORMAT = Pattern.compile("([a-zA-Z]+)-(\\d+)-(\\d+)-(\\d+)([kK])?");

private final int data;

private final int parity;

private final int ecChunkSize;

private final EcCodec codec;

/**
* Enum defining the allowed list of ECCodecs.
*/
Expand All @@ -53,21 +67,6 @@ public static String allValuesAsString() {
}
}

// Acceptable patterns are like:
// rs-3-2-1024k
// RS-3-2-2048
// XOR-10-4-4096K
private static final Pattern STRING_FORMAT
= Pattern.compile("([a-zA-Z]+)-(\\d+)-(\\d+)-(\\d+)([kK])?");

private final int data;

private final int parity;

private final int ecChunkSize;

private final EcCodec codec;

public ECReplicationConfig(int data, int parity) {
this(data, parity, EcCodec.RS, 1024 * 1024);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
* a storage volume.
*/
public final class OzoneQuota {
private static final List<Units> PARSE_ORDER;

private static final RawQuotaInBytes ZERO_BYTES = new RawQuotaInBytes(Units.B, 0);

// Quota to decide how many buckets can be created.
private long quotaInNamespace;
// Quota to decide how much storage space will be used in bytes.
private final long quotaInBytes;
private final RawQuotaInBytes rawQuotaInBytes;

static {
List<Units> reversed = new ArrayList<>(Arrays.asList(Units.values()));
Collections.reverse(reversed);
PARSE_ORDER = Collections.unmodifiableList(reversed);
}

/** Quota Units.*/
public enum Units {
Expand Down Expand Up @@ -68,25 +83,18 @@ RawQuotaInBytes getRawQuotaInBytes(long b) {
}
}

private static final List<Units> PARSE_ORDER;
static {
List<Units> reversed = new ArrayList<>(Arrays.asList(Units.values()));
Collections.reverse(reversed);
PARSE_ORDER = Collections.unmodifiableList(reversed);
}

private static final RawQuotaInBytes ZERO_BYTES = new RawQuotaInBytes(Units.B, 0);

// Quota to decide how many buckets can be created.
private long quotaInNamespace;
// Quota to decide how much storage space will be used in bytes.
private final long quotaInBytes;
private final RawQuotaInBytes rawQuotaInBytes;

/**
* Used to convert user input values into bytes such as: 1MB-> 1048576.
*/
private static class RawQuotaInBytes {
private final Units unit;
private final long size;

RawQuotaInBytes(Units unit, long size) {
this.unit = unit;
this.size = size;
}

static RawQuotaInBytes valueOf(long quotaInBytes) {
Preconditions.assertTrue(quotaInBytes >= 0, () -> "quotaInBytes = " + quotaInBytes + " must be >= 0");
if (quotaInBytes == 0) {
Expand All @@ -99,14 +107,6 @@ static RawQuotaInBytes valueOf(long quotaInBytes) {
return b;
}

private final Units unit;
private final long size;

RawQuotaInBytes(Units unit, long size) {
this.unit = unit;
this.size = size;
}

public Units getUnit() {
return unit;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
* Configuration for ozone.
*/
@InterfaceAudience.Private
public class OzoneConfiguration extends Configuration
implements MutableConfigurationSource {
public class OzoneConfiguration extends Configuration implements MutableConfigurationSource {

public static final SortedSet<String> TAGS = unmodifiableSortedSet(
Arrays.stream(ConfigTag.values())
Expand All @@ -74,6 +73,8 @@ public class OzoneConfiguration extends Configuration
activate();
}

private Properties delegatingProps;

public static OzoneConfiguration of(ConfigurationSource source) {
if (source instanceof LegacyHadoopConfigurationSource) {
return new OzoneConfiguration(((LegacyHadoopConfigurationSource) source)
Expand Down Expand Up @@ -434,8 +435,6 @@ public int getInt(String name, String fallbackName, int defaultValue,
return Integer.parseInt(value);
}

private Properties delegatingProps;

@Override
public synchronized void reloadConfiguration() {
super.reloadConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@InterfaceAudience.Private
@InterfaceStability.Evolving
public interface SpaceUsageSource {
SpaceUsageSource UNKNOWN = new Fixed(0, 0, 0);

/**
* @return space usage in bytes
Expand All @@ -44,8 +45,6 @@ default SpaceUsageSource snapshot() {
return new Fixed(getCapacity(), getAvailable(), getUsedSpace());
}

SpaceUsageSource UNKNOWN = new Fixed(0, 0, 0);

/**
* A static source of space usage. Can be a point in time snapshot of a
* real volume usage, or can be used for testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,16 @@
*/
@InterfaceAudience.Private
@InterfaceStability.Evolving
public class DatanodeDetails extends NodeImpl implements
Comparable<DatanodeDetails> {
public class DatanodeDetails extends NodeImpl implements Comparable<DatanodeDetails> {

private static final Logger LOG =
LoggerFactory.getLogger(DatanodeDetails.class);
private static final Logger LOG = LoggerFactory.getLogger(DatanodeDetails.class);

private static final Codec<DatanodeDetails> CODEC = new DelegatedCodec<>(
Proto2Codec.get(ExtendedDatanodeDetailsProto.getDefaultInstance()),
DatanodeDetails::getFromProtoBuf,
DatanodeDetails::getExtendedProtoBufMessage,
DatanodeDetails.class);

public static Codec<DatanodeDetails> getCodec() {
return CODEC;
}

/**
* DataNode's unique identifier in the cluster.
*/
Expand Down Expand Up @@ -145,6 +139,10 @@ public DatanodeDetails(DatanodeDetails datanodeDetails) {
this.currentVersion = datanodeDetails.getCurrentVersion();
}

public static Codec<DatanodeDetails> getCodec() {
return CODEC;
}

public DatanodeID getID() {
return id;
}
Expand Down Expand Up @@ -1018,6 +1016,8 @@ public static Port newStandalonePort(Integer portNumber) {
* Container to hold DataNode Port details.
*/
public static final class Port {
private final Name name;
private final Integer value;

/**
* Ports that are supported in DataNode.
Expand All @@ -1042,9 +1042,6 @@ public enum Name {
EnumSet.of(STANDALONE, RATIS, RATIS_DATASTREAM));
}

private final Name name;
private final Integer value;

/**
* Private constructor for constructing Port object. Use
* DatanodeDetails#newPort to create a new Port object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
* for {@link ContainerCommandRequestProto}.
*/
public final class ContainerCommandRequestMessage implements Message {
private final ContainerCommandRequestProto header;
private final ByteString data;
private final Supplier<ByteString> contentSupplier = JavaUtils.memoize(this::buildContent);

public static ContainerCommandRequestMessage toMessage(
ContainerCommandRequestProto request, String traceId) {
final ContainerCommandRequestProto.Builder b
Expand Down Expand Up @@ -90,11 +94,6 @@ public static ContainerCommandRequestProto toProto(
return b.build();
}

private final ContainerCommandRequestProto header;
private final ByteString data;
private final Supplier<ByteString> contentSupplier
= JavaUtils.memoize(this::buildContent);

private ContainerCommandRequestMessage(
ContainerCommandRequestProto header, ByteString data) {
this.header = Objects.requireNonNull(header, "header == null");
Expand Down
Loading