示例#1
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();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Receive
        /// <see cref="OP.RequestShortCircuitShm"/>
        ///
        /// </summary>
        /// <exception cref="System.IO.IOException"/>
        private void OpRequestShortCircuitShm(DataInputStream @in)
        {
            DataTransferProtos.ShortCircuitShmRequestProto proto = DataTransferProtos.ShortCircuitShmRequestProto
                                                                   .ParseFrom(PBHelper.VintPrefixed(@in));
            TraceScope traceScope = DataTransferProtoUtil.ContinueTraceSpan(proto.GetTraceInfo
                                                                                (), proto.GetType().Name);

            try
            {
                RequestShortCircuitShm(proto.GetClientName());
            }
            finally
            {
                if (traceScope != null)
                {
                    traceScope.Close();
                }
            }
        }
示例#3
0
        /// <summary>
        /// Receive
        /// <see cref="OP.ReleaseShortCircuitFds"/>
        ///
        /// </summary>
        /// <exception cref="System.IO.IOException"/>
        private void OpReleaseShortCircuitFds(DataInputStream @in)
        {
            DataTransferProtos.ReleaseShortCircuitAccessRequestProto proto = DataTransferProtos.ReleaseShortCircuitAccessRequestProto
                                                                             .ParseFrom(PBHelper.VintPrefixed(@in));
            TraceScope traceScope = DataTransferProtoUtil.ContinueTraceSpan(proto.GetTraceInfo
                                                                                (), proto.GetType().Name);

            try
            {
                ReleaseShortCircuitFds(PBHelper.Convert(proto.GetSlotId()));
            }
            finally
            {
                if (traceScope != null)
                {
                    traceScope.Close();
                }
            }
        }
示例#4
0
        /// <summary>Receive OP_BLOCK_CHECKSUM</summary>
        /// <exception cref="System.IO.IOException"/>
        private void OpBlockChecksum(DataInputStream @in)
        {
            DataTransferProtos.OpBlockChecksumProto proto = DataTransferProtos.OpBlockChecksumProto
                                                            .ParseFrom(PBHelper.VintPrefixed(@in));
            TraceScope traceScope = DataTransferProtoUtil.ContinueTraceSpan(proto.GetHeader()
                                                                            , proto.GetType().Name);

            try
            {
                BlockChecksum(PBHelper.Convert(proto.GetHeader().GetBlock()), PBHelper.Convert(proto
                                                                                               .GetHeader().GetToken()));
            }
            finally
            {
                if (traceScope != null)
                {
                    traceScope.Close();
                }
            }
        }
示例#5
0
        /// <summary>
        /// Receive
        /// <see cref="OP.RequestShortCircuitFds"/>
        ///
        /// </summary>
        /// <exception cref="System.IO.IOException"/>
        private void OpRequestShortCircuitFds(DataInputStream @in)
        {
            DataTransferProtos.OpRequestShortCircuitAccessProto proto = DataTransferProtos.OpRequestShortCircuitAccessProto
                                                                        .ParseFrom(PBHelper.VintPrefixed(@in));
            ShortCircuitShm.SlotId slotId = (proto.HasSlotId()) ? PBHelper.Convert(proto.GetSlotId
                                                                                       ()) : null;
            TraceScope traceScope = DataTransferProtoUtil.ContinueTraceSpan(proto.GetHeader()
                                                                            , proto.GetType().Name);

            try
            {
                RequestShortCircuitFds(PBHelper.Convert(proto.GetHeader().GetBlock()), PBHelper.Convert
                                           (proto.GetHeader().GetToken()), slotId, proto.GetMaxVersion(), proto.GetSupportsReceiptVerification
                                           ());
            }
            finally
            {
                if (traceScope != null)
                {
                    traceScope.Close();
                }
            }
        }
示例#6
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();
                }
            }
        }
示例#7
0
        /// <summary>Receive OP_READ_BLOCK</summary>
        /// <exception cref="System.IO.IOException"/>
        private void OpReadBlock()
        {
            DataTransferProtos.OpReadBlockProto proto = DataTransferProtos.OpReadBlockProto.ParseFrom
                                                            (PBHelper.VintPrefixed(@in));
            TraceScope traceScope = DataTransferProtoUtil.ContinueTraceSpan(proto.GetHeader()
                                                                            , proto.GetType().Name);

            try
            {
                ReadBlock(PBHelper.Convert(proto.GetHeader().GetBaseHeader().GetBlock()), PBHelper
                          .Convert(proto.GetHeader().GetBaseHeader().GetToken()), proto.GetHeader().GetClientName
                              (), proto.GetOffset(), proto.GetLen(), proto.GetSendChecksums(), (proto.HasCachingStrategy
                                                                                                    () ? GetCachingStrategy(proto.GetCachingStrategy()) : CachingStrategy.NewDefaultStrategy
                                                                                                    ()));
            }
            finally
            {
                if (traceScope != null)
                {
                    traceScope.Close();
                }
            }
        }