MCPcopy Create free account
hub / github.com/cloudflare/computer / releasePendingBuffer

Function releasePendingBuffer

packages/dofs/src/fs/writeFile.ts:734–743  ·  view source on GitHub ↗
(db: Database, entry: WriteBufferEntry, now: () => number)

Source from the content-addressed store, hash-verified

732}
733
734function 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

Callers 1

releaseWriteBufferSyncFunction · 0.85

Calls 2

commitPendingBufferFunction · 0.85
deleteWriteBufferFunction · 0.85

Tested by

no test coverage detected