Beispiel #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);
        }