// Stores status of decommissioning. // If node is not decommissioning, do not use this object for anything. public virtual int UpdateBlockReportContext(BlockReportContext context) { if (curBlockReportId != context.GetReportId()) { curBlockReportId = context.GetReportId(); curBlockReportRpcsSeen = new BitSet(context.GetTotalRpcs()); } curBlockReportRpcsSeen.Set(context.GetCurRpc()); return(curBlockReportRpcsSeen.Cardinality()); }
/// <exception cref="System.IO.IOException"/> public virtual DatanodeCommand BlockReport(DatanodeRegistration registration, string poolId, StorageBlockReport[] reports, BlockReportContext context) { DatanodeProtocolProtos.BlockReportRequestProto.Builder builder = DatanodeProtocolProtos.BlockReportRequestProto .NewBuilder().SetRegistration(PBHelper.Convert(registration)).SetBlockPoolId(poolId ); bool useBlocksBuffer = registration.GetNamespaceInfo().IsCapabilitySupported(NamespaceInfo.Capability .StorageBlockReportBuffers); foreach (StorageBlockReport r in reports) { DatanodeProtocolProtos.StorageBlockReportProto.Builder reportBuilder = DatanodeProtocolProtos.StorageBlockReportProto .NewBuilder().SetStorage(PBHelper.Convert(r.GetStorage())); BlockListAsLongs blocks = r.GetBlocks(); if (useBlocksBuffer) { reportBuilder.SetNumberOfBlocks(blocks.GetNumberOfBlocks()); reportBuilder.AddAllBlocksBuffers(blocks.GetBlocksBuffers()); } else { foreach (long value in blocks.GetBlockListAsLongs()) { reportBuilder.AddBlocks(value); } } builder.AddReports(((DatanodeProtocolProtos.StorageBlockReportProto)reportBuilder .Build())); } builder.SetContext(PBHelper.Convert(context)); DatanodeProtocolProtos.BlockReportResponseProto resp; try { resp = rpcProxy.BlockReport(NullController, ((DatanodeProtocolProtos.BlockReportRequestProto )builder.Build())); } catch (ServiceException se) { throw ProtobufHelper.GetRemoteException(se); } return(resp.HasCmd() ? PBHelper.Convert(resp.GetCmd()) : null); }