GetBlock() public abstract method

Gets a block for the following Io session.
public abstract GetBlock ( BlockArguments args ) : void
args BlockArguments The block request that needs to be fulfilled by this IoSession.
return void
コード例 #1
0
        /// <summary>
        /// Updates the local buffer data.
        /// </summary>
        /// <param name="isWriting">hints to the stream if write access is desired.</param>
        public override void UpdateLocalBuffer(bool isWriting)
        {
            //If the block block is already looked up, skip this step.
            if (isWriting && LastWrite - Current > 0 || !isWriting && LastRead - Current > 0) //RemainingWriteLength == (m_lastWrite - m_current) //RemainingReadLength = (m_lastRead - m_current)
            {
                return;
            }

            long position = FirstPosition + (Current - First);

            m_args.Position  = position;
            m_args.IsWriting = isWriting;
            PointerVersion++;
            m_mainIoSession.GetBlock(m_args);
            FirstPosition = m_args.FirstPosition;
            First         = (byte *)m_args.FirstPointer;
            LastRead      = First + m_args.Length;
            Current       = First + (position - FirstPosition);
            LastPosition  = FirstPosition + m_args.Length;

            if (m_args.SupportsWriting)
            {
                LastWrite = LastRead;
            }
            else
            {
                LastWrite = First;
            }
        }