@Override public InMemoryAliasMap.IterationResult list(Optional<Block> marker) throws IOException { ListRequestProto.Builder builder = ListRequestProto.newBuilder(); if (marker.isPresent()) { builder.setMarker(PBHelperClient.convert(marker.get())); } ListRequestProto request = builder.build(); try { ListResponseProto response = rpcProxy.list(null, request); List<KeyValueProto> fileRegionsList = response.getFileRegionsList(); List<FileRegion> fileRegions = fileRegionsList .stream() .map(kv -> new FileRegion( PBHelperClient.convert(kv.getKey()), PBHelperClient.convert(kv.getValue()) )) .collect(Collectors.toList()); BlockProto nextMarker = response.getNextMarker(); if (nextMarker.isInitialized()) { return new InMemoryAliasMap.IterationResult(fileRegions, Optional.of(PBHelperClient.convert(nextMarker))); } else { return new InMemoryAliasMap.IterationResult(fileRegions, Optional.empty()); } } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } }
@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; }
@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; }
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 static FileRegion convert(KeyValueProto keyValueProto) { BlockProto blockProto = keyValueProto.getKey(); ProvidedStorageLocationProto providedStorageLocationProto = keyValueProto.getValue(); Block block = PBHelperClient.convert(blockProto); ProvidedStorageLocation providedStorageLocation = PBHelperClient.convert(providedStorageLocationProto); return new FileRegion(block, providedStorageLocation); } }
public Builder mergeFrom(org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.KeyValueProto other) { if (other == org.apache.hadoop.hdfs.protocol.proto.AliasMapProtocolProtos.KeyValueProto.getDefaultInstance()) return this; if (other.hasKey()) { mergeKey(other.getKey()); } if (other.hasValue()) { mergeValue(other.getValue()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }