Ejemplo n.º 1
0
        void ReadWhileFollowupActions()
        {
            //There are certain followup requirements when a ReadWhile method returns false.
            //Condition 1:
            //  The end of the node has been reached.
            //Response:
            //  It returned false to allow for additional checks such as timeouts to occur.
            //  Do Nothing.
            //
            //Condition 2:
            //  The archive stream may no longer be in order and needs to be checked
            //Response:
            //  Resort the archive stream
            //
            //Condition 3:
            //  The end of the frame has been reached
            //Response:
            //  Advance to the next frame
            //  Also test the edge case where the current point might be equal to the end of the frame
            //      since this is an inclusive filter and ReadWhile is exclusive.
            //      If it's part of the frame, return true after Advancing the frame and the point.
            //

            //Update the cached values for the table so proper analysis can be done.
            m_firstTable.UpdateCachedValue();

            //Check Condition 1
            if (m_firstTable.CacheIsValid && m_firstTable.CacheKey.IsLessThan(m_readWhileUpperBounds))
            {
                return;
            }

            //Since condition 2 and 3 can occur at the same time, verifying the sort of the Archive Stream is a good thing to do.
            VerifyArchiveStreamSortingOrder();
        }
Ejemplo n.º 2
0
        private bool ReadWhileFollowupActions(TKey key, TValue value, MatchFilterBase <TKey, TValue> filter)
        {
            //There are certain followup requirements when a ReadWhile method returns false.
            //Condition 1:
            //  The end of the node has been reached.
            //Response:
            //  It returned false to allow for additional checks such as timeouts to occur.
            //  Do Nothing.
            //
            //Condition 2:
            //  The archive stream may no longer be in order and needs to be checked
            //Response:
            //  Resort the archive stream
            //
            //Condition 3:
            //  The end of the frame has been reached
            //Response:
            //  Advance to the next frame
            //  Also test the edge case where the current point might be equal to the end of the frame
            //      since this is an inclusive filter and ReadWhile is exclusive.
            //      If it's part of the frame, return true after Advancing the frame and the point.
            //

            //Update the cached values for the table so proper analysis can be done.
            m_firstTable.UpdateCachedValue();

            //Check Condition 1
            if (m_firstTable.CacheIsValid && m_firstTable.CacheKey.IsLessThan(m_readWhileUpperBounds))
            {
                return(false);
            }

            //Since condition 2 and 3 can occur at the same time, verifying the sort of the Archive Stream is a good thing to do.
            VerifyArchiveStreamSortingOrder();

            if (EOS)
            {
                return(false);
            }

            //Check if Condition 3's exception occured.
            if (m_firstTable.CacheKey.IsEqualTo(m_keySeekFilter.EndOfFrame))
            {
                //This is the exception clause. I will advance the frame, but will still need to return the current point.
                m_firstTable.Scanner.Read(key, value);
                AdvanceSeekableFilter(true, key);
                SetReadWhileUpperBoundsValue();

                return(filter is null || filter.Contains(key, value));
            }

            //Check if condition 3 occured
            if (m_firstTable.CacheKey.IsGreaterThan(m_keySeekFilter.EndOfFrame))
            {
                AdvanceSeekableFilter(true, m_firstTable.CacheKey);
                SetReadWhileUpperBoundsValue();
            }
            return(false);
        }