(db: Database, path: string)
| 519 | // buffer instead of the SQLite chunk/blob store. Release commits |
| 520 | // the bytes back to chunks. |
| 521 | export function openWriteBufferSync(db: Database, path: string): void { |
| 522 | const { path: canonical } = canonicalizePath(path); |
| 523 | const pending = getPendingWriteBufferByPath(db, canonical); |
| 524 | if (pending !== undefined) { |
| 525 | pending.openCount += 1; |
| 526 | return; |
| 527 | } |
| 528 | const { inode, mode } = resolveFileInode(db, path); |
| 529 | const existing = getWriteBuffer(db, inode); |
| 530 | if (existing !== undefined) { |
| 531 | existing.openCount += 1; |
| 532 | return; |
| 533 | } |
| 534 | setWriteBuffer(db, inode, { |
| 535 | buf: new Uint8Array(0), |
| 536 | size: 0, |
| 537 | dirty: false, |
| 538 | openCount: 1, |
| 539 | mode, |
| 540 | }); |
| 541 | } |
| 542 | |
| 543 | // Create a new file lazily: stash a pending-create write buffer |
| 544 | // keyed by path, without touching SQL until release. createFileSync |
no test coverage detected