| … | … | @@ -19,6 +19,7 @@ import * as dagCbor from '@ipld/dag-cbor' |
| 19 | 19 | import b4a from 'b4a' |
| 20 | 20 | import fs from '#node:fs' // dual-runtime: bare-fs under Bare (the daemon), builtin fs under Node (tests) |
| 21 | 21 | import { join } from '#node:path' |
| 22 | import { tidNow } from './tid.js' |
| 22 | 23 | |
| 23 | 24 | const EXT = '.dagcbor' |
| 24 | 25 | const byteOrder = (a, b) => b4a.compare(b4a.from(a), b4a.from(b)) // match Hyperbee's key comparison exactly |
| … | … | @@ -55,7 +56,10 @@ export class OverlayRepoStore { |
| 55 | 56 | const p = this._pathFor(collection, rkey) |
| 56 | 57 | fs.mkdirSync(join(this._recordsDir, collection), { recursive: true }) |
| 57 | 58 | fs.writeFileSync(p, bytes) |
| 58 | | if (this._overlay) { try { await this._overlay.registerFile(this._overlayPath(collection, rkey), p, { size: bytes.length }) } catch {} } |
| 59 | // Stamp a monotonic per-write version (TID) so cross-device conflict resolution is atproto-native |
| 60 | // (rev-wins: the later write wins). Records carry no rev at put time — the commit rev comes at sign. |
| 61 | // Only affects the overlay change feed, never the canonical record file → determinism is preserved. |
| 62 | if (this._overlay) { try { await this._overlay.registerFile(this._overlayPath(collection, rkey), p, { size: bytes.length, rev: tidNow() }) } catch {} } |
| 59 | 63 | } |
| 60 | 64 | |
| 61 | 65 | async get (collection, rkey) { |