Example #1
0
        internal ByteArrayBuffer PrepareRead(Transaction trans)
        {
            BTreeNodeCacheEntry cacheEntry = Btree().CacheEntry(this);

            if (CanWrite())
            {
                return(null);
            }
            if (IsNew())
            {
                return(null);
            }
            Transaction     systemTransaction = trans.SystemTransaction();
            ByteArrayBuffer buffer            = cacheEntry.Buffer();

            if (buffer != null)
            {
                // Cache hit, still unread
                buffer.Seek(0);
                Read(systemTransaction, buffer);
                cacheEntry.Buffer(null);
                _btree.AddToProcessing(this);
                return(null);
            }
            buffer = ProduceReadBuffer(systemTransaction);
            ReadNodeHeader(buffer);
            cacheEntry.Buffer(buffer);
            return(buffer);
        }
Example #2
0
        internal void PrepareWrite(Transaction trans)
        {
            if (_dead)
            {
                return;
            }
            BTreeNodeCacheEntry cacheEntry = Btree().CacheEntry(this);

            if (CanWrite())
            {
                return;
            }
            ByteArrayBuffer buffer = cacheEntry.Buffer();

            if (buffer != null)
            {
                buffer.Seek(0);
                Read(trans.SystemTransaction(), buffer);
                cacheEntry.Buffer(null);
            }
            else
            {
                Read(trans.SystemTransaction());
            }
            _btree.AddToProcessing(this);
        }
Example #3
0
        private void Purge()
        {
            if (_nodes == null)
            {
                return;
            }
            Tree temp = _nodes;

            _nodes = null;
            _root.HoldChildrenAsIDs();
            AddNode(_root);
            temp.Traverse(new _IVisitor4_294());
            for (IEnumerator entryIter = _nodeCache.GetEnumerator(); entryIter.MoveNext();)
            {
                BTreeNodeCacheEntry entry = ((BTreeNodeCacheEntry)entryIter.Current);
                entry._node.HoldChildrenAsIDs();
            }
        }