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