コード例 #1
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);
        }
コード例 #2
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);
        }