public Builder clear() { super.clear(); if (keyBuilder_ == null) { key_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto.getDefaultInstance(); } else { keyBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); if (valueBuilder_ == null) { value_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.getDefaultInstance(); } else { valueBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); return this; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; }
@Nonnull @Override public Optional<ProvidedStorageLocation> read(@Nonnull Block block) throws IOException { if (block == null) { throw new IOException("Block cannot be null"); } ReadRequestProto request = ReadRequestProto .newBuilder() .setKey(PBHelperClient.convert(block)) .build(); try { ReadResponseProto response = rpcProxy.read(null, request); ProvidedStorageLocationProto providedStorageLocation = response.getValue(); if (providedStorageLocation.isInitialized()) { return Optional.of(PBHelperClient.convert(providedStorageLocation)); } return Optional.empty(); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } }
public static ProvidedStorageLocation convert( HdfsProtos.ProvidedStorageLocationProto providedStorageLocationProto) { if (providedStorageLocationProto == null) { return null; } String path = providedStorageLocationProto.getPath(); long length = providedStorageLocationProto.getLength(); long offset = providedStorageLocationProto.getOffset(); ByteString nonce = providedStorageLocationProto.getNonce(); if (path == null || length == -1 || offset == -1 || nonce == null) { return null; } else { return new ProvidedStorageLocation(new Path(path), offset, length, nonce.toByteArray()); } }
public static HdfsProtos.ProvidedStorageLocationProto convert( ProvidedStorageLocation providedStorageLocation) { String path = providedStorageLocation.getPath().toString(); return HdfsProtos.ProvidedStorageLocationProto.newBuilder() .setPath(path) .setLength(providedStorageLocation.getLength()) .setOffset(providedStorageLocation.getOffset()) .setNonce(ByteString.copyFrom(providedStorageLocation.getNonce())) .build(); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.KeyValueProto)) { return super.equals(obj); } org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.KeyValueProto other = (org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.KeyValueProto) obj; boolean result = true; result = result && (hasKey() == other.hasKey()); if (hasKey()) { result = result && getKey() .equals(other.getKey()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
/** * <code>optional .hadoop.hdfs.ProvidedStorageLocationProto value = 2;</code> */ public Builder mergeValue(org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto value) { if (valueBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && value_ != org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.getDefaultInstance()) { value_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.newBuilder(value_).mergeFrom(value).buildPartial(); } else { value_ = value; } onChanged(); } else { valueBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasKey()) { hash = (37 * hash) + KEY_FIELD_NUMBER; hash = (53 * hash) + getKey().hashCode(); } if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; }
/** * <code>optional .hadoop.hdfs.ProvidedStorageLocationProto value = 1;</code> */ public Builder mergeValue(org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto value) { if (valueBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && value_ != org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.getDefaultInstance()) { value_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.newBuilder(value_).mergeFrom(value).buildPartial(); } else { value_ = value; } onChanged(); } else { valueBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.ReadResponseProto)) { return super.equals(obj); } org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.ReadResponseProto other = (org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.ReadResponseProto) obj; boolean result = true; result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (hasKey()) { if (!getKey().isInitialized()) { memoizedIsInitialized = 0; return false; } } if (hasValue()) { if (!getValue().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
public final boolean isInitialized() { if (hasKey()) { if (!getKey().isInitialized()) { return false; } } if (hasValue()) { if (!getValue().isInitialized()) { return false; } } return true; }
/** * <code>optional .hadoop.hdfs.ProvidedStorageLocationProto value = 1;</code> */ public Builder clearValue() { if (valueBuilder_ == null) { value_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.getDefaultInstance(); onChanged(); } else { valueBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } /**
/** * <code>optional .hadoop.hdfs.ProvidedStorageLocationProto value = 2;</code> */ public Builder clearValue() { if (valueBuilder_ == null) { value_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.getDefaultInstance(); onChanged(); } else { valueBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); return this; } /**
private void initFields() { value_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.getDefaultInstance(); } private byte memoizedIsInitialized = -1;
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (hasValue()) { if (!getValue().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
@Nonnull public static ProvidedStorageLocation fromProvidedStorageLocationBytes( @Nonnull byte[] providedStorageLocationDbFormat) throws InvalidProtocolBufferException { ProvidedStorageLocationProto providedStorageLocationProto = ProvidedStorageLocationProto .parseFrom(providedStorageLocationDbFormat); return PBHelperClient.convert(providedStorageLocationProto); }
private void initFields() { key_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto.getDefaultInstance(); value_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.getDefaultInstance(); } private byte memoizedIsInitialized = -1;
public Builder clear() { super.clear(); if (valueBuilder_ == null) { value_ = org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.ProvidedStorageLocationProto.getDefaultInstance(); } else { valueBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; }
public final boolean isInitialized() { if (hasValue()) { if (!getValue().isInitialized()) { return false; } } return true; }