/// <exception cref="System.Exception"/> public virtual HdfsBlocksMetadata Call() { HdfsBlocksMetadata metadata = null; // Create the RPC proxy and make the RPC ClientDatanodeProtocol cdp = null; TraceScope scope = Trace.StartSpan("getHdfsBlocksMetadata", parentSpan); try { cdp = DFSUtil.CreateClientDatanodeProtocolProxy(datanode, configuration, timeout, connectToDnViaHostname); metadata = cdp.GetHdfsBlocksMetadata(poolId, blockIds, dnTokens); } catch (IOException e) { // Bubble this up to the caller, handle with the Future throw; } finally { scope.Close(); if (cdp != null) { RPC.StopProxy(cdp); } } return(metadata); }
/// <exception cref="Com.Google.Protobuf.ServiceException"/> public virtual ClientDatanodeProtocolProtos.GetHdfsBlockLocationsResponseProto GetHdfsBlockLocations (RpcController controller, ClientDatanodeProtocolProtos.GetHdfsBlockLocationsRequestProto request) { HdfsBlocksMetadata resp; try { string poolId = request.GetBlockPoolId(); IList <Org.Apache.Hadoop.Security.Token.Token <BlockTokenIdentifier> > tokens = new AList <Org.Apache.Hadoop.Security.Token.Token <BlockTokenIdentifier> >(request.GetTokensCount ()); foreach (SecurityProtos.TokenProto b in request.GetTokensList()) { tokens.AddItem(PBHelper.Convert(b)); } long[] blockIds = Longs.ToArray(request.GetBlockIdsList()); // Call the real implementation resp = impl.GetHdfsBlocksMetadata(poolId, blockIds, tokens); } catch (IOException e) { throw new ServiceException(e); } IList <ByteString> volumeIdsByteStrings = new AList <ByteString>(resp.GetVolumeIds( ).Count); foreach (byte[] b_1 in resp.GetVolumeIds()) { volumeIdsByteStrings.AddItem(ByteString.CopyFrom(b_1)); } // Build and return the response ClientDatanodeProtocolProtos.GetHdfsBlockLocationsResponseProto.Builder builder = ClientDatanodeProtocolProtos.GetHdfsBlockLocationsResponseProto.NewBuilder(); builder.AddAllVolumeIds(volumeIdsByteStrings); builder.AddAllVolumeIndexes(resp.GetVolumeIndexes()); return((ClientDatanodeProtocolProtos.GetHdfsBlockLocationsResponseProto)builder. Build()); }