| … | … | @@ -71,6 +71,11 @@ export class HyperOverlay extends ReadyResource { |
| 71 | 71 | this._serveAuthorizer = opts.serveAuthorizer || null |
| 72 | 72 | this._localProfileKey = opts.localProfileKey || null |
| 73 | 73 | |
| 74 | // Per-instance protocol channel id (opts.key) — lets N overlays coexist on ONE shared mux |
| 75 | // (e.g. a multi-DID daemon: one overlay per DID, each keyed by its roomKey, on one connection). |
| 76 | // Without it they collide on (PROTOCOL, null) and only the first channel opens. |
| 77 | this._key = opts.key || null |
| 78 | |
| 74 | 79 | // At-rest key for the local index cores (file-index/index-meta/sync-feed). |
| 75 | 80 | this._indexEncryptionKey = opts.indexEncryptionKey || null |
| 76 | 81 | |
| … | … | @@ -125,6 +130,7 @@ export class HyperOverlay extends ReadyResource { |
| 125 | 130 | await sync.ready() |
| 126 | 131 | const transfer = new TransferManager(index, { journalDir: this._journalDir }) |
| 127 | 132 | const protocol = new OverlayProtocol(sync, transfer, { |
| 133 | key: this._key, |
| 128 | 134 | filePaths: this._filePaths, |
| 129 | 135 | contentHashPaths: this._contentHashPaths, |
| 130 | 136 | syncBaseDirs: this._syncBaseDirs, |
| … | … | @@ -213,6 +219,15 @@ export class HyperOverlay extends ReadyResource { |
| 213 | 219 | // ONCE, persists the content-addressed chunk map (durable in FileIndex), and |
| 214 | 220 | // returns the content hash. Replaces a hash-only pass plus a lazy fetch-time |
| 215 | 221 | // re-chunk with a single read, so the first fetcher never waits on chunk indexing. |
| 222 | // Stop serving a path AND record the deletion in the change feed, so the delete propagates to peers |
| 223 | // (attachReplication's remote peers see the del op and remove their copy). The authoring counterpart |
| 224 | // to a shim deleting a record. Idempotent. |
| 225 | async unregisterFile (overlayPath) { |
| 226 | await this._ensure() |
| 227 | this._filePaths.delete(overlayPath) |
| 228 | await this._sync.logDel(overlayPath) |
| 229 | } |
| 230 | |
| 216 | 231 | async prepareForServe (diskPath, opts = {}) { |
| 217 | 232 | await this._ensure() |
| 218 | 233 | // The overlay path below is a throwaway key — byHashOnly persists ONLY the |