feat(8.0): eager graphIndex.init() before the isReady() rebuild gate
A native graph provider cold-loads its source->target adjacency lazily, so isReady() would report false at the rebuild gate on a cold open and force a spurious rebuild (failing the §7.1 rebuild()==0 acceptance). Add an OPTIONAL GraphIndexProvider.init() (mirrors MetadataIndexProvider.init) and call it during init, AFTER metadataIndex.init() (id-mapper hydrated first, so a native int adjacency resolves endpoints through it) and BEFORE rebuildIndexesIfNeeded. The JS graph index omits init() and self-loads on demand, so the JS path is unchanged.
This commit is contained in:
parent
fc7f110479
commit
8f4787bb10
2 changed files with 25 additions and 0 deletions
|
|
@ -912,6 +912,19 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
|||
this.graphIndex = graphIndex
|
||||
}
|
||||
|
||||
// Eager graph cold-load (cor contract). The native graph provider lazily
|
||||
// defers loading its source→target adjacency, so isReady() would report
|
||||
// false at the rebuild gate below and force a spurious rebuild (failing the
|
||||
// §7.1 rebuild()==0 acceptance). Trigger the eager cold-load now — AFTER
|
||||
// metadataIndex.init() above (the id-mapper is hydrated, so a native int
|
||||
// adjacency resolves endpoints through it: the CTX-BR-RESTORE-REBUILD order)
|
||||
// and BEFORE rebuildIndexesIfNeeded. Optional: the JS graph has no init()
|
||||
// and self-loads its adjacency on demand.
|
||||
const graphWithInit = this.graphIndex as { init?: () => Promise<void> }
|
||||
if (typeof graphWithInit.init === 'function') {
|
||||
await graphWithInit.init()
|
||||
}
|
||||
|
||||
// 8.0 u64 contract: thread the shared UUID ↔ int resolver into the JS
|
||||
// graph index and the storage layer's verb read paths.
|
||||
this.wireGraphIdResolver()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue