Exemple #1
0
        public TableEnumerator(Table table)
        {
            _table = table;
            if (!_table.Initialized)
            {
                throw new Exception("Table has not been initialized");
            }
            _blockIndexEnum = new BlockEnumerator(table._blockIndex);

            Reset();
        }
Exemple #2
0
        public void Reset()
        {
            _blockIndexEnum.Reset();

            BlockEntry entry = _blockIndexEnum.Current;

            if (entry == null)
            {
                throw new Exception("Error");
            }

            byte[] dataBlock = _table.GetBlock(BlockHandle.ReadBlockHandle(entry.Data.Span));
            _currentBlockEnum = new BlockEnumerator(dataBlock);
            Current           = _currentBlockEnum.Current;
        }
Exemple #3
0
        public bool MoveNext()
        {
            if (!_currentBlockEnum.MoveNext())
            {
                if (!_blockIndexEnum.MoveNext())
                {
                    return(false);
                }

                BlockEntry entry = _blockIndexEnum.Current;
                if (entry == null)
                {
                    Log.Warn($"Unexpected empty index entry");
                    return(false);
                }

                byte[] dataBlock = _table.GetBlock(BlockHandle.ReadBlockHandle(entry.Data.Span));
                _currentBlockEnum = new BlockEnumerator(dataBlock);
            }

            Current = _currentBlockEnum.Current;

            return(Current != null);
        }