refactor(8.0): rename HNSWIndex class → JsHnswVectorIndex (scaffold step 3)
Step 3 of the brainy 8.0 rename scaffolding. The class name now matches its role: the JS HNSW implementation of the VectorIndexProvider contract. Per planning § 2.3: this is NOT cosmetic — leaving HNSWIndex when the public contract is VectorIndexProvider creates a confusing read at the implementation layer. CHANGES Repo-wide mechanical rename: HNSWIndex → JsHnswVectorIndex across 52 references in src/ + 5 references in tests/ via sed. Class declaration, imports, JSDoc, comments, and identifiers all updated. src/index.ts - Primary public export: JsHnswVectorIndex (the new name). - Backwards-compat alias: `export const HNSWIndex = JsHnswVectorIndex` with @deprecated note. Removed in the final 8.0 cleanup commit. NO-OP scope No behavioural change. The class is exactly the same; only the name moved. Tests + build green. VERIFICATION - npx tsc --noEmit: clean - npm test: 1468 / 1468 unit
This commit is contained in:
parent
8f87b35614
commit
f39d420cb4
11 changed files with 80 additions and 70 deletions
|
|
@ -2,14 +2,14 @@
|
|||
* Index Operations with Rollback Support
|
||||
*
|
||||
* Provides transactional operations for all indexes:
|
||||
* - HNSWIndex (unified vector index)
|
||||
* - JsHnswVectorIndex (unified vector index)
|
||||
* - MetadataIndexManager (roaring bitmap filtering)
|
||||
* - GraphAdjacencyIndex (LSM-tree graph storage)
|
||||
*
|
||||
* Each operation can be executed and rolled back atomically.
|
||||
*/
|
||||
|
||||
import type { HNSWIndex } from '../../hnsw/hnswIndex.js'
|
||||
import type { JsHnswVectorIndex } from '../../hnsw/hnswIndex.js'
|
||||
import type { MetadataIndexManager } from '../../utils/metadataIndex.js'
|
||||
import type { GraphAdjacencyIndex } from '../../graph/graphAdjacencyIndex.js'
|
||||
import type { GraphVerb } from '../../coreTypes.js'
|
||||
|
|
@ -21,13 +21,13 @@ import type { Operation, RollbackAction } from '../types.js'
|
|||
* Rollback strategy:
|
||||
* - Remove item from index
|
||||
*
|
||||
* Note: Works with both HNSWIndex and TypeAwareHNSWIndex
|
||||
* Note: Works with both JsHnswVectorIndex and TypeAwareHNSWIndex
|
||||
*/
|
||||
export class AddToHNSWOperation implements Operation {
|
||||
readonly name = 'AddToHNSW'
|
||||
|
||||
constructor(
|
||||
private readonly index: HNSWIndex,
|
||||
private readonly index: JsHnswVectorIndex,
|
||||
private readonly id: string,
|
||||
private readonly vector: number[]
|
||||
) {}
|
||||
|
|
@ -76,7 +76,7 @@ export class RemoveFromHNSWOperation implements Operation {
|
|||
readonly name = 'RemoveFromHNSW'
|
||||
|
||||
constructor(
|
||||
private readonly index: HNSWIndex,
|
||||
private readonly index: JsHnswVectorIndex,
|
||||
private readonly id: string,
|
||||
private readonly vector: number[] // Required for rollback
|
||||
) {}
|
||||
|
|
@ -211,7 +211,7 @@ export class BatchAddToHNSWOperation implements Operation {
|
|||
private operations: AddToHNSWOperation[]
|
||||
|
||||
constructor(
|
||||
index: HNSWIndex,
|
||||
index: JsHnswVectorIndex,
|
||||
items: Array<{ id: string; vector: number[] }>
|
||||
) {
|
||||
this.operations = items.map(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue