archiveVaultMemoryOp()
archiveVaultMemoryOp(
ctx:VaultMemoryOperationsContext,id:string,opts?:object):Promise<boolean>
Defined in: src/lib/db/memoryVault/operations.ts:2359
Archive a memory (decay soft state, PR2) — set archived_at. An archived row
drops out of every recall lane via the baseVaultConditions choke point but
stays recoverable via restoreVaultMemoryOp until the hard-delete
window elapses.
Concurrency: re-checks is_deleted / ownership / archived_at INSIDE the
serialized writer (mirrors updateVaultMemoryOp). Additionally, when
opts.expectedUpdatedAt is given, the archive is skipped if the row’s current
updated_at no longer matches — i.e. a retain() merge (which bumps
updated_at) landed between the sweep’s candidate scan and this write, so the
fact was just re-observed and must NOT be archived on stale data. Idempotent:
a row another sweep already archived returns false (no double-write).
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
‐ | |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
Also guard re-observations, which deliberately preserve updated_at. |
|
|
|
Optimistic-concurrency guard: skip if the row’s |
|
|
|
Timestamp to stamp into |
Returns
Promise<boolean>
true if this call archived the row; false if it was stale
(deleted / not owned / already archived / refreshed under us).
Deprecated
App code: use MemoryStore.archive (createLocalMemoryStore).