Exemplo n.º 1
0
        /// <summary>
        /// Receive
        /// <see cref="OP.TransferBlock"/>
        ///
        /// </summary>
        /// <exception cref="System.IO.IOException"/>
        private void OpTransferBlock(DataInputStream @in)
        {
            DataTransferProtos.OpTransferBlockProto proto = DataTransferProtos.OpTransferBlockProto
                                                            .ParseFrom(PBHelper.VintPrefixed(@in));
            DatanodeInfo[] targets    = PBHelper.Convert(proto.GetTargetsList());
            TraceScope     traceScope = DataTransferProtoUtil.ContinueTraceSpan(proto.GetHeader()
                                                                                , proto.GetType().Name);

            try
            {
                TransferBlock(PBHelper.Convert(proto.GetHeader().GetBaseHeader().GetBlock()), PBHelper
                              .Convert(proto.GetHeader().GetBaseHeader().GetToken()), proto.GetHeader().GetClientName
                                  (), targets, PBHelper.ConvertStorageTypes(proto.GetTargetStorageTypesList(), targets
                                                                            .Length));
            }
            finally
            {
                if (traceScope != null)
                {
                    traceScope.Close();
                }
            }
        }
Exemplo n.º 2
0
 /// <exception cref="System.IO.IOException"/>
 public override void WriteBlock(ExtendedBlock blk, StorageType storageType, Org.Apache.Hadoop.Security.Token.Token
                                 <BlockTokenIdentifier> blockToken, string clientName, DatanodeInfo[] targets, StorageType
                                 [] targetStorageTypes, DatanodeInfo source, BlockConstructionStage stage, int pipelineSize
                                 , long minBytesRcvd, long maxBytesRcvd, long latestGenerationStamp, DataChecksum
                                 requestedChecksum, CachingStrategy cachingStrategy, bool allowLazyPersist, bool
                                 pinning, bool[] targetPinnings)
 {
     DataTransferProtos.ClientOperationHeaderProto header = DataTransferProtoUtil.BuildClientHeader
                                                                (blk, clientName, blockToken);
     DataTransferProtos.ChecksumProto checksumProto = DataTransferProtoUtil.ToProto(requestedChecksum
                                                                                    );
     DataTransferProtos.OpWriteBlockProto.Builder proto = DataTransferProtos.OpWriteBlockProto
                                                          .NewBuilder().SetHeader(header).SetStorageType(PBHelper.ConvertStorageType(storageType
                                                                                                                                     )).AddAllTargets(PBHelper.Convert(targets, 1)).AddAllTargetStorageTypes(PBHelper
                                                                                                                                                                                                             .ConvertStorageTypes(targetStorageTypes, 1)).SetStage(DataTransferProtoUtil.ToProto
                                                                                                                                                                                                                                                                       (stage)).SetPipelineSize(pipelineSize).SetMinBytesRcvd(minBytesRcvd).SetMaxBytesRcvd
                                                              (maxBytesRcvd).SetLatestGenerationStamp(latestGenerationStamp).SetRequestedChecksum
                                                              (checksumProto).SetCachingStrategy(GetCachingStrategy(cachingStrategy)).SetAllowLazyPersist
                                                              (allowLazyPersist).SetPinning(pinning).AddAllTargetPinnings(PBHelper.Convert(targetPinnings
                                                                                                                                           , 1));
     if (source != null)
     {
         proto.SetSource(PBHelper.ConvertDatanodeInfo(source));
     }
     Send(@out, OP.WriteBlock, ((DataTransferProtos.OpWriteBlockProto)proto.Build()));
 }
Exemplo n.º 3
0
 /// <exception cref="System.IO.IOException"/>
 public override void TransferBlock(ExtendedBlock blk, Org.Apache.Hadoop.Security.Token.Token
                                    <BlockTokenIdentifier> blockToken, string clientName, DatanodeInfo[] targets, StorageType
                                    [] targetStorageTypes)
 {
     DataTransferProtos.OpTransferBlockProto proto = ((DataTransferProtos.OpTransferBlockProto
                                                       )DataTransferProtos.OpTransferBlockProto.NewBuilder().SetHeader(DataTransferProtoUtil
                                                                                                                       .BuildClientHeader(blk, clientName, blockToken)).AddAllTargets(PBHelper.Convert(
                                                                                                                                                                                          targets)).AddAllTargetStorageTypes(PBHelper.ConvertStorageTypes(targetStorageTypes
                                                                                                                                                                                                                                                          )).Build());
     Send(@out, OP.TransferBlock, proto);
 }
Exemplo n.º 4
0
        /// <summary>Receive OP_WRITE_BLOCK</summary>
        /// <exception cref="System.IO.IOException"/>
        private void OpWriteBlock(DataInputStream @in)
        {
            DataTransferProtos.OpWriteBlockProto proto = DataTransferProtos.OpWriteBlockProto
                                                         .ParseFrom(PBHelper.VintPrefixed(@in));
            DatanodeInfo[] targets    = PBHelper.Convert(proto.GetTargetsList());
            TraceScope     traceScope = DataTransferProtoUtil.ContinueTraceSpan(proto.GetHeader()
                                                                                , proto.GetType().Name);

            try
            {
                WriteBlock(PBHelper.Convert(proto.GetHeader().GetBaseHeader().GetBlock()), PBHelper
                           .ConvertStorageType(proto.GetStorageType()), PBHelper.Convert(proto.GetHeader().
                                                                                         GetBaseHeader().GetToken()), proto.GetHeader().GetClientName(), targets, PBHelper
                           .ConvertStorageTypes(proto.GetTargetStorageTypesList(), targets.Length), PBHelper
                           .Convert(proto.GetSource()), DataTransferProtoUtil.FromProto(proto.GetStage()),
                           proto.GetPipelineSize(), proto.GetMinBytesRcvd(), proto.GetMaxBytesRcvd(), proto
                           .GetLatestGenerationStamp(), DataTransferProtoUtil.FromProto(proto.GetRequestedChecksum
                                                                                            ()), (proto.HasCachingStrategy() ? GetCachingStrategy(proto.GetCachingStrategy()
                                                                                                                                                  ) : CachingStrategy.NewDefaultStrategy()), (proto.HasAllowLazyPersist() ? proto.
                                                                                                                                                                                              GetAllowLazyPersist() : false), (proto.HasPinning() ? proto.GetPinning() : false
                                                                                                                                                                                                                               ), (PBHelper.ConvertBooleanList(proto.GetTargetPinningsList())));
            }
            finally
            {
                if (traceScope != null)
                {
                    traceScope.Close();
                }
            }
        }