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.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 @@ private void opReadBlock() throws IOException {
|
||||
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 @@ private void opReadBlock() throws IOException {
|
||||
/** 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 @@ private void opWriteBlock(DataInputStream in) throws IOException {
|
||||
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 @@ private void opWriteBlock(DataInputStream in) throws IOException {
|
||||
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 @@ private void opRequestShortCircuitFds(DataInputStream in) throws IOException {
|
||||
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 @@ private void opReleaseShortCircuitFds(DataInputStream in)
|
||||
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 @@ private void opReplaceBlock(DataInputStream in) throws IOException {
|
||||
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 @@ private void opCopyBlock(DataInputStream in) throws IOException {
|
||||
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 @@ private void opBlockChecksum(DataInputStream in) throws IOException {
|
||||
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 GetBlockLocalPathInfoResponseProto getBlockLocalPathInfo(
|
||||
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 GetDatanodeInfoResponseProto getDatanodeInfo(RpcController unused,
|
||||
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 @@
|
||||
|
||||
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 @@
|
||||
@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 GetBlockLocationsResponseProto getBlockLocations(
|
||||
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 GetServerDefaultsResponseProto getServerDefaults(
|
||||
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 CreateResponseProto create(RpcController controller,
|
||||
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 AppendResponseProto append(RpcController controller,
|
||||
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 SetReplicationResponseProto setReplication(RpcController controller,
|
||||
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 AddBlockResponseProto addBlock(RpcController controller,
|
||||
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 GetAdditionalDatanodeResponseProto getAdditionalDatanode(
|
||||
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(
|
||||
new DatanodeInfoProto[excludesList.size()])),
|
||||
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,8 +548,8 @@ public ReportBadBlocksResponseProto reportBadBlocks(RpcController controller,
|
||||
ReportBadBlocksRequestProto req) throws ServiceException {
|
||||
try {
|
||||
List<LocatedBlockProto> bl = req.getBlocksList();
|
||||
server.reportBadBlocks(PBHelper.convertLocatedBlock(
|
||||
bl.toArray(new LocatedBlockProto[bl.size()])));
|
||||
server.reportBadBlocks(PBHelperClient.convertLocatedBlock(
|
||||
bl.toArray(new LocatedBlockProto[bl.size()])));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
@ -620,7 +620,7 @@ public MkdirsResponseProto mkdirs(RpcController controller,
|
||||
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 GetListingResponseProto getListing(RpcController controller,
|
||||
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 RestoreFailedStorageResponseProto restoreFailedStorage(
|
||||
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 GetDatanodeReportResponseProto getDatanodeReport(
|
||||
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 GetDatanodeStorageReportResponseProto getDatanodeStorageReport(
|
||||
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 GetPreferredBlockSizeResponseProto getPreferredBlockSize(
|
||||
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 RollingUpgradeResponseProto rollingUpgrade(RpcController controller,
|
||||
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 ListCorruptFileBlocksResponseProto listCorruptFileBlocks(
|
||||
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 GetFileInfoResponseProto getFileInfo(RpcController controller,
|
||||
|
||||
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 GetFileLinkInfoResponseProto getFileLinkInfo(RpcController controller,
|
||||
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 GetContentSummaryResponseProto getContentSummary(
|
||||
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 CreateSymlinkResponseProto createSymlink(RpcController controller,
|
||||
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 UpdateBlockForPipelineResponseProto updateBlockForPipeline(
|
||||
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 UpdatePipelineResponseProto updatePipeline(RpcController controller,
|
||||
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 RenewDelegationTokenResponseProto renewDelegationToken(
|
||||
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 CancelDelegationTokenResponseProto cancelDelegationToken(
|
||||
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 GetDataEncryptionKeyResponseProto getDataEncryptionKey(
|
||||
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 GetSnapshottableDirListingResponseProto getSnapshottableDirListing(
|
||||
.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 GetSnapshotDiffReportResponseProto getSnapshotDiffReport(
|
||||
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 AddCacheDirectiveResponseProto addCacheDirective(
|
||||
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 ModifyCacheDirectiveResponseProto modifyCacheDirective(
|
||||
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 ListCacheDirectivesResponseProto listCacheDirectives(
|
||||
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 ListCacheDirectivesResponseProto listCacheDirectives(
|
||||
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 AddCachePoolResponseProto addCachePool(RpcController controller,
|
||||
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 ListCachePoolsResponseProto listCachePools(RpcController controller,
|
||||
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 ModifyAclEntriesResponseProto modifyAclEntries(
|
||||
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 RemoveAclEntriesResponseProto removeAclEntries(
|
||||
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 RemoveAclResponseProto removeAcl(RpcController controller,
|
||||
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 SetAclResponseProto setAcl(RpcController controller,
|
||||
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 GetEZForPathResponseProto getEZForPath(
|
||||
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 ListEncryptionZonesResponseProto listEncryptionZones(
|
||||
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 ListEncryptionZonesResponseProto listEncryptionZones(
|
||||
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 SetXAttrResponseProto setXAttr(RpcController controller,
|
||||
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 GetXAttrsResponseProto getXAttrs(RpcController controller,
|
||||
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 ListXAttrsResponseProto listXAttrs(RpcController controller,
|
||||
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 RemoveXAttrResponseProto removeXAttr(RpcController controller,
|
||||
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 GetStoragePolicyResponseProto getStoragePolicy(
|
||||
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 GetStoragePoliciesResponseProto getStoragePolicies(
|
||||
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 GetCurrentEditLogTxidResponseProto getCurrentEditLogTxid(RpcController co
|
||||
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);
|
||||
|
@ -255,8 +255,8 @@ public LocatedBlocks getBlockLocations(String src, long offset, long length)
|
||||
try {
|
||||
GetBlockLocationsResponseProto resp = rpcProxy.getBlockLocations(null,
|
||||
req);
|
||||
return resp.hasLocations() ?
|
||||
PBHelper.convert(resp.getLocations()) : null;
|
||||
return resp.hasLocations() ?
|
||||
PBHelperClient.convert(resp.getLocations()) : null;
|
||||
} catch (ServiceException e) {
|
||||
throw ProtobufHelper.getRemoteException(e);
|
||||
}
|
||||
@ -266,7 +266,7 @@ public LocatedBlocks getBlockLocations(String src, long offset, long length)
|
||||
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 HdfsFileStatus create(String src, FsPermission masked,
|
||||
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 LastBlockWithStatus append(String src, String clientName,
|
||||
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 void setPermission(String src, FsPermission permission)
|
||||
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 LocatedBlock addBlock(String src, String clientName,
|
||||
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 LocatedBlock getAdditionalDatanode(String src, long fileId,
|
||||
.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 boolean complete(String src, String clientName,
|
||||
@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 boolean mkdirs(String src, FsPermission masked, boolean createParent)
|
||||
IOException {
|
||||
MkdirsRequestProto req = MkdirsRequestProto.newBuilder()
|
||||
.setSrc(src)
|
||||
.setMasked(PBHelper.convert(masked))
|
||||
.setMasked(PBHelperClient.convert(masked))
|
||||
.setCreateParent(createParent).build();
|
||||
|
||||
try {
|
||||
@ -574,7 +574,7 @@ public DirectoryListing getListing(String src, byte[] startAfter,
|
||||
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 boolean recoverLease(String src, String clientName)
|
||||
@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 DatanodeInfo[] getDatanodeReport(DatanodeReportType type)
|
||||
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 DatanodeStorageReport[] getDatanodeStorageReport(DatanodeReportType type)
|
||||
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 long getPreferredBlockSize(String filename) throws IOException,
|
||||
@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 void finalizeUpgrade() throws IOException {
|
||||
@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 CorruptFileBlocks listCorruptFileBlocks(String path, String cookie)
|
||||
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 HdfsFileStatus getFileInfo(String src) throws AccessControlException,
|
||||
.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 HdfsFileStatus getFileLinkInfo(String src)
|
||||
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 ContentSummary getContentSummary(String path)
|
||||
.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 void createSymlink(String target, String link, FsPermission dirPerm,
|
||||
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 LocatedBlock updateBlockForPipeline(ExtendedBlock block,
|
||||
.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 void updatePipeline(String clientName, ExtendedBlock oldBlock,
|
||||
.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 Token<DelegationTokenIdentifier> getDelegationToken(Text renewer)
|
||||
.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 DataEncryptionKey getDataEncryptionKey() throws IOException {
|
||||
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 SnapshottableDirectoryStatus[] getSnapshottableDirListing()
|
||||
.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 SnapshotDiffReport getSnapshotDiffReport(String snapshotRoot,
|
||||
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 long addCacheDirective(CacheDirectiveInfo directive,
|
||||
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 void modifyCacheDirective(CacheDirectiveInfo directive,
|
||||
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 @@ private static class BatchedCacheEntries
|
||||
|
||||
@Override
|
||||
public CacheDirectiveEntry get(int i) {
|
||||
return PBHelper.convert(response.getElements(i));
|
||||
return PBHelperClient.convert(response.getElements(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1195,7 +1195,7 @@ public boolean hasMore() {
|
||||
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 boolean hasMore() {
|
||||
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 void addCachePool(CachePoolInfo info) throws IOException {
|
||||
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 BatchedCachePoolEntries(ListCachePoolsResponseProto proto) {
|
||||
@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 void modifyAclEntries(String src, List<AclEntry> aclSpec)
|
||||
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 void removeAclEntries(String src, List<AclEntry> aclSpec)
|
||||
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 void removeAcl(String src) throws IOException {
|
||||
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 AclStatus getAclStatus(String src) throws IOException {
|
||||
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 EncryptionZone getEZForPath(String src)
|
||||
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 BatchedEntries<EncryptionZone> listEncryptionZones(long id)
|
||||
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 void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
|
||||
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);
|
||||
@ -1422,16 +1422,16 @@ public void setXAttr(String src, XAttr xAttr, EnumSet<XAttrSetFlag> flag)
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XAttr> getXAttrs(String src, List<XAttr> xAttrs)
|
||||
public List<XAttr> getXAttrs(String src, List<XAttr> xAttrs)
|
||||
throws IOException {
|
||||
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 List<XAttr> listXAttrs(String src)
|
||||
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 List<XAttr> listXAttrs(String src)
|
||||
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 void removeXAttr(String src, XAttr xAttr) throws IOException {
|
||||
@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 BlockStoragePolicy getStoragePolicy(String path) throws IOException {
|
||||
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 BlockStoragePolicy[] getStoragePolicies() throws IOException {
|
||||
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 EventBatchList getEditsFromTxid(long txid) throws IOException {
|
||||
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 HeartbeatResponse sendHeartbeat(DatanodeRegistration registration,
|
||||
.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 HeartbeatResponse sendHeartbeat(DatanodeRegistration registration,
|
||||
}
|
||||
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 DatanodeCommand blockReport(DatanodeRegistration registration,
|
||||
|
||||
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 void blockReceivedAndDeleted(DatanodeRegistration registration,
|
||||
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 void reportBadBlocks(LocatedBlock[] blocks) throws IOException {
|
||||
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 HeartbeatResponseProto sendHeartbeat(RpcController controller,
|
||||
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 HeartbeatResponseProto sendHeartbeat(RpcController controller,
|
||||
RollingUpgradeStatus rollingUpdateStatus = response
|
||||
.getRollingUpdateStatus();
|
||||
if (rollingUpdateStatus != null) {
|
||||
builder.setRollingUpgradeStatus(PBHelper
|
||||
builder.setRollingUpgradeStatus(PBHelperClient
|
||||
.convertRollingUpgradeStatus(rollingUpdateStatus));
|
||||
}
|
||||
builder.setFullBlockReportLeaseId(response.getFullBlockReportLeaseId());
|
||||
@ -157,7 +157,7 @@ public BlockReportResponseProto blockReport(RpcController controller,
|
||||
} 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 BlockReceivedAndDeletedResponseProto blockReceivedAndDeleted(
|
||||
}
|
||||
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 ReportBadBlocksResponseProto reportBadBlocks(RpcController controller,
|
||||
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 CommitBlockSynchronizationResponseProto commitBlockSynchronization(
|
||||
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 InitReplicaRecoveryResponseProto initReplicaRecovery(
|
||||
} 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 void journal(JournalInfo journalInfo, long epoch, long firstTxnId,
|
||||
.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 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 NamenodeProtocolServerSideTranslatorPB(NamenodeProtocol impl) {
|
||||
@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.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 void journal(RequestInfo reqInfo,
|
||||
.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.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 PersistState saveState() throws IOException {
|
||||
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.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 @@ XAttr createEncryptionZone(String src, CipherSuite suite,
|
||||
}
|
||||
|
||||
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.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 @@ static INode unprotectedSetXAttrs(
|
||||
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.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 final void addToInodeMap(INode inode) {
|
||||
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 @@ void setFileEncryptionInfo(String src, FileEncryptionInfo info)
|
||||
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 @@ FileEncryptionInfo getFileEncryptionInfo(INode inode, int snapshotId,
|
||||
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.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 @@ private static List<XAttr> readXAttrsFromEditLog(DataInputStream in,
|
||||
return null;
|
||||
}
|
||||
XAttrEditLogProto proto = XAttrEditLogProto.parseDelimitedFrom(in);
|
||||
return PBHelper.convertXAttrs(proto.getXAttrsList());
|
||||
return PBHelperClient.convertXAttrs(proto.getXAttrsList());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -554,7 +554,7 @@ public void writeFields(DataOutputStream out) throws IOException {
|
||||
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 @@ void writeFields(DataOutputStream out) throws IOException {
|
||||
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 @@ void resetSubFields() {
|
||||
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 void writeFields(DataOutputStream out) throws IOException {
|
||||
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 @@ void resetSubFields() {
|
||||
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 void writeFields(DataOutputStream out) throws IOException {
|
||||
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 @@ void readFields(DataInputStream in, int logVersion) throws IOException {
|
||||
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 void writeFields(DataOutputStream out) throws IOException {
|
||||
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.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 @@ private INodeFile loadINodeFile(INodeSection.INode n) {
|
||||
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 @@ private static XAttrFeatureProto.Builder buildXAttrs(XAttrFeature f,
|
||||
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 @@ private void save(OutputStream out, INodeFile n) throws IOException {
|
||||
|
||||
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.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 @@ private void loadFileDiffList(InputStream in, INodeFile file, int size)
|
||||
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 @@ private void serializeFileDiffList(INodeFile file, OutputStream out)
|
||||
.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 void testConvertNamenodeRegistration() {
|
||||
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 @@ void compare(DatanodeStorage dns1, DatanodeStorage dns2) {
|
||||
@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 void testConvertBlockToken() {
|
||||
"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 @@ private LocatedBlock createLocatedBlockNoStorageMedia() {
|
||||
@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 void testConvertLocatedBlockList() {
|
||||
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 void testConvertLocatedBlockArray() {
|
||||
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 void TestConvertDatanodeStorage() {
|
||||
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 void testAclEntryProto() {
|
||||
.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 void testAclStatusProto() {
|
||||
.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
Block a user