chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -570,9 +570,9 @@ export class GraphAdjacencyIndex implements GraphIndexProvider {
|
|||
for (const [verbId, verb] of loadedVerbs.entries()) {
|
||||
const cacheKey = `graph:verb:${verbId}`
|
||||
// Cache the loaded verb with metadata
|
||||
// Note: HNSWVerbWithMetadata is compatible with GraphVerb (both interfaces)
|
||||
this.unifiedCache.set(cacheKey, verb as any, 'other', 128, 50) // 128 bytes estimated size, 50ms rebuild cost
|
||||
results.set(verbId, verb as any)
|
||||
// Note: HNSWVerbWithMetadata is structurally assignable to GraphVerb
|
||||
this.unifiedCache.set(cacheKey, verb, 'other', 128, 50) // 128 bytes estimated size, 50ms rebuild cost
|
||||
results.set(verbId, verb)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,26 @@ class MemTable {
|
|||
/**
|
||||
* Manifest - Tracks all SSTables and their levels
|
||||
*/
|
||||
/**
|
||||
* Persisted manifest payload as written by `saveManifest()` (the `data` field
|
||||
* of the manifest metadata record, after a JSON round-trip).
|
||||
*/
|
||||
type PersistedManifestData = {
|
||||
sstables?: Record<string, number>
|
||||
lastCompaction?: number
|
||||
totalRelationships?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Persisted SSTable payload as written by `flushMemTable()`/`compact()` (the
|
||||
* `data` field of an SSTable metadata record): serialized bytes stored as a
|
||||
* plain number array so they survive JSON round-trips.
|
||||
*/
|
||||
type PersistedSSTableData = {
|
||||
type: string
|
||||
data: number[]
|
||||
}
|
||||
|
||||
interface Manifest {
|
||||
/**
|
||||
* Map of SSTable ID to level
|
||||
|
|
@ -512,10 +532,12 @@ export class LSMTree {
|
|||
const metadata = await this.storage.getMetadata(`${this.config.storagePrefix}-manifest`)
|
||||
|
||||
if (metadata && metadata.data) {
|
||||
const data = metadata.data as any
|
||||
// Storage boundary: `data` is the JSON manifest payload written by
|
||||
// saveManifest(); re-typed from the metadata channel's `unknown`.
|
||||
const data = metadata.data as PersistedManifestData
|
||||
this.manifest.sstables = new Map(Object.entries(data.sstables || {}))
|
||||
this.manifest.lastCompaction = (data.lastCompaction as number) || Date.now()
|
||||
this.manifest.totalRelationships = (data.totalRelationships as number) || 0
|
||||
this.manifest.lastCompaction = data.lastCompaction || Date.now()
|
||||
this.manifest.totalRelationships = data.totalRelationships || 0
|
||||
|
||||
// Load SSTables from storage
|
||||
await this.loadSSTables()
|
||||
|
|
@ -538,7 +560,9 @@ export class LSMTree {
|
|||
const metadata = await this.storage.getMetadata(storageKey)
|
||||
|
||||
if (metadata && metadata.data) {
|
||||
const data = metadata.data as any
|
||||
// Storage boundary: `data` is the JSON SSTable payload written by
|
||||
// flushMemTable()/compact(); re-typed from `unknown`.
|
||||
const data = metadata.data as PersistedSSTableData
|
||||
if (data.type === 'lsm-sstable') {
|
||||
// Convert number[] back to Uint8Array
|
||||
const uint8Data = new Uint8Array(data.data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue