package com.correx.core.talkie.l3

/**
 * An [L3MemoryStore] whose vectors persist independently of the JVM (e.g. a
 * sidecar index on disk) but whose entry metadata (`sessionId`/`turnId`/`text`)
 * lives in memory and is therefore lost on restart.
 *
 * Such a store can rebuild that metadata from the `ChatTurnEvent` log at startup:
 * the event log is the source of truth (invariant #1) and the metadata map is a
 * disposable projection. Only the metadata map is loaded — the persisted vectors
 * are never re-sent, so rehydration needs no embedder.
 *
 * Stores whose vectors are themselves volatile (e.g. [InMemoryL3MemoryStore])
 * deliberately do NOT implement this: rehydrating metadata without matching
 * vectors would be meaningless.
 */
interface RehydratableL3MemoryStore : L3MemoryStore {
    /**
     * Load entry metadata into the in-memory map without re-sending vectors.
     * Idempotent: re-running must not clobber entries already present.
     */
    suspend fun rehydrateMetadata(entries: List<L3MemoryEntry>)
}
