(db: Database, entry: WriteBufferEntry, now: () => number)
| 732 | } |
| 733 | |
| 734 | function releasePendingBuffer(db: Database, entry: WriteBufferEntry, now: () => number): void { |
| 735 | if (entry.pending === undefined) return; |
| 736 | entry.openCount -= 1; |
| 737 | if (entry.openCount > 0) return; |
| 738 | |
| 739 | const inode = commitPendingBuffer(db, entry, now); |
| 740 | // File is closed; drop the now-promoted entry. A subsequent open |
| 741 | // hits the SQL path and gets a fresh buffer if needed. |
| 742 | deleteWriteBuffer(db, inode); |
| 743 | } |
| 744 | |
| 745 | // Hydrate a freshly-opened buffer with the inode's current bytes |
| 746 | // the first time we mutate it. Avoids paying the read cost when the |
no test coverage detected