(p: string, data: Buffer, stats: Stats)
| 401 | } |
| 402 | |
| 403 | public _syncSync(p: string, data: Buffer, stats: Stats): void { |
| 404 | // @todo Ensure mtime updates properly, and use that to determine if a data |
| 405 | // update is required. |
| 406 | const tx = this.store.beginTransaction('readwrite'), |
| 407 | // We use the _findInode helper because we actually need the INode id. |
| 408 | fileInodeId = this._findINode(tx, path.dirname(p), path.basename(p)), |
| 409 | fileInode = this.getINode(tx, p, fileInodeId), |
| 410 | inodeChanged = fileInode.update(stats); |
| 411 | |
| 412 | try { |
| 413 | // Sync data. |
| 414 | tx.put(fileInode.id, data, true); |
| 415 | // Sync metadata. |
| 416 | if (inodeChanged) { |
| 417 | tx.put(fileInodeId, fileInode.toBuffer(), true); |
| 418 | } |
| 419 | } catch (e) { |
| 420 | tx.abort(); |
| 421 | throw e; |
| 422 | } |
| 423 | tx.commit(); |
| 424 | } |
| 425 | |
| 426 | /** |
| 427 | * Checks if the root directory exists. Creates it if it doesn't. |
no test coverage detected