HDFS-9111. Move hdfs-client protobuf convert methods from PBHelper to PBHelperClient. Contributed by Mingliang Liu.
This commit is contained in:
parent
8e01b0d97a
commit
06022b8fdc
File diff suppressed because it is too large
Load Diff
|
@ -938,6 +938,9 @@ Release 2.8.0 - UNRELEASED
|
|||
HDFS-9101. Remove deprecated NameNode.getUri() static helper method.
|
||||
(Mingliang Liu via wheat9)
|
||||
|
||||
HDFS-9111. Move hdfs-client protobuf convert methods from PBHelper to
|
||||
PBHelperClient. (Mingliang Liu via wheat9)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpTransferBlockP
|
|||
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpWriteBlockProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.ReleaseShortCircuitAccessRequestProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.ShortCircuitShmRequestProto;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.apache.hadoop.hdfs.server.datanode.CachingStrategy;
|
||||
import org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm.SlotId;
|
||||
|
@ -115,7 +114,7 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
proto.getClass().getSimpleName());
|
||||
try {
|
||||
readBlock(PBHelperClient.convert(proto.getHeader().getBaseHeader().getBlock()),
|
||||
PBHelper.convert(proto.getHeader().getBaseHeader().getToken()),
|
||||
PBHelperClient.convert(proto.getHeader().getBaseHeader().getToken()),
|
||||
proto.getHeader().getClientName(),
|
||||
proto.getOffset(),
|
||||
proto.getLen(),
|
||||
|
@ -131,17 +130,17 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
/** Receive OP_WRITE_BLOCK */
|
||||
private void opWriteBlock(DataInputStream in) throws IOException {
|
||||
final OpWriteBlockProto proto = OpWriteBlockProto.parseFrom(vintPrefixed(in));
|
||||
final DatanodeInfo[] targets = PBHelper.convert(proto.getTargetsList());
|
||||
final DatanodeInfo[] targets = PBHelperClient.convert(proto.getTargetsList());
|
||||
TraceScope traceScope = continueTraceSpan(proto.getHeader(),
|
||||
proto.getClass().getSimpleName());
|
||||
try {
|
||||
writeBlock(PBHelperClient.convert(proto.getHeader().getBaseHeader().getBlock()),
|
||||
PBHelperClient.convertStorageType(proto.getStorageType()),
|
||||
PBHelper.convert(proto.getHeader().getBaseHeader().getToken()),
|
||||
PBHelperClient.convert(proto.getHeader().getBaseHeader().getToken()),
|
||||
proto.getHeader().getClientName(),
|
||||
targets,
|
||||
PBHelper.convertStorageTypes(proto.getTargetStorageTypesList(), targets.length),
|
||||
PBHelper.convert(proto.getSource()),
|
||||
PBHelperClient.convertStorageTypes(proto.getTargetStorageTypesList(), targets.length),
|
||||
PBHelperClient.convert(proto.getSource()),
|
||||
fromProto(proto.getStage()),
|
||||
proto.getPipelineSize(),
|
||||
proto.getMinBytesRcvd(), proto.getMaxBytesRcvd(),
|
||||
|
@ -152,7 +151,7 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
CachingStrategy.newDefaultStrategy()),
|
||||
(proto.hasAllowLazyPersist() ? proto.getAllowLazyPersist() : false),
|
||||
(proto.hasPinning() ? proto.getPinning(): false),
|
||||
(PBHelper.convertBooleanList(proto.getTargetPinningsList())));
|
||||
(PBHelperClient.convertBooleanList(proto.getTargetPinningsList())));
|
||||
} finally {
|
||||
if (traceScope != null) traceScope.close();
|
||||
}
|
||||
|
@ -162,15 +161,15 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
private void opTransferBlock(DataInputStream in) throws IOException {
|
||||
final OpTransferBlockProto proto =
|
||||
OpTransferBlockProto.parseFrom(vintPrefixed(in));
|
||||
final DatanodeInfo[] targets = PBHelper.convert(proto.getTargetsList());
|
||||
final DatanodeInfo[] targets = PBHelperClient.convert(proto.getTargetsList());
|
||||
TraceScope traceScope = continueTraceSpan(proto.getHeader(),
|
||||
proto.getClass().getSimpleName());
|
||||
try {
|
||||
transferBlock(PBHelperClient.convert(proto.getHeader().getBaseHeader().getBlock()),
|
||||
PBHelper.convert(proto.getHeader().getBaseHeader().getToken()),
|
||||
PBHelperClient.convert(proto.getHeader().getBaseHeader().getToken()),
|
||||
proto.getHeader().getClientName(),
|
||||
targets,
|
||||
PBHelper.convertStorageTypes(proto.getTargetStorageTypesList(), targets.length));
|
||||
PBHelperClient.convertStorageTypes(proto.getTargetStorageTypesList(), targets.length));
|
||||
} finally {
|
||||
if (traceScope != null) traceScope.close();
|
||||
}
|
||||
|
@ -181,12 +180,12 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
final OpRequestShortCircuitAccessProto proto =
|
||||
OpRequestShortCircuitAccessProto.parseFrom(vintPrefixed(in));
|
||||
SlotId slotId = (proto.hasSlotId()) ?
|
||||
PBHelper.convert(proto.getSlotId()) : null;
|
||||
PBHelperClient.convert(proto.getSlotId()) : null;
|
||||
TraceScope traceScope = continueTraceSpan(proto.getHeader(),
|
||||
proto.getClass().getSimpleName());
|
||||
try {
|
||||
requestShortCircuitFds(PBHelperClient.convert(proto.getHeader().getBlock()),
|
||||
PBHelper.convert(proto.getHeader().getToken()),
|
||||
PBHelperClient.convert(proto.getHeader().getToken()),
|
||||
slotId, proto.getMaxVersion(),
|
||||
proto.getSupportsReceiptVerification());
|
||||
} finally {
|
||||
|
@ -202,7 +201,7 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
TraceScope traceScope = continueTraceSpan(proto.getTraceInfo(),
|
||||
proto.getClass().getSimpleName());
|
||||
try {
|
||||
releaseShortCircuitFds(PBHelper.convert(proto.getSlotId()));
|
||||
releaseShortCircuitFds(PBHelperClient.convert(proto.getSlotId()));
|
||||
} finally {
|
||||
if (traceScope != null) traceScope.close();
|
||||
}
|
||||
|
@ -229,9 +228,9 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
try {
|
||||
replaceBlock(PBHelperClient.convert(proto.getHeader().getBlock()),
|
||||
PBHelperClient.convertStorageType(proto.getStorageType()),
|
||||
PBHelper.convert(proto.getHeader().getToken()),
|
||||
PBHelperClient.convert(proto.getHeader().getToken()),
|
||||
proto.getDelHint(),
|
||||
PBHelper.convert(proto.getSource()));
|
||||
PBHelperClient.convert(proto.getSource()));
|
||||
} finally {
|
||||
if (traceScope != null) traceScope.close();
|
||||
}
|
||||
|
@ -244,7 +243,7 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
proto.getClass().getSimpleName());
|
||||
try {
|
||||
copyBlock(PBHelperClient.convert(proto.getHeader().getBlock()),
|
||||
PBHelper.convert(proto.getHeader().getToken()));
|
||||
PBHelperClient.convert(proto.getHeader().getToken()));
|
||||
} finally {
|
||||
if (traceScope != null) traceScope.close();
|
||||
}
|
||||
|
@ -257,7 +256,7 @@ public abstract class Receiver implements DataTransferProtocol {
|
|||
proto.getClass().getSimpleName());
|
||||
try {
|
||||
blockChecksum(PBHelperClient.convert(proto.getHeader().getBlock()),
|
||||
PBHelper.convert(proto.getHeader().getToken()));
|
||||
PBHelperClient.convert(proto.getHeader().getToken()));
|
||||
} finally {
|
||||
if (traceScope != null) traceScope.close();
|
||||
}
|
||||
|
|
|
@ -123,7 +123,9 @@ public class ClientDatanodeProtocolServerSideTranslatorPB implements
|
|||
throws ServiceException {
|
||||
BlockLocalPathInfo resp;
|
||||
try {
|
||||
resp = impl.getBlockLocalPathInfo(PBHelperClient.convert(request.getBlock()), PBHelper.convert(request.getToken()));
|
||||
resp = impl.getBlockLocalPathInfo(
|
||||
PBHelperClient.convert(request.getBlock()),
|
||||
PBHelperClient.convert(request.getToken()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -150,7 +152,7 @@ public class ClientDatanodeProtocolServerSideTranslatorPB implements
|
|||
GetDatanodeInfoResponseProto res;
|
||||
try {
|
||||
res = GetDatanodeInfoResponseProto.newBuilder()
|
||||
.setLocalInfo(PBHelper.convert(impl.getDatanodeInfo())).build();
|
||||
.setLocalInfo(PBHelperClient.convert(impl.getDatanodeInfo())).build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.hadoop.hdfs.protocolPB;
|
|||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
|
||||
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol;
|
||||
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSelector;
|
||||
|
@ -31,7 +31,7 @@ import org.apache.hadoop.security.token.TokenInfo;
|
|||
@InterfaceAudience.Private
|
||||
@InterfaceStability.Stable
|
||||
@KerberosInfo(
|
||||
serverPrincipal = DFSConfigKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY)
|
||||
serverPrincipal = HdfsClientConfigKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY)
|
||||
@TokenInfo(DelegationTokenSelector.class)
|
||||
@ProtocolInfo(protocolName = HdfsConstants.CLIENT_NAMENODE_PROTOCOL_NAME,
|
||||
protocolVersion = 1)
|
||||
|
|
|
@ -367,7 +367,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
Builder builder = GetBlockLocationsResponseProto
|
||||
.newBuilder();
|
||||
if (b != null) {
|
||||
builder.setLocations(PBHelper.convert(b)).build();
|
||||
builder.setLocations(PBHelperClient.convert(b)).build();
|
||||
}
|
||||
return builder.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -382,7 +382,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
try {
|
||||
FsServerDefaults result = server.getServerDefaults();
|
||||
return GetServerDefaultsResponseProto.newBuilder()
|
||||
.setServerDefaults(PBHelper.convert(result))
|
||||
.setServerDefaults(PBHelperClient.convert(result))
|
||||
.build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -395,14 +395,14 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
CreateRequestProto req) throws ServiceException {
|
||||
try {
|
||||
HdfsFileStatus result = server.create(req.getSrc(),
|
||||
PBHelper.convert(req.getMasked()), req.getClientName(),
|
||||
PBHelper.convertCreateFlag(req.getCreateFlag()), req.getCreateParent(),
|
||||
PBHelperClient.convert(req.getMasked()), req.getClientName(),
|
||||
PBHelperClient.convertCreateFlag(req.getCreateFlag()), req.getCreateParent(),
|
||||
(short) req.getReplication(), req.getBlockSize(),
|
||||
PBHelper.convertCryptoProtocolVersions(
|
||||
PBHelperClient.convertCryptoProtocolVersions(
|
||||
req.getCryptoProtocolVersionList()));
|
||||
|
||||
if (result != null) {
|
||||
return CreateResponseProto.newBuilder().setFs(PBHelper.convert(result))
|
||||
return CreateResponseProto.newBuilder().setFs(PBHelperClient.convert(result))
|
||||
.build();
|
||||
}
|
||||
return VOID_CREATE_RESPONSE;
|
||||
|
@ -416,16 +416,16 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
AppendRequestProto req) throws ServiceException {
|
||||
try {
|
||||
EnumSetWritable<CreateFlag> flags = req.hasFlag() ?
|
||||
PBHelper.convertCreateFlag(req.getFlag()) :
|
||||
PBHelperClient.convertCreateFlag(req.getFlag()) :
|
||||
new EnumSetWritable<>(EnumSet.of(CreateFlag.APPEND));
|
||||
LastBlockWithStatus result = server.append(req.getSrc(),
|
||||
req.getClientName(), flags);
|
||||
AppendResponseProto.Builder builder = AppendResponseProto.newBuilder();
|
||||
if (result.getLastBlock() != null) {
|
||||
builder.setBlock(PBHelper.convert(result.getLastBlock()));
|
||||
builder.setBlock(PBHelperClient.convert(result.getLastBlock()));
|
||||
}
|
||||
if (result.getFileStatus() != null) {
|
||||
builder.setStat(PBHelper.convert(result.getFileStatus()));
|
||||
builder.setStat(PBHelperClient.convert(result.getFileStatus()));
|
||||
}
|
||||
return builder.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -450,7 +450,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public SetPermissionResponseProto setPermission(RpcController controller,
|
||||
SetPermissionRequestProto req) throws ServiceException {
|
||||
try {
|
||||
server.setPermission(req.getSrc(), PBHelper.convert(req.getPermission()));
|
||||
server.setPermission(req.getSrc(), PBHelperClient.convert(req.getPermission()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -493,12 +493,12 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
req.getSrc(),
|
||||
req.getClientName(),
|
||||
req.hasPrevious() ? PBHelperClient.convert(req.getPrevious()) : null,
|
||||
(excl == null || excl.size() == 0) ? null : PBHelper.convert(excl
|
||||
(excl == null || excl.size() == 0) ? null : PBHelperClient.convert(excl
|
||||
.toArray(new DatanodeInfoProto[excl.size()])), req.getFileId(),
|
||||
(favor == null || favor.size() == 0) ? null : favor
|
||||
.toArray(new String[favor.size()]));
|
||||
return AddBlockResponseProto.newBuilder()
|
||||
.setBlock(PBHelper.convert(result)).build();
|
||||
.setBlock(PBHelperClient.convert(result)).build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -514,15 +514,15 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
List<DatanodeInfoProto> excludesList = req.getExcludesList();
|
||||
LocatedBlock result = server.getAdditionalDatanode(req.getSrc(),
|
||||
req.getFileId(), PBHelperClient.convert(req.getBlk()),
|
||||
PBHelper.convert(existingList.toArray(
|
||||
PBHelperClient.convert(existingList.toArray(
|
||||
new DatanodeInfoProto[existingList.size()])),
|
||||
existingStorageIDsList.toArray(
|
||||
new String[existingStorageIDsList.size()]),
|
||||
PBHelper.convert(excludesList.toArray(
|
||||
PBHelperClient.convert(excludesList.toArray(
|
||||
new DatanodeInfoProto[excludesList.size()])),
|
||||
req.getNumAdditionalNodes(), req.getClientName());
|
||||
return GetAdditionalDatanodeResponseProto.newBuilder().setBlock(
|
||||
PBHelper.convert(result))
|
||||
PBHelperClient.convert(result))
|
||||
.build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -548,7 +548,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
ReportBadBlocksRequestProto req) throws ServiceException {
|
||||
try {
|
||||
List<LocatedBlockProto> bl = req.getBlocksList();
|
||||
server.reportBadBlocks(PBHelper.convertLocatedBlock(
|
||||
server.reportBadBlocks(PBHelperClient.convertLocatedBlock(
|
||||
bl.toArray(new LocatedBlockProto[bl.size()])));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -620,7 +620,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
MkdirsRequestProto req) throws ServiceException {
|
||||
try {
|
||||
boolean result = server.mkdirs(req.getSrc(),
|
||||
PBHelper.convert(req.getMasked()), req.getCreateParent());
|
||||
PBHelperClient.convert(req.getMasked()), req.getCreateParent());
|
||||
return MkdirsResponseProto.newBuilder().setResult(result).build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -636,7 +636,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
req.getNeedLocation());
|
||||
if (result !=null) {
|
||||
return GetListingResponseProto.newBuilder().setDirList(
|
||||
PBHelper.convert(result)).build();
|
||||
PBHelperClient.convert(result)).build();
|
||||
} else {
|
||||
return VOID_GETLISTING_RESPONSE;
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public GetFsStatsResponseProto getFsStats(RpcController controller,
|
||||
GetFsStatusRequestProto req) throws ServiceException {
|
||||
try {
|
||||
return PBHelper.convert(server.getStats());
|
||||
return PBHelperClient.convert(server.getStats());
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -696,7 +696,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
throws ServiceException {
|
||||
try {
|
||||
List<? extends DatanodeInfoProto> result = PBHelperClient.convert(server
|
||||
.getDatanodeReport(PBHelper.convert(req.getType())));
|
||||
.getDatanodeReport(PBHelperClient.convert(req.getType())));
|
||||
return GetDatanodeReportResponseProto.newBuilder()
|
||||
.addAllDi(result).build();
|
||||
} catch (IOException e) {
|
||||
|
@ -709,8 +709,8 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
RpcController controller, GetDatanodeStorageReportRequestProto req)
|
||||
throws ServiceException {
|
||||
try {
|
||||
List<DatanodeStorageReportProto> reports = PBHelper.convertDatanodeStorageReports(
|
||||
server.getDatanodeStorageReport(PBHelper.convert(req.getType())));
|
||||
List<DatanodeStorageReportProto> reports = PBHelperClient.convertDatanodeStorageReports(
|
||||
server.getDatanodeStorageReport(PBHelperClient.convert(req.getType())));
|
||||
return GetDatanodeStorageReportResponseProto.newBuilder()
|
||||
.addAllDatanodeStorageReports(reports)
|
||||
.build();
|
||||
|
@ -736,7 +736,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public SetSafeModeResponseProto setSafeMode(RpcController controller,
|
||||
SetSafeModeRequestProto req) throws ServiceException {
|
||||
try {
|
||||
boolean result = server.setSafeMode(PBHelper.convert(req.getAction()),
|
||||
boolean result = server.setSafeMode(PBHelperClient.convert(req.getAction()),
|
||||
req.getChecked());
|
||||
return SetSafeModeResponseProto.newBuilder().setResult(result).build();
|
||||
} catch (IOException e) {
|
||||
|
@ -799,10 +799,10 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
RollingUpgradeRequestProto req) throws ServiceException {
|
||||
try {
|
||||
final RollingUpgradeInfo info = server.rollingUpgrade(
|
||||
PBHelper.convert(req.getAction()));
|
||||
PBHelperClient.convert(req.getAction()));
|
||||
final RollingUpgradeResponseProto.Builder b = RollingUpgradeResponseProto.newBuilder();
|
||||
if (info != null) {
|
||||
b.setRollingUpgradeInfo(PBHelper.convert(info));
|
||||
b.setRollingUpgradeInfo(PBHelperClient.convert(info));
|
||||
}
|
||||
return b.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -818,7 +818,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
CorruptFileBlocks result = server.listCorruptFileBlocks(
|
||||
req.getPath(), req.hasCookie() ? req.getCookie(): null);
|
||||
return ListCorruptFileBlocksResponseProto.newBuilder()
|
||||
.setCorrupt(PBHelper.convert(result))
|
||||
.setCorrupt(PBHelperClient.convert(result))
|
||||
.build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -845,7 +845,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
|
||||
if (result != null) {
|
||||
return GetFileInfoResponseProto.newBuilder().setFs(
|
||||
PBHelper.convert(result)).build();
|
||||
PBHelperClient.convert(result)).build();
|
||||
}
|
||||
return VOID_GETFILEINFO_RESPONSE;
|
||||
} catch (IOException e) {
|
||||
|
@ -860,7 +860,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
HdfsFileStatus result = server.getFileLinkInfo(req.getSrc());
|
||||
if (result != null) {
|
||||
return GetFileLinkInfoResponseProto.newBuilder().setFs(
|
||||
PBHelper.convert(result)).build();
|
||||
PBHelperClient.convert(result)).build();
|
||||
} else {
|
||||
return VOID_GETFILELINKINFO_RESPONSE;
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
try {
|
||||
ContentSummary result = server.getContentSummary(req.getPath());
|
||||
return GetContentSummaryResponseProto.newBuilder()
|
||||
.setSummary(PBHelper.convert(result)).build();
|
||||
.setSummary(PBHelperClient.convert(result)).build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -925,7 +925,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
CreateSymlinkRequestProto req) throws ServiceException {
|
||||
try {
|
||||
server.createSymlink(req.getTarget(), req.getLink(),
|
||||
PBHelper.convert(req.getDirPerm()), req.getCreateParent());
|
||||
PBHelperClient.convert(req.getDirPerm()), req.getCreateParent());
|
||||
return VOID_CREATESYMLINK_RESPONSE;
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -953,7 +953,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
RpcController controller, UpdateBlockForPipelineRequestProto req)
|
||||
throws ServiceException {
|
||||
try {
|
||||
LocatedBlockProto result = PBHelper.convert(server
|
||||
LocatedBlockProto result = PBHelperClient.convert(server
|
||||
.updateBlockForPipeline(PBHelperClient.convert(req.getBlock()),
|
||||
req.getClientName()));
|
||||
return UpdateBlockForPipelineResponseProto.newBuilder().setBlock(result)
|
||||
|
@ -972,7 +972,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
server.updatePipeline(req.getClientName(),
|
||||
PBHelperClient.convert(req.getOldBlock()),
|
||||
PBHelperClient.convert(req.getNewBlock()),
|
||||
PBHelper.convert(newNodes.toArray(new DatanodeIDProto[newNodes.size()])),
|
||||
PBHelperClient.convert(newNodes.toArray(new DatanodeIDProto[newNodes.size()])),
|
||||
newStorageIDs.toArray(new String[newStorageIDs.size()]));
|
||||
return VOID_UPDATEPIPELINE_RESPONSE;
|
||||
} catch (IOException e) {
|
||||
|
@ -1003,7 +1003,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
RpcController controller, RenewDelegationTokenRequestProto req)
|
||||
throws ServiceException {
|
||||
try {
|
||||
long result = server.renewDelegationToken(PBHelper
|
||||
long result = server.renewDelegationToken(PBHelperClient
|
||||
.convertDelegationToken(req.getToken()));
|
||||
return RenewDelegationTokenResponseProto.newBuilder()
|
||||
.setNewExpiryTime(result).build();
|
||||
|
@ -1017,7 +1017,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
RpcController controller, CancelDelegationTokenRequestProto req)
|
||||
throws ServiceException {
|
||||
try {
|
||||
server.cancelDelegationToken(PBHelper.convertDelegationToken(req
|
||||
server.cancelDelegationToken(PBHelperClient.convertDelegationToken(req
|
||||
.getToken()));
|
||||
return VOID_CANCELDELEGATIONTOKEN_RESPONSE;
|
||||
} catch (IOException e) {
|
||||
|
@ -1046,7 +1046,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
GetDataEncryptionKeyResponseProto.newBuilder();
|
||||
DataEncryptionKey encryptionKey = server.getDataEncryptionKey();
|
||||
if (encryptionKey != null) {
|
||||
builder.setDataEncryptionKey(PBHelper.convert(encryptionKey));
|
||||
builder.setDataEncryptionKey(PBHelperClient.convert(encryptionKey));
|
||||
}
|
||||
return builder.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -1125,7 +1125,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
.getSnapshottableDirListing();
|
||||
if (result != null) {
|
||||
return GetSnapshottableDirListingResponseProto.newBuilder().
|
||||
setSnapshottableDirList(PBHelper.convert(result)).build();
|
||||
setSnapshottableDirList(PBHelperClient.convert(result)).build();
|
||||
} else {
|
||||
return NULL_GET_SNAPSHOTTABLE_DIR_LISTING_RESPONSE;
|
||||
}
|
||||
|
@ -1143,7 +1143,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
request.getSnapshotRoot(), request.getFromSnapshot(),
|
||||
request.getToSnapshot());
|
||||
return GetSnapshotDiffReportResponseProto.newBuilder()
|
||||
.setDiffReport(PBHelper.convert(report)).build();
|
||||
.setDiffReport(PBHelperClient.convert(report)).build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1167,8 +1167,8 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
throws ServiceException {
|
||||
try {
|
||||
long id = server.addCacheDirective(
|
||||
PBHelper.convert(request.getInfo()),
|
||||
PBHelper.convertCacheFlags(request.getCacheFlags()));
|
||||
PBHelperClient.convert(request.getInfo()),
|
||||
PBHelperClient.convertCacheFlags(request.getCacheFlags()));
|
||||
return AddCacheDirectiveResponseProto.newBuilder().
|
||||
setId(id).build();
|
||||
} catch (IOException e) {
|
||||
|
@ -1182,8 +1182,8 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
throws ServiceException {
|
||||
try {
|
||||
server.modifyCacheDirective(
|
||||
PBHelper.convert(request.getInfo()),
|
||||
PBHelper.convertCacheFlags(request.getCacheFlags()));
|
||||
PBHelperClient.convert(request.getInfo()),
|
||||
PBHelperClient.convertCacheFlags(request.getCacheFlags()));
|
||||
return ModifyCacheDirectiveResponseProto.newBuilder().build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -1210,14 +1210,14 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
throws ServiceException {
|
||||
try {
|
||||
CacheDirectiveInfo filter =
|
||||
PBHelper.convert(request.getFilter());
|
||||
PBHelperClient.convert(request.getFilter());
|
||||
BatchedEntries<CacheDirectiveEntry> entries =
|
||||
server.listCacheDirectives(request.getPrevId(), filter);
|
||||
ListCacheDirectivesResponseProto.Builder builder =
|
||||
ListCacheDirectivesResponseProto.newBuilder();
|
||||
builder.setHasMore(entries.hasMore());
|
||||
for (int i=0, n=entries.size(); i<n; i++) {
|
||||
builder.addElements(PBHelper.convert(entries.get(i)));
|
||||
builder.addElements(PBHelperClient.convert(entries.get(i)));
|
||||
}
|
||||
return builder.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -1229,7 +1229,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public AddCachePoolResponseProto addCachePool(RpcController controller,
|
||||
AddCachePoolRequestProto request) throws ServiceException {
|
||||
try {
|
||||
server.addCachePool(PBHelper.convert(request.getInfo()));
|
||||
server.addCachePool(PBHelperClient.convert(request.getInfo()));
|
||||
return AddCachePoolResponseProto.newBuilder().build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -1240,7 +1240,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public ModifyCachePoolResponseProto modifyCachePool(RpcController controller,
|
||||
ModifyCachePoolRequestProto request) throws ServiceException {
|
||||
try {
|
||||
server.modifyCachePool(PBHelper.convert(request.getInfo()));
|
||||
server.modifyCachePool(PBHelperClient.convert(request.getInfo()));
|
||||
return ModifyCachePoolResponseProto.newBuilder().build();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -1268,7 +1268,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
ListCachePoolsResponseProto.newBuilder();
|
||||
responseBuilder.setHasMore(entries.hasMore());
|
||||
for (int i=0, n=entries.size(); i<n; i++) {
|
||||
responseBuilder.addEntries(PBHelper.convert(entries.get(i)));
|
||||
responseBuilder.addEntries(PBHelperClient.convert(entries.get(i)));
|
||||
}
|
||||
return responseBuilder.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -1281,7 +1281,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
RpcController controller, ModifyAclEntriesRequestProto req)
|
||||
throws ServiceException {
|
||||
try {
|
||||
server.modifyAclEntries(req.getSrc(), PBHelper.convertAclEntry(req.getAclSpecList()));
|
||||
server.modifyAclEntries(req.getSrc(), PBHelperClient.convertAclEntry(req.getAclSpecList()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1294,7 +1294,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
throws ServiceException {
|
||||
try {
|
||||
server.removeAclEntries(req.getSrc(),
|
||||
PBHelper.convertAclEntry(req.getAclSpecList()));
|
||||
PBHelperClient.convertAclEntry(req.getAclSpecList()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1328,7 +1328,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public SetAclResponseProto setAcl(RpcController controller,
|
||||
SetAclRequestProto req) throws ServiceException {
|
||||
try {
|
||||
server.setAcl(req.getSrc(), PBHelper.convertAclEntry(req.getAclSpecList()));
|
||||
server.setAcl(req.getSrc(), PBHelperClient.convertAclEntry(req.getAclSpecList()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1339,7 +1339,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public GetAclStatusResponseProto getAclStatus(RpcController controller,
|
||||
GetAclStatusRequestProto req) throws ServiceException {
|
||||
try {
|
||||
return PBHelper.convert(server.getAclStatus(req.getSrc()));
|
||||
return PBHelperClient.convert(server.getAclStatus(req.getSrc()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1366,7 +1366,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
GetEZForPathResponseProto.newBuilder();
|
||||
final EncryptionZone ret = server.getEZForPath(req.getSrc());
|
||||
if (ret != null) {
|
||||
builder.setZone(PBHelper.convert(ret));
|
||||
builder.setZone(PBHelperClient.convert(ret));
|
||||
}
|
||||
return builder.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -1385,7 +1385,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
ListEncryptionZonesResponseProto.newBuilder();
|
||||
builder.setHasMore(entries.hasMore());
|
||||
for (int i=0; i<entries.size(); i++) {
|
||||
builder.addZones(PBHelper.convert(entries.get(i)));
|
||||
builder.addZones(PBHelperClient.convert(entries.get(i)));
|
||||
}
|
||||
return builder.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -1397,8 +1397,8 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public SetXAttrResponseProto setXAttr(RpcController controller,
|
||||
SetXAttrRequestProto req) throws ServiceException {
|
||||
try {
|
||||
server.setXAttr(req.getSrc(), PBHelper.convertXAttr(req.getXAttr()),
|
||||
PBHelper.convert(req.getFlag()));
|
||||
server.setXAttr(req.getSrc(), PBHelperClient.convertXAttr(req.getXAttr()),
|
||||
PBHelperClient.convert(req.getFlag()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1409,8 +1409,8 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public GetXAttrsResponseProto getXAttrs(RpcController controller,
|
||||
GetXAttrsRequestProto req) throws ServiceException {
|
||||
try {
|
||||
return PBHelper.convertXAttrsResponse(server.getXAttrs(req.getSrc(),
|
||||
PBHelper.convertXAttrs(req.getXAttrsList())));
|
||||
return PBHelperClient.convertXAttrsResponse(server.getXAttrs(req.getSrc(),
|
||||
PBHelperClient.convertXAttrs(req.getXAttrsList())));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1420,7 +1420,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public ListXAttrsResponseProto listXAttrs(RpcController controller,
|
||||
ListXAttrsRequestProto req) throws ServiceException {
|
||||
try {
|
||||
return PBHelper.convertListXAttrsResponse(server.listXAttrs(req.getSrc()));
|
||||
return PBHelperClient.convertListXAttrsResponse(server.listXAttrs(req.getSrc()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1430,7 +1430,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public RemoveXAttrResponseProto removeXAttr(RpcController controller,
|
||||
RemoveXAttrRequestProto req) throws ServiceException {
|
||||
try {
|
||||
server.removeXAttr(req.getSrc(), PBHelper.convertXAttr(req.getXAttr()));
|
||||
server.removeXAttr(req.getSrc(), PBHelperClient.convertXAttr(req.getXAttr()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1441,7 +1441,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public CheckAccessResponseProto checkAccess(RpcController controller,
|
||||
CheckAccessRequestProto req) throws ServiceException {
|
||||
try {
|
||||
server.checkAccess(req.getPath(), PBHelper.convert(req.getMode()));
|
||||
server.checkAccess(req.getPath(), PBHelperClient.convert(req.getMode()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
|
@ -1465,7 +1465,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
RpcController controller, GetStoragePolicyRequestProto request)
|
||||
throws ServiceException {
|
||||
try {
|
||||
BlockStoragePolicyProto policy = PBHelper.convert(server
|
||||
BlockStoragePolicyProto policy = PBHelperClient.convert(server
|
||||
.getStoragePolicy(request.getPath()));
|
||||
return GetStoragePolicyResponseProto.newBuilder()
|
||||
.setStoragePolicy(policy).build();
|
||||
|
@ -1486,7 +1486,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
return builder.build();
|
||||
}
|
||||
for (BlockStoragePolicy policy : policies) {
|
||||
builder.addPolicies(PBHelper.convert(policy));
|
||||
builder.addPolicies(PBHelperClient.convert(policy));
|
||||
}
|
||||
return builder.build();
|
||||
} catch (IOException e) {
|
||||
|
@ -1508,7 +1508,7 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements
|
|||
public GetEditsFromTxidResponseProto getEditsFromTxid(RpcController controller,
|
||||
GetEditsFromTxidRequestProto req) throws ServiceException {
|
||||
try {
|
||||
return PBHelper.convertEditsResponse(server.getEditsFromTxid(
|
||||
return PBHelperClient.convertEditsResponse(server.getEditsFromTxid(
|
||||
req.getTxid()));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
|
|
|
@ -256,7 +256,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
GetBlockLocationsResponseProto resp = rpcProxy.getBlockLocations(null,
|
||||
req);
|
||||
return resp.hasLocations() ?
|
||||
PBHelper.convert(resp.getLocations()) : null;
|
||||
PBHelperClient.convert(resp.getLocations()) : null;
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
public FsServerDefaults getServerDefaults() throws IOException {
|
||||
GetServerDefaultsRequestProto req = VOID_GET_SERVER_DEFAULT_REQUEST;
|
||||
try {
|
||||
return PBHelper
|
||||
return PBHelperClient
|
||||
.convert(rpcProxy.getServerDefaults(null, req).getServerDefaults());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -285,17 +285,17 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
IOException {
|
||||
CreateRequestProto.Builder builder = CreateRequestProto.newBuilder()
|
||||
.setSrc(src)
|
||||
.setMasked(PBHelper.convert(masked))
|
||||
.setMasked(PBHelperClient.convert(masked))
|
||||
.setClientName(clientName)
|
||||
.setCreateFlag(PBHelper.convertCreateFlag(flag))
|
||||
.setCreateFlag(PBHelperClient.convertCreateFlag(flag))
|
||||
.setCreateParent(createParent)
|
||||
.setReplication(replication)
|
||||
.setBlockSize(blockSize);
|
||||
builder.addAllCryptoProtocolVersion(PBHelper.convert(supportedVersions));
|
||||
builder.addAllCryptoProtocolVersion(PBHelperClient.convert(supportedVersions));
|
||||
CreateRequestProto req = builder.build();
|
||||
try {
|
||||
CreateResponseProto res = rpcProxy.create(null, req);
|
||||
return res.hasFs() ? PBHelper.convert(res.getFs()) : null;
|
||||
return res.hasFs() ? PBHelperClient.convert(res.getFs()) : null;
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -323,13 +323,13 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
DSQuotaExceededException, FileNotFoundException, SafeModeException,
|
||||
UnresolvedLinkException, IOException {
|
||||
AppendRequestProto req = AppendRequestProto.newBuilder().setSrc(src)
|
||||
.setClientName(clientName).setFlag(PBHelper.convertCreateFlag(flag))
|
||||
.setClientName(clientName).setFlag(PBHelperClient.convertCreateFlag(flag))
|
||||
.build();
|
||||
try {
|
||||
AppendResponseProto res = rpcProxy.append(null, req);
|
||||
LocatedBlock lastBlock = res.hasBlock() ? PBHelper
|
||||
LocatedBlock lastBlock = res.hasBlock() ? PBHelperClient
|
||||
.convert(res.getBlock()) : null;
|
||||
HdfsFileStatus stat = (res.hasStat()) ? PBHelper.convert(res.getStat())
|
||||
HdfsFileStatus stat = (res.hasStat()) ? PBHelperClient.convert(res.getStat())
|
||||
: null;
|
||||
return new LastBlockWithStatus(lastBlock, stat);
|
||||
} catch (ServiceException e) {
|
||||
|
@ -359,7 +359,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
UnresolvedLinkException, IOException {
|
||||
SetPermissionRequestProto req = SetPermissionRequestProto.newBuilder()
|
||||
.setSrc(src)
|
||||
.setPermission(PBHelper.convert(permission))
|
||||
.setPermission(PBHelperClient.convert(permission))
|
||||
.build();
|
||||
try {
|
||||
rpcProxy.setPermission(null, req);
|
||||
|
@ -416,7 +416,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
req.addAllFavoredNodes(Arrays.asList(favoredNodes));
|
||||
}
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.addBlock(null, req.build()).getBlock());
|
||||
return PBHelperClient.convert(rpcProxy.addBlock(null, req.build()).getBlock());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
.setClientName(clientName)
|
||||
.build();
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.getAdditionalDatanode(null, req)
|
||||
return PBHelperClient.convert(rpcProxy.getAdditionalDatanode(null, req)
|
||||
.getBlock());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -469,7 +469,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
@Override
|
||||
public void reportBadBlocks(LocatedBlock[] blocks) throws IOException {
|
||||
ReportBadBlocksRequestProto req = ReportBadBlocksRequestProto.newBuilder()
|
||||
.addAllBlocks(Arrays.asList(PBHelper.convertLocatedBlock(blocks)))
|
||||
.addAllBlocks(Arrays.asList(PBHelperClient.convertLocatedBlock(blocks)))
|
||||
.build();
|
||||
try {
|
||||
rpcProxy.reportBadBlocks(null, req);
|
||||
|
@ -552,7 +552,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
IOException {
|
||||
MkdirsRequestProto req = MkdirsRequestProto.newBuilder()
|
||||
.setSrc(src)
|
||||
.setMasked(PBHelper.convert(masked))
|
||||
.setMasked(PBHelperClient.convert(masked))
|
||||
.setCreateParent(createParent).build();
|
||||
|
||||
try {
|
||||
|
@ -574,7 +574,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
GetListingResponseProto result = rpcProxy.getListing(null, req);
|
||||
|
||||
if (result.hasDirList()) {
|
||||
return PBHelper.convert(result.getDirList());
|
||||
return PBHelperClient.convert(result.getDirList());
|
||||
}
|
||||
return null;
|
||||
} catch (ServiceException e) {
|
||||
|
@ -610,7 +610,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
@Override
|
||||
public long[] getStats() throws IOException {
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.getFsStats(null,
|
||||
return PBHelperClient.convert(rpcProxy.getFsStats(null,
|
||||
VOID_GET_FSSTATUS_REQUEST));
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -622,9 +622,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
throws IOException {
|
||||
GetDatanodeReportRequestProto req = GetDatanodeReportRequestProto
|
||||
.newBuilder()
|
||||
.setType(PBHelper.convert(type)).build();
|
||||
.setType(PBHelperClient.convert(type)).build();
|
||||
try {
|
||||
return PBHelper.convert(
|
||||
return PBHelperClient.convert(
|
||||
rpcProxy.getDatanodeReport(null, req).getDiList());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -636,9 +636,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
throws IOException {
|
||||
final GetDatanodeStorageReportRequestProto req
|
||||
= GetDatanodeStorageReportRequestProto.newBuilder()
|
||||
.setType(PBHelper.convert(type)).build();
|
||||
.setType(PBHelperClient.convert(type)).build();
|
||||
try {
|
||||
return PBHelper.convertDatanodeStorageReports(
|
||||
return PBHelperClient.convertDatanodeStorageReports(
|
||||
rpcProxy.getDatanodeStorageReport(null, req).getDatanodeStorageReportsList());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -662,7 +662,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
@Override
|
||||
public boolean setSafeMode(SafeModeAction action, boolean isChecked) throws IOException {
|
||||
SetSafeModeRequestProto req = SetSafeModeRequestProto.newBuilder()
|
||||
.setAction(PBHelper.convert(action)).setChecked(isChecked).build();
|
||||
.setAction(PBHelperClient.convert(action)).setChecked(isChecked).build();
|
||||
try {
|
||||
return rpcProxy.setSafeMode(null, req).getResult();
|
||||
} catch (ServiceException e) {
|
||||
|
@ -726,11 +726,11 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
@Override
|
||||
public RollingUpgradeInfo rollingUpgrade(RollingUpgradeAction action) throws IOException {
|
||||
final RollingUpgradeRequestProto r = RollingUpgradeRequestProto.newBuilder()
|
||||
.setAction(PBHelper.convert(action)).build();
|
||||
.setAction(PBHelperClient.convert(action)).build();
|
||||
try {
|
||||
final RollingUpgradeResponseProto proto = rpcProxy.rollingUpgrade(null, r);
|
||||
if (proto.hasRollingUpgradeInfo()) {
|
||||
return PBHelper.convert(proto.getRollingUpgradeInfo());
|
||||
return PBHelperClient.convert(proto.getRollingUpgradeInfo());
|
||||
}
|
||||
return null;
|
||||
} catch (ServiceException e) {
|
||||
|
@ -746,7 +746,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
if (cookie != null)
|
||||
req.setCookie(cookie);
|
||||
try {
|
||||
return PBHelper.convert(
|
||||
return PBHelperClient.convert(
|
||||
rpcProxy.listCorruptFileBlocks(null, req.build()).getCorrupt());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -772,7 +772,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
.setSrc(src).build();
|
||||
try {
|
||||
GetFileInfoResponseProto res = rpcProxy.getFileInfo(null, req);
|
||||
return res.hasFs() ? PBHelper.convert(res.getFs()) : null;
|
||||
return res.hasFs() ? PBHelperClient.convert(res.getFs()) : null;
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
try {
|
||||
GetFileLinkInfoResponseProto result = rpcProxy.getFileLinkInfo(null, req);
|
||||
return result.hasFs() ?
|
||||
PBHelper.convert(rpcProxy.getFileLinkInfo(null, req).getFs()) : null;
|
||||
PBHelperClient.convert(rpcProxy.getFileLinkInfo(null, req).getFs()) : null;
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
.setPath(path)
|
||||
.build();
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.getContentSummary(null, req)
|
||||
return PBHelperClient.convert(rpcProxy.getContentSummary(null, req)
|
||||
.getSummary());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -869,7 +869,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
CreateSymlinkRequestProto req = CreateSymlinkRequestProto.newBuilder()
|
||||
.setTarget(target)
|
||||
.setLink(link)
|
||||
.setDirPerm(PBHelper.convert(dirPerm))
|
||||
.setDirPerm(PBHelperClient.convert(dirPerm))
|
||||
.setCreateParent(createParent)
|
||||
.build();
|
||||
try {
|
||||
|
@ -901,7 +901,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
.setClientName(clientName)
|
||||
.build();
|
||||
try {
|
||||
return PBHelper.convert(
|
||||
return PBHelperClient.convert(
|
||||
rpcProxy.updateBlockForPipeline(null, req).getBlock());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -915,7 +915,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
.setClientName(clientName)
|
||||
.setOldBlock(PBHelperClient.convert(oldBlock))
|
||||
.setNewBlock(PBHelperClient.convert(newBlock))
|
||||
.addAllNewNodes(Arrays.asList(PBHelper.convert(newNodes)))
|
||||
.addAllNewNodes(Arrays.asList(PBHelperClient.convert(newNodes)))
|
||||
.addAllStorageIDs(storageIDs == null ? null : Arrays.asList(storageIDs))
|
||||
.build();
|
||||
try {
|
||||
|
@ -934,7 +934,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
.build();
|
||||
try {
|
||||
GetDelegationTokenResponseProto resp = rpcProxy.getDelegationToken(null, req);
|
||||
return resp.hasToken() ? PBHelper.convertDelegationToken(resp.getToken())
|
||||
return resp.hasToken() ? PBHelperClient.convertDelegationToken(resp.getToken())
|
||||
: null;
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -993,7 +993,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
GetDataEncryptionKeyResponseProto rsp = rpcProxy.getDataEncryptionKey(
|
||||
null, VOID_GET_DATA_ENCRYPTIONKEY_REQUEST);
|
||||
return rsp.hasDataEncryptionKey() ?
|
||||
PBHelper.convert(rsp.getDataEncryptionKey()) : null;
|
||||
PBHelperClient.convert(rsp.getDataEncryptionKey()) : null;
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -1090,7 +1090,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
.getSnapshottableDirListing(null, req);
|
||||
|
||||
if (result.hasSnapshottableDirList()) {
|
||||
return PBHelper.convert(result.getSnapshottableDirList());
|
||||
return PBHelperClient.convert(result.getSnapshottableDirList());
|
||||
}
|
||||
return null;
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1108,7 +1108,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
GetSnapshotDiffReportResponseProto result =
|
||||
rpcProxy.getSnapshotDiffReport(null, req);
|
||||
|
||||
return PBHelper.convert(result.getDiffReport());
|
||||
return PBHelperClient.convert(result.getDiffReport());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -1120,9 +1120,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
try {
|
||||
AddCacheDirectiveRequestProto.Builder builder =
|
||||
AddCacheDirectiveRequestProto.newBuilder().
|
||||
setInfo(PBHelper.convert(directive));
|
||||
setInfo(PBHelperClient.convert(directive));
|
||||
if (!flags.isEmpty()) {
|
||||
builder.setCacheFlags(PBHelper.convertCacheFlags(flags));
|
||||
builder.setCacheFlags(PBHelperClient.convertCacheFlags(flags));
|
||||
}
|
||||
return rpcProxy.addCacheDirective(null, builder.build()).getId();
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1136,9 +1136,9 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
try {
|
||||
ModifyCacheDirectiveRequestProto.Builder builder =
|
||||
ModifyCacheDirectiveRequestProto.newBuilder().
|
||||
setInfo(PBHelper.convert(directive));
|
||||
setInfo(PBHelperClient.convert(directive));
|
||||
if (!flags.isEmpty()) {
|
||||
builder.setCacheFlags(PBHelper.convertCacheFlags(flags));
|
||||
builder.setCacheFlags(PBHelperClient.convertCacheFlags(flags));
|
||||
}
|
||||
rpcProxy.modifyCacheDirective(null, builder.build());
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1169,7 +1169,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
|
||||
@Override
|
||||
public CacheDirectiveEntry get(int i) {
|
||||
return PBHelper.convert(response.getElements(i));
|
||||
return PBHelperClient.convert(response.getElements(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1195,7 +1195,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
rpcProxy.listCacheDirectives(null,
|
||||
ListCacheDirectivesRequestProto.newBuilder().
|
||||
setPrevId(prevId).
|
||||
setFilter(PBHelper.convert(filter)).
|
||||
setFilter(PBHelperClient.convert(filter)).
|
||||
build()));
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -1206,7 +1206,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
public void addCachePool(CachePoolInfo info) throws IOException {
|
||||
AddCachePoolRequestProto.Builder builder =
|
||||
AddCachePoolRequestProto.newBuilder();
|
||||
builder.setInfo(PBHelper.convert(info));
|
||||
builder.setInfo(PBHelperClient.convert(info));
|
||||
try {
|
||||
rpcProxy.addCachePool(null, builder.build());
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1218,7 +1218,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
public void modifyCachePool(CachePoolInfo req) throws IOException {
|
||||
ModifyCachePoolRequestProto.Builder builder =
|
||||
ModifyCachePoolRequestProto.newBuilder();
|
||||
builder.setInfo(PBHelper.convert(req));
|
||||
builder.setInfo(PBHelperClient.convert(req));
|
||||
try {
|
||||
rpcProxy.modifyCachePool(null, builder.build());
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1248,7 +1248,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
@Override
|
||||
public CachePoolEntry get(int i) {
|
||||
CachePoolEntryProto elem = proto.getEntries(i);
|
||||
return PBHelper.convert(elem);
|
||||
return PBHelperClient.convert(elem);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1280,7 +1280,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
throws IOException {
|
||||
ModifyAclEntriesRequestProto req = ModifyAclEntriesRequestProto
|
||||
.newBuilder().setSrc(src)
|
||||
.addAllAclSpec(PBHelper.convertAclEntryProto(aclSpec)).build();
|
||||
.addAllAclSpec(PBHelperClient.convertAclEntryProto(aclSpec)).build();
|
||||
try {
|
||||
rpcProxy.modifyAclEntries(null, req);
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1293,7 +1293,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
throws IOException {
|
||||
RemoveAclEntriesRequestProto req = RemoveAclEntriesRequestProto
|
||||
.newBuilder().setSrc(src)
|
||||
.addAllAclSpec(PBHelper.convertAclEntryProto(aclSpec)).build();
|
||||
.addAllAclSpec(PBHelperClient.convertAclEntryProto(aclSpec)).build();
|
||||
try {
|
||||
rpcProxy.removeAclEntries(null, req);
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1327,7 +1327,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
public void setAcl(String src, List<AclEntry> aclSpec) throws IOException {
|
||||
SetAclRequestProto req = SetAclRequestProto.newBuilder()
|
||||
.setSrc(src)
|
||||
.addAllAclSpec(PBHelper.convertAclEntryProto(aclSpec))
|
||||
.addAllAclSpec(PBHelperClient.convertAclEntryProto(aclSpec))
|
||||
.build();
|
||||
try {
|
||||
rpcProxy.setAcl(null, req);
|
||||
|
@ -1341,7 +1341,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
GetAclStatusRequestProto req = GetAclStatusRequestProto.newBuilder()
|
||||
.setSrc(src).build();
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.getAclStatus(null, req));
|
||||
return PBHelperClient.convert(rpcProxy.getAclStatus(null, req));
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -1375,7 +1375,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
final EncryptionZonesProtos.GetEZForPathResponseProto response =
|
||||
rpcProxy.getEZForPath(null, req);
|
||||
if (response.hasZone()) {
|
||||
return PBHelper.convert(response.getZone());
|
||||
return PBHelperClient.convert(response.getZone());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -1397,7 +1397,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
List<EncryptionZone> elements =
|
||||
Lists.newArrayListWithCapacity(response.getZonesCount());
|
||||
for (EncryptionZoneProto p : response.getZonesList()) {
|
||||
elements.add(PBHelper.convert(p));
|
||||
elements.add(PBHelperClient.convert(p));
|
||||
}
|
||||
return new BatchedListEntries<EncryptionZone>(elements,
|
||||
response.getHasMore());
|
||||
|
@ -1411,8 +1411,8 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
throws IOException {
|
||||
SetXAttrRequestProto req = SetXAttrRequestProto.newBuilder()
|
||||
.setSrc(src)
|
||||
.setXAttr(PBHelper.convertXAttrProto(xAttr))
|
||||
.setFlag(PBHelper.convert(flag))
|
||||
.setXAttr(PBHelperClient.convertXAttrProto(xAttr))
|
||||
.setFlag(PBHelperClient.convert(flag))
|
||||
.build();
|
||||
try {
|
||||
rpcProxy.setXAttr(null, req);
|
||||
|
@ -1427,11 +1427,11 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
GetXAttrsRequestProto.Builder builder = GetXAttrsRequestProto.newBuilder();
|
||||
builder.setSrc(src);
|
||||
if (xAttrs != null) {
|
||||
builder.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
|
||||
builder.addAllXAttrs(PBHelperClient.convertXAttrProto(xAttrs));
|
||||
}
|
||||
GetXAttrsRequestProto req = builder.build();
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.getXAttrs(null, req));
|
||||
return PBHelperClient.convert(rpcProxy.getXAttrs(null, req));
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -1444,7 +1444,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
builder.setSrc(src);
|
||||
ListXAttrsRequestProto req = builder.build();
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.listXAttrs(null, req));
|
||||
return PBHelperClient.convert(rpcProxy.listXAttrs(null, req));
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -1454,7 +1454,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
public void removeXAttr(String src, XAttr xAttr) throws IOException {
|
||||
RemoveXAttrRequestProto req = RemoveXAttrRequestProto
|
||||
.newBuilder().setSrc(src)
|
||||
.setXAttr(PBHelper.convertXAttrProto(xAttr)).build();
|
||||
.setXAttr(PBHelperClient.convertXAttrProto(xAttr)).build();
|
||||
try {
|
||||
rpcProxy.removeXAttr(null, req);
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1465,7 +1465,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
@Override
|
||||
public void checkAccess(String path, FsAction mode) throws IOException {
|
||||
CheckAccessRequestProto req = CheckAccessRequestProto.newBuilder()
|
||||
.setPath(path).setMode(PBHelper.convert(mode)).build();
|
||||
.setPath(path).setMode(PBHelperClient.convert(mode)).build();
|
||||
try {
|
||||
rpcProxy.checkAccess(null, req);
|
||||
} catch (ServiceException e) {
|
||||
|
@ -1490,7 +1490,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
GetStoragePolicyRequestProto request = GetStoragePolicyRequestProto
|
||||
.newBuilder().setPath(path).build();
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.getStoragePolicy(null, request)
|
||||
return PBHelperClient.convert(rpcProxy.getStoragePolicy(null, request)
|
||||
.getStoragePolicy());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
|
@ -1502,7 +1502,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
try {
|
||||
GetStoragePoliciesResponseProto response = rpcProxy
|
||||
.getStoragePolicies(null, VOID_GET_STORAGE_POLICIES_REQUEST);
|
||||
return PBHelper.convertStoragePolicies(response.getPoliciesList());
|
||||
return PBHelperClient.convertStoragePolicies(response.getPoliciesList());
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
@ -1523,7 +1523,7 @@ public class ClientNamenodeProtocolTranslatorPB implements
|
|||
GetEditsFromTxidRequestProto req = GetEditsFromTxidRequestProto.newBuilder()
|
||||
.setTxid(txid).build();
|
||||
try {
|
||||
return PBHelper.convert(rpcProxy.getEditsFromTxid(null, req));
|
||||
return PBHelperClient.convert(rpcProxy.getEditsFromTxid(null, req));
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class DatanodeProtocolClientSideTranslatorPB implements
|
|||
.setXmitsInProgress(xmitsInProgress).setXceiverCount(xceiverCount)
|
||||
.setFailedVolumes(failedVolumes)
|
||||
.setRequestFullBlockReportLease(requestFullBlockReportLease);
|
||||
builder.addAllReports(PBHelper.convertStorageReports(reports));
|
||||
builder.addAllReports(PBHelperClient.convertStorageReports(reports));
|
||||
if (cacheCapacity != 0) {
|
||||
builder.setCacheCapacity(cacheCapacity);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public class DatanodeProtocolClientSideTranslatorPB implements
|
|||
}
|
||||
RollingUpgradeStatus rollingUpdateStatus = null;
|
||||
if (resp.hasRollingUpgradeStatus()) {
|
||||
rollingUpdateStatus = PBHelper.convert(resp.getRollingUpgradeStatus());
|
||||
rollingUpdateStatus = PBHelperClient.convert(resp.getRollingUpgradeStatus());
|
||||
}
|
||||
return new HeartbeatResponse(cmds, PBHelper.convert(resp.getHaStatus()),
|
||||
rollingUpdateStatus, resp.getFullBlockReportLeaseId());
|
||||
|
@ -183,7 +183,7 @@ public class DatanodeProtocolClientSideTranslatorPB implements
|
|||
|
||||
for (StorageBlockReport r : reports) {
|
||||
StorageBlockReportProto.Builder reportBuilder = StorageBlockReportProto
|
||||
.newBuilder().setStorage(PBHelper.convert(r.getStorage()));
|
||||
.newBuilder().setStorage(PBHelperClient.convert(r.getStorage()));
|
||||
BlockListAsLongs blocks = r.getBlocks();
|
||||
if (useBlocksBuffer) {
|
||||
reportBuilder.setNumberOfBlocks(blocks.getNumberOfBlocks());
|
||||
|
@ -240,7 +240,7 @@ public class DatanodeProtocolClientSideTranslatorPB implements
|
|||
StorageReceivedDeletedBlocksProto.Builder repBuilder =
|
||||
StorageReceivedDeletedBlocksProto.newBuilder();
|
||||
repBuilder.setStorageUuid(storageBlock.getStorage().getStorageID()); // Set for wire compatibility.
|
||||
repBuilder.setStorage(PBHelper.convert(storageBlock.getStorage()));
|
||||
repBuilder.setStorage(PBHelperClient.convert(storageBlock.getStorage()));
|
||||
for (ReceivedDeletedBlockInfo rdBlock : storageBlock.getBlocks()) {
|
||||
repBuilder.addBlocks(PBHelper.convert(rdBlock));
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ public class DatanodeProtocolClientSideTranslatorPB implements
|
|||
ReportBadBlocksRequestProto.Builder builder = ReportBadBlocksRequestProto
|
||||
.newBuilder();
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
builder.addBlocks(i, PBHelper.convert(blocks[i]));
|
||||
builder.addBlocks(i, PBHelperClient.convert(blocks[i]));
|
||||
}
|
||||
ReportBadBlocksRequestProto req = builder.build();
|
||||
try {
|
||||
|
|
|
@ -105,7 +105,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
HeartbeatRequestProto request) throws ServiceException {
|
||||
HeartbeatResponse response;
|
||||
try {
|
||||
final StorageReport[] report = PBHelper.convertStorageReports(
|
||||
final StorageReport[] report = PBHelperClient.convertStorageReports(
|
||||
request.getReportsList());
|
||||
VolumeFailureSummary volumeFailureSummary =
|
||||
request.hasVolumeFailureSummary() ? PBHelper.convertVolumeFailureSummary(
|
||||
|
@ -132,7 +132,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
RollingUpgradeStatus rollingUpdateStatus = response
|
||||
.getRollingUpdateStatus();
|
||||
if (rollingUpdateStatus != null) {
|
||||
builder.setRollingUpgradeStatus(PBHelper
|
||||
builder.setRollingUpgradeStatus(PBHelperClient
|
||||
.convertRollingUpgradeStatus(rollingUpdateStatus));
|
||||
}
|
||||
builder.setFullBlockReportLeaseId(response.getFullBlockReportLeaseId());
|
||||
|
@ -157,7 +157,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
} else {
|
||||
blocks = BlockListAsLongs.decodeLongs(s.getBlocksList());
|
||||
}
|
||||
report[index++] = new StorageBlockReport(PBHelper.convert(s.getStorage()),
|
||||
report[index++] = new StorageBlockReport(PBHelperClient.convert(s.getStorage()),
|
||||
blocks);
|
||||
}
|
||||
try {
|
||||
|
@ -214,7 +214,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
}
|
||||
if (sBlock.hasStorage()) {
|
||||
info[i] = new StorageReceivedDeletedBlocks(
|
||||
PBHelper.convert(sBlock.getStorage()), rdBlocks);
|
||||
PBHelperClient.convert(sBlock.getStorage()), rdBlocks);
|
||||
} else {
|
||||
info[i] = new StorageReceivedDeletedBlocks(sBlock.getStorageUuid(), rdBlocks);
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
List<LocatedBlockProto> lbps = request.getBlocksList();
|
||||
LocatedBlock [] blocks = new LocatedBlock [lbps.size()];
|
||||
for(int i=0; i<lbps.size(); i++) {
|
||||
blocks[i] = PBHelper.convert(lbps.get(i));
|
||||
blocks[i] = PBHelperClient.convert(lbps.get(i));
|
||||
}
|
||||
try {
|
||||
impl.reportBadBlocks(blocks);
|
||||
|
@ -276,7 +276,7 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
|||
List<DatanodeIDProto> dnprotos = request.getNewTaragetsList();
|
||||
DatanodeID[] dns = new DatanodeID[dnprotos.size()];
|
||||
for (int i = 0; i < dnprotos.size(); i++) {
|
||||
dns[i] = PBHelper.convert(dnprotos.get(i));
|
||||
dns[i] = PBHelperClient.convert(dnprotos.get(i));
|
||||
}
|
||||
final List<String> sidprotos = request.getNewTargetStoragesList();
|
||||
final String[] storageIDs = sidprotos.toArray(new String[sidprotos.size()]);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class InterDatanodeProtocolServerSideTranslatorPB implements
|
|||
} else {
|
||||
return InitReplicaRecoveryResponseProto.newBuilder()
|
||||
.setReplicaFound(true)
|
||||
.setBlock(PBHelper.convert(r))
|
||||
.setBlock(PBHelperClient.convert(r))
|
||||
.setState(PBHelper.convert(r.getOriginalReplicaState())).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class JournalProtocolTranslatorPB implements ProtocolMetaInterface,
|
|||
.setEpoch(epoch)
|
||||
.setFirstTxnId(firstTxnId)
|
||||
.setNumTxns(numTxns)
|
||||
.setRecords(PBHelper.getByteString(records))
|
||||
.setRecords(PBHelperClient.getByteString(records))
|
||||
.build();
|
||||
try {
|
||||
rpcProxy.journal(NULL_CONTROLLER, req);
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.io.IOException;
|
|||
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.VersionRequestProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.VersionResponseProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.EndCheckpointRequestProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.EndCheckpointResponseProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.ErrorReportRequestProto;
|
||||
|
@ -79,7 +78,7 @@ public class NamenodeProtocolServerSideTranslatorPB implements
|
|||
@Override
|
||||
public GetBlocksResponseProto getBlocks(RpcController unused,
|
||||
GetBlocksRequestProto request) throws ServiceException {
|
||||
DatanodeInfo dnInfo = new DatanodeInfo(PBHelper.convert(request
|
||||
DatanodeInfo dnInfo = new DatanodeInfo(PBHelperClient.convert(request
|
||||
.getDatanode()));
|
||||
BlocksWithLocations blocks;
|
||||
try {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,6 +25,7 @@ import org.apache.hadoop.classification.InterfaceAudience;
|
|||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
import org.apache.hadoop.hdfs.protocolPB.JournalProtocolPB;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol;
|
||||
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos;
|
||||
import org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos.AcceptRecoveryRequestProto;
|
||||
|
@ -161,7 +162,7 @@ public class QJournalProtocolTranslatorPB implements ProtocolMetaInterface,
|
|||
.setSegmentTxnId(segmentTxId)
|
||||
.setFirstTxnId(firstTxnId)
|
||||
.setNumTxns(numTxns)
|
||||
.setRecords(PBHelper.getByteString(records))
|
||||
.setRecords(PBHelperClient.getByteString(records))
|
||||
.build();
|
||||
try {
|
||||
rpcProxy.journal(NULL_CONTROLLER, req);
|
||||
|
|
|
@ -65,7 +65,7 @@ import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
|
|||
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.CacheDirectiveInfoProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.CachePoolInfoProto;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.CacheReplicationMonitor;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor;
|
||||
|
@ -1048,7 +1048,7 @@ public final class CacheManager {
|
|||
Expiration expiry = info.getExpiration();
|
||||
if (expiry != null) {
|
||||
assert (!expiry.isRelative());
|
||||
b.setExpiration(PBHelper.convert(expiry));
|
||||
b.setExpiration(PBHelperClient.convert(expiry));
|
||||
}
|
||||
|
||||
directives.add(b.build());
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.hadoop.hdfs.XAttrHelper;
|
|||
import org.apache.hadoop.hdfs.protocol.EncryptionZone;
|
||||
import org.apache.hadoop.hdfs.protocol.SnapshotAccessControlException;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -305,7 +305,7 @@ public class EncryptionZoneManager {
|
|||
}
|
||||
|
||||
final HdfsProtos.ZoneEncryptionInfoProto proto =
|
||||
PBHelper.convert(suite, version, keyName);
|
||||
PBHelperClient.convert(suite, version, keyName);
|
||||
final XAttr ezXAttr = XAttrHelper
|
||||
.buildXAttr(CRYPTO_XATTR_ENCRYPTION_ZONE, proto.toByteArray());
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.apache.hadoop.hdfs.DFSConfigKeys;
|
|||
import org.apache.hadoop.hdfs.XAttrHelper;
|
||||
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.apache.hadoop.security.AccessControlException;
|
||||
|
||||
|
@ -284,7 +283,7 @@ class FSDirXAttrOp {
|
|||
HdfsProtos.ZoneEncryptionInfoProto.parseFrom(xattr.getValue());
|
||||
fsd.ezManager.addEncryptionZone(inode.getId(),
|
||||
PBHelperClient.convert(ezProto.getSuite()),
|
||||
PBHelper.convert(ezProto.getCryptoProtocolVersion()),
|
||||
PBHelperClient.convert(ezProto.getCryptoProtocolVersion()),
|
||||
ezProto.getKeyName());
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
|||
import org.apache.hadoop.hdfs.protocol.QuotaExceededException;
|
||||
import org.apache.hadoop.hdfs.protocol.SnapshotAccessControlException;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
|
||||
|
@ -1134,7 +1133,7 @@ public class FSDirectory implements Closeable {
|
|||
xattr.getValue());
|
||||
ezManager.unprotectedAddEncryptionZone(inode.getId(),
|
||||
PBHelperClient.convert(ezProto.getSuite()),
|
||||
PBHelper.convert(ezProto.getCryptoProtocolVersion()),
|
||||
PBHelperClient.convert(ezProto.getCryptoProtocolVersion()),
|
||||
ezProto.getKeyName());
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
NameNode.LOG.warn("Error parsing protocol buffer of " +
|
||||
|
@ -1261,7 +1260,7 @@ public class FSDirectory implements Closeable {
|
|||
throws IOException {
|
||||
// Make the PB for the xattr
|
||||
final HdfsProtos.PerFileEncryptionInfoProto proto =
|
||||
PBHelper.convertPerFileEncInfo(info);
|
||||
PBHelperClient.convertPerFileEncInfo(info);
|
||||
final byte[] protoBytes = proto.toByteArray();
|
||||
final XAttr fileEncryptionAttr =
|
||||
XAttrHelper.buildXAttr(CRYPTO_XATTR_FILE_ENCRYPTION_INFO, protoBytes);
|
||||
|
@ -1327,7 +1326,7 @@ public class FSDirectory implements Closeable {
|
|||
HdfsProtos.PerFileEncryptionInfoProto fileProto =
|
||||
HdfsProtos.PerFileEncryptionInfoProto.parseFrom(
|
||||
fileXAttr.getValue());
|
||||
return PBHelper.convert(fileProto, suite, version, keyName);
|
||||
return PBHelperClient.convert(fileProto, suite, version, keyName);
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
throw new IOException("Could not parse file encryption info for " +
|
||||
"inode " + inode, e);
|
||||
|
|
|
@ -105,7 +105,7 @@ import org.apache.hadoop.hdfs.protocol.LayoutVersion;
|
|||
import org.apache.hadoop.hdfs.protocol.LayoutVersion.Feature;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.EditLogProtos.AclEditLogProto;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.EditLogProtos.XAttrEditLogProto;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
||||
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
|
||||
import org.apache.hadoop.hdfs.util.XMLUtils;
|
||||
|
@ -410,7 +410,7 @@ public abstract class FSEditLogOp {
|
|||
return null;
|
||||
}
|
||||
XAttrEditLogProto proto = XAttrEditLogProto.parseDelimitedFrom(in);
|
||||
return PBHelper.convertXAttrs(proto.getXAttrsList());
|
||||
return PBHelperClient.convertXAttrs(proto.getXAttrsList());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -554,7 +554,7 @@ public abstract class FSEditLogOp {
|
|||
if (this.opCode == OP_ADD) {
|
||||
AclEditLogUtil.write(aclEntries, out);
|
||||
XAttrEditLogProto.Builder b = XAttrEditLogProto.newBuilder();
|
||||
b.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
|
||||
b.addAllXAttrs(PBHelperClient.convertXAttrProto(xAttrs));
|
||||
b.build().writeDelimitedTo(out);
|
||||
FSImageSerialization.writeString(clientName,out);
|
||||
FSImageSerialization.writeString(clientMachine,out);
|
||||
|
@ -1631,7 +1631,7 @@ public abstract class FSEditLogOp {
|
|||
permissions.write(out);
|
||||
AclEditLogUtil.write(aclEntries, out);
|
||||
XAttrEditLogProto.Builder b = XAttrEditLogProto.newBuilder();
|
||||
b.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
|
||||
b.addAllXAttrs(PBHelperClient.convertXAttrProto(xAttrs));
|
||||
b.build().writeDelimitedTo(out);
|
||||
}
|
||||
|
||||
|
@ -4158,7 +4158,7 @@ public abstract class FSEditLogOp {
|
|||
void readFields(DataInputStream in, int logVersion) throws IOException {
|
||||
XAttrEditLogProto p = XAttrEditLogProto.parseDelimitedFrom(in);
|
||||
src = p.getSrc();
|
||||
xAttrs = PBHelper.convertXAttrs(p.getXAttrsList());
|
||||
xAttrs = PBHelperClient.convertXAttrs(p.getXAttrsList());
|
||||
readRpcIds(in, logVersion);
|
||||
}
|
||||
|
||||
|
@ -4168,7 +4168,7 @@ public abstract class FSEditLogOp {
|
|||
if (src != null) {
|
||||
b.setSrc(src);
|
||||
}
|
||||
b.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
|
||||
b.addAllXAttrs(PBHelperClient.convertXAttrProto(xAttrs));
|
||||
b.build().writeDelimitedTo(out);
|
||||
// clientId and callId
|
||||
writeRpcIds(rpcClientId, rpcCallId, out);
|
||||
|
@ -4211,7 +4211,7 @@ public abstract class FSEditLogOp {
|
|||
void readFields(DataInputStream in, int logVersion) throws IOException {
|
||||
XAttrEditLogProto p = XAttrEditLogProto.parseDelimitedFrom(in);
|
||||
src = p.getSrc();
|
||||
xAttrs = PBHelper.convertXAttrs(p.getXAttrsList());
|
||||
xAttrs = PBHelperClient.convertXAttrs(p.getXAttrsList());
|
||||
readRpcIds(in, logVersion);
|
||||
}
|
||||
|
||||
|
@ -4221,7 +4221,7 @@ public abstract class FSEditLogOp {
|
|||
if (src != null) {
|
||||
b.setSrc(src);
|
||||
}
|
||||
b.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
|
||||
b.addAllXAttrs(PBHelperClient.convertXAttrProto(xAttrs));
|
||||
b.build().writeDelimitedTo(out);
|
||||
// clientId and callId
|
||||
writeRpcIds(rpcClientId, rpcCallId, out);
|
||||
|
@ -4267,7 +4267,7 @@ public abstract class FSEditLogOp {
|
|||
throw new IOException("Failed to read fields from SetAclOp");
|
||||
}
|
||||
src = p.getSrc();
|
||||
aclEntries = PBHelper.convertAclEntry(p.getEntriesList());
|
||||
aclEntries = PBHelperClient.convertAclEntry(p.getEntriesList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4275,7 +4275,7 @@ public abstract class FSEditLogOp {
|
|||
AclEditLogProto.Builder b = AclEditLogProto.newBuilder();
|
||||
if (src != null)
|
||||
b.setSrc(src);
|
||||
b.addAllEntries(PBHelper.convertAclEntryProto(aclEntries));
|
||||
b.addAllEntries(PBHelperClient.convertAclEntryProto(aclEntries));
|
||||
b.build().writeDelimitedTo(out);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.apache.hadoop.fs.XAttr;
|
|||
import org.apache.hadoop.hdfs.protocol.Block;
|
||||
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoContiguous;
|
||||
|
@ -337,7 +336,7 @@ public final class FSImageFormatPBINode {
|
|||
BlockInfo[] blocks = new BlockInfo[bp.size()];
|
||||
for (int i = 0, e = bp.size(); i < e; ++i) {
|
||||
blocks[i] =
|
||||
new BlockInfoContiguous(PBHelper.convert(bp.get(i)), replication);
|
||||
new BlockInfoContiguous(PBHelperClient.convert(bp.get(i)), replication);
|
||||
}
|
||||
final PermissionStatus permissions = loadPermission(f.getPermission(),
|
||||
parent.getLoaderContext().getStringTable());
|
||||
|
@ -447,7 +446,7 @@ public final class FSImageFormatPBINode {
|
|||
XATTR_NAMESPACE_EXT_OFFSET);
|
||||
xAttrCompactBuilder.setName(v);
|
||||
if (a.getValue() != null) {
|
||||
xAttrCompactBuilder.setValue(PBHelper.getByteString(a.getValue()));
|
||||
xAttrCompactBuilder.setValue(PBHelperClient.getByteString(a.getValue()));
|
||||
}
|
||||
b.addXAttrs(xAttrCompactBuilder.build());
|
||||
}
|
||||
|
@ -636,7 +635,7 @@ public final class FSImageFormatPBINode {
|
|||
|
||||
if (n.getBlocks() != null) {
|
||||
for (Block block : n.getBlocks()) {
|
||||
b.addBlocks(PBHelper.convert(block));
|
||||
b.addBlocks(PBHelperClient.convert(block));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.hadoop.fs.StorageType;
|
|||
import org.apache.hadoop.hdfs.protocol.Block;
|
||||
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||
import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
||||
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoContiguous;
|
||||
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
|
||||
|
@ -244,7 +244,7 @@ public class FSImageFormatPBSnapshot {
|
|||
List<BlockProto> bpl = pbf.getBlocksList();
|
||||
BlockInfo[] blocks = new BlockInfo[bpl.size()];
|
||||
for(int j = 0, e = bpl.size(); j < e; ++j) {
|
||||
Block blk = PBHelper.convert(bpl.get(j));
|
||||
Block blk = PBHelperClient.convert(bpl.get(j));
|
||||
BlockInfo storedBlock = bm.getStoredBlock(blk);
|
||||
if(storedBlock == null) {
|
||||
storedBlock = bm.addBlockCollection(
|
||||
|
@ -524,7 +524,7 @@ public class FSImageFormatPBSnapshot {
|
|||
.setFileSize(diff.getFileSize());
|
||||
if(diff.getBlocks() != null) {
|
||||
for(Block block : diff.getBlocks()) {
|
||||
fb.addBlocks(PBHelper.convert(block));
|
||||
fb.addBlocks(PBHelperClient.convert(block));
|
||||
}
|
||||
}
|
||||
INodeFileAttributes copy = diff.snapshotINode;
|
||||
|
|
|
@ -154,7 +154,7 @@ public class TestPBHelper {
|
|||
public void testConvertDatanodeID() {
|
||||
DatanodeID dn = DFSTestUtil.getLocalDatanodeID();
|
||||
DatanodeIDProto dnProto = PBHelperClient.convert(dn);
|
||||
DatanodeID dn2 = PBHelper.convert(dnProto);
|
||||
DatanodeID dn2 = PBHelperClient.convert(dnProto);
|
||||
compare(dn, dn2);
|
||||
}
|
||||
|
||||
|
@ -176,8 +176,8 @@ public class TestPBHelper {
|
|||
@Test
|
||||
public void testConvertBlock() {
|
||||
Block b = new Block(1, 100, 3);
|
||||
BlockProto bProto = PBHelper.convert(b);
|
||||
Block b2 = PBHelper.convert(bProto);
|
||||
BlockProto bProto = PBHelperClient.convert(b);
|
||||
Block b2 = PBHelperClient.convert(bProto);
|
||||
assertEquals(b, b2);
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ public class TestPBHelper {
|
|||
"identifier".getBytes(), "password".getBytes(), new Text("kind"),
|
||||
new Text("service"));
|
||||
TokenProto tokenProto = PBHelperClient.convert(token);
|
||||
Token<BlockTokenIdentifier> token2 = PBHelper.convert(tokenProto);
|
||||
Token<BlockTokenIdentifier> token2 = PBHelperClient.convert(tokenProto);
|
||||
compare(token, token2);
|
||||
}
|
||||
|
||||
|
@ -489,16 +489,16 @@ public class TestPBHelper {
|
|||
@Test
|
||||
public void testConvertLocatedBlock() {
|
||||
LocatedBlock lb = createLocatedBlock();
|
||||
LocatedBlockProto lbProto = PBHelper.convert(lb);
|
||||
LocatedBlock lb2 = PBHelper.convert(lbProto);
|
||||
LocatedBlockProto lbProto = PBHelperClient.convert(lb);
|
||||
LocatedBlock lb2 = PBHelperClient.convert(lbProto);
|
||||
compare(lb,lb2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertLocatedBlockNoStorageMedia() {
|
||||
LocatedBlock lb = createLocatedBlockNoStorageMedia();
|
||||
LocatedBlockProto lbProto = PBHelper.convert(lb);
|
||||
LocatedBlock lb2 = PBHelper.convert(lbProto);
|
||||
LocatedBlockProto lbProto = PBHelperClient.convert(lb);
|
||||
LocatedBlock lb2 = PBHelperClient.convert(lbProto);
|
||||
compare(lb,lb2);
|
||||
}
|
||||
|
||||
|
@ -508,8 +508,8 @@ public class TestPBHelper {
|
|||
for (int i=0;i<3;i++) {
|
||||
lbl.add(createLocatedBlock());
|
||||
}
|
||||
List<LocatedBlockProto> lbpl = PBHelper.convertLocatedBlock2(lbl);
|
||||
List<LocatedBlock> lbl2 = PBHelper.convertLocatedBlock(lbpl);
|
||||
List<LocatedBlockProto> lbpl = PBHelperClient.convertLocatedBlock2(lbl);
|
||||
List<LocatedBlock> lbl2 = PBHelperClient.convertLocatedBlock(lbpl);
|
||||
assertEquals(lbl.size(), lbl2.size());
|
||||
for (int i=0;i<lbl.size();i++) {
|
||||
compare(lbl.get(i), lbl2.get(2));
|
||||
|
@ -522,8 +522,8 @@ public class TestPBHelper {
|
|||
for (int i=0;i<3;i++) {
|
||||
lbl[i] = createLocatedBlock();
|
||||
}
|
||||
LocatedBlockProto [] lbpl = PBHelper.convertLocatedBlock(lbl);
|
||||
LocatedBlock [] lbl2 = PBHelper.convertLocatedBlock(lbpl);
|
||||
LocatedBlockProto [] lbpl = PBHelperClient.convertLocatedBlock(lbl);
|
||||
LocatedBlock [] lbl2 = PBHelperClient.convertLocatedBlock(lbpl);
|
||||
assertEquals(lbl.length, lbl2.length);
|
||||
for (int i=0;i<lbl.length;i++) {
|
||||
compare(lbl[i], lbl2[i]);
|
||||
|
@ -551,8 +551,8 @@ public class TestPBHelper {
|
|||
DatanodeStorage dns1 = new DatanodeStorage(
|
||||
"id1", DatanodeStorage.State.NORMAL, StorageType.SSD);
|
||||
|
||||
DatanodeStorageProto proto = PBHelper.convert(dns1);
|
||||
DatanodeStorage dns2 = PBHelper.convert(proto);
|
||||
DatanodeStorageProto proto = PBHelperClient.convert(dns1);
|
||||
DatanodeStorage dns2 = PBHelperClient.convert(proto);
|
||||
compare(dns1, dns2);
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ public class TestPBHelper {
|
|||
.setPermission(FsAction.NONE)
|
||||
.build() };
|
||||
AclEntry[] actual = Lists.newArrayList(
|
||||
PBHelper.convertAclEntry(PBHelper.convertAclEntryProto(Lists
|
||||
PBHelperClient.convertAclEntry(PBHelperClient.convertAclEntryProto(Lists
|
||||
.newArrayList(e1, e2, e3)))).toArray(new AclEntry[0]);
|
||||
Assert.assertArrayEquals(expected, actual);
|
||||
}
|
||||
|
@ -637,6 +637,6 @@ public class TestPBHelper {
|
|||
.setType(AclEntryType.OTHER).build();
|
||||
AclStatus s = new AclStatus.Builder().owner("foo").group("bar").addEntry(e)
|
||||
.build();
|
||||
Assert.assertEquals(s, PBHelper.convert(PBHelper.convert(s)));
|
||||
Assert.assertEquals(s, PBHelperClient.convert(PBHelperClient.convert(s)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue