private MessageAndOffset MakeNextOuter()
        {
            if (!this.Messages.Skip(topIterPosition).Any())
            {
                return(AllDone());
            }

            Message newMessage = this.Messages.ElementAt(topIterPosition);

            lastMessageSize = newMessage.Size;
            topIterPosition++;
            switch (newMessage.CompressionCodec)
            {
            case CompressionCodecs.NoCompressionCodec:
                Logger.DebugFormat(
                    "Message is uncompressed. Valid byte count = {0}",
                    currValidBytes);
                innerIter       = null;
                innerDone       = true;
                currValidBytes += 4 + newMessage.Size;
                return(new MessageAndOffset(newMessage, currValidBytes));

            default:
                Logger.DebugFormat("Message is compressed. Valid byte count = {0}", currValidBytes);
                innerIter = CompressionUtils.Decompress(newMessage, this.PartitionId).GetEnumerator();
                innerDone = !innerIter.MoveNext();
                return(MakeNext());
            }
        }
Esempio n. 2
0
        private MessageAndOffset MakeNextOuter()
        {
            if (topIterPosition >= this.Messages.Count())
            {
                return(AllDone());
            }

            Message newMessage = this.Messages.ToList()[topIterPosition];

            topIterPosition++;
            switch (newMessage.CompressionCodec)
            {
            case CompressionCodecs.NoCompressionCodec:
                if (Logger.IsDebugEnabled)
                {
                    Logger.DebugFormat(
                        CultureInfo.CurrentCulture,
                        "Message is uncompressed. Valid byte count = {0}",
                        currValidBytes);
                }

                innerIter       = null;
                currValidBytes += 4 + newMessage.Size;
                return(new MessageAndOffset(newMessage, currValidBytes));

            default:
                if (Logger.IsDebugEnabled)
                {
                    Logger.DebugFormat(CultureInfo.CurrentCulture, "Message is compressed. Valid byte count = {0}", currValidBytes);
                }

                innerIter = CompressionUtils.Decompress(newMessage).GetEnumerator();
                return(MakeNext());
            }
        }