(ids: readonly string[])
| 831 | } |
| 832 | |
| 833 | private getExistingNodeIds(ids: readonly string[]): Set<string> { |
| 834 | const out = new Set<string>(); |
| 835 | if (ids.length === 0) return out; |
| 836 | |
| 837 | const uniqueIds = [...new Set(ids)]; |
| 838 | for (let i = 0; i < uniqueIds.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 839 | const chunk = uniqueIds.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 840 | const placeholders = chunk.map(() => '?').join(','); |
| 841 | const rows = this.db |
| 842 | .prepare(`SELECT id FROM nodes WHERE id IN (${placeholders})`) |
| 843 | .all(...chunk) as { id: string }[]; |
| 844 | for (const row of rows) { |
| 845 | out.add(row.id); |
| 846 | } |
| 847 | } |
| 848 | |
| 849 | return out; |
| 850 | } |
| 851 | |
| 852 | /** |
| 853 | * Add a node to the cache, evicting oldest if needed |
no test coverage detected