public CopyTableEnumerator(Enumerator <TValue> impl, RecordKeyAccessor <TValue> keyAccessor) : base(impl)
        {
            _keyAccessor      = keyAccessor;
            _currentInstance  = default;
            _currentCopyIndex = default;
            _blockHandler     = default;

            if (Parser.Header.CopyTable.Exists)
            {
                _blockHandler = Parser.FindSegmentHandler <CopyTableHandler>(SegmentIdentifier.CopyTable);
                Debug.Assert(_blockHandler != null, "Block handler missing for copy table");

                _cloningFactory = new RuntimeCloner <TValue>(Parser.Type, Parser.Options.TokenType);

                InstanceFactory = forceReloadBase =>
                {
                    // Read an instance if one exists or if we're forced to
                    if (forceReloadBase || EqualityComparer <TValue> .Default.Equals(_currentInstance, default))
                    {
                        _currentInstance = base.ObtainCurrent();

                        // If we got default(TValue) from the underlying implementation we really are done
                        if (EqualityComparer <TValue> .Default.Equals(_currentInstance, default))
                        {
                            return(default !);
Esempio n. 2
0
        protected Enumerator(BinaryStorageFile <TValue> owner)
        {
            Parser  = owner;
            Current = default;

            _keyAccessor = new RecordKeyAccessor <TValue>(owner.Type, owner.Header.IndexColumn, owner.Options.TokenType);
        }
Esempio n. 3
0
        public IndexTableEnumerator(Enumerator <TValue> impl, RecordKeyAccessor <TValue> keyAccessor) : base(impl)
        {
            _blockHandler = Parser.FindSegmentHandler <IndexTableHandler>(SegmentIdentifier.IndexTable);
            Debug.Assert(_blockHandler != null, "Block handler missing for index table");

            _keyAccessor = keyAccessor;

            _cursor = 0;
        }