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
|
|
@ -62,7 +62,7 @@ export interface BrainyPluginContext {
|
|||
* - 'graphIndex' — GraphAdjacencyIndex replacement
|
||||
* - 'entityIdMapper' — EntityIdMapper replacement
|
||||
* - 'cache' — UnifiedCache replacement
|
||||
* - 'hnsw' — HNSWIndex replacement
|
||||
* - 'hnsw' — JsHnswVectorIndex replacement
|
||||
* - 'roaring' — RoaringBitmap32 replacement
|
||||
* - 'embeddings' — Embedding engine replacement (single text)
|
||||
* - 'embedBatch' — Batch embedding engine (texts[] → vectors[])
|
||||
|
|
@ -88,7 +88,7 @@ export interface BrainyPluginContext {
|
|||
// (Cortex) that declares `implements MetadataIndexProvider` gets a compile
|
||||
// error the moment a method Brainy depends on is dropped or its signature
|
||||
// drifts. Brainy's own baseline classes (`MetadataIndexManager`,
|
||||
// `GraphAdjacencyIndex`, `HNSWIndex`, `EntityIdMapper`, `UnifiedCache`)
|
||||
// `GraphAdjacencyIndex`, `JsHnswVectorIndex`, `EntityIdMapper`, `UnifiedCache`)
|
||||
// implement them too, so the contract can never silently diverge from the
|
||||
// thing Brainy ships.
|
||||
//
|
||||
|
|
@ -281,11 +281,11 @@ export interface CacheProvider {
|
|||
* connection lists as compact delta-varint byte sequences (cortex's
|
||||
* `encodeConnections` / `decodeConnections`).
|
||||
*
|
||||
* Brainy's `HNSWIndex` consumes this via a `ConnectionsCodec` that translates
|
||||
* Brainy's `JsHnswVectorIndex` consumes this via a `ConnectionsCodec` that translates
|
||||
* UUIDs to stable int slots via the `EntityIdMapper`, encodes, and persists
|
||||
* the compressed bytes through the binary-blob primitive. On load, the blob
|
||||
* is fetched + decoded back into UUID sets — `setConnectionsCodec()` on
|
||||
* `HNSWIndex` is the injection point. Read path is dual-format: when no blob
|
||||
* `JsHnswVectorIndex` is the injection point. Read path is dual-format: when no blob
|
||||
* exists for a node, the connections fall back to the legacy JSON-array path
|
||||
* embedded in `saveHNSWData`, so pre-2.4.0 indexes keep loading unchanged
|
||||
* and convergence to the compressed form happens lazily on next save.
|
||||
|
|
@ -304,7 +304,7 @@ export interface GraphCompressionProvider {
|
|||
|
||||
/**
|
||||
* The `'vectorStore:mmap'` provider — a static factory class for an mmap-backed
|
||||
* vector file. Brainy's HNSWIndex uses the static `.create()` / `.open()`
|
||||
* vector file. Brainy's JsHnswVectorIndex uses the static `.create()` / `.open()`
|
||||
* factories to open a single-file store at a derived path on disk-resident
|
||||
* storage adapters; non-FS adapters with no local-path support skip the mmap
|
||||
* layer and fall back to per-entity vector reads.
|
||||
|
|
@ -325,7 +325,7 @@ export interface VectorStoreMmapProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* An open mmap-vector-store instance — the surface brainy's HNSWIndex consumes
|
||||
* An open mmap-vector-store instance — the surface brainy's JsHnswVectorIndex consumes
|
||||
* for batch vector reads + lazy migration from per-entity storage on miss.
|
||||
*/
|
||||
export interface VectorStoreMmapInstance {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue