Skip to content

Interface: MigrationStore ​

Defined in: migrate.ts:374

Storage you provide (Redis, Postgres, DynamoDB, a file, a Map in tests). Values are JSON strings. Methods may be sync or async.

Cross-process safety depends on MigrationStore.compareAndSet. If it is implemented atomically, every transition is atomic across processes and machines that share the store. If it is absent, transitions are only serialised inside one process.

Methods ​

compareAndSet()? ​

optional compareAndSet(key, expected, value): boolean | Promise<boolean>

Defined in: migrate.ts:388

Optional but strongly recommended. Atomically sets key to value only if its current value is exactly expected (undefined means "the key must not exist"). Returns whether the write happened. Recipes: Redis WATCH/MULTI or a Lua script; Postgres UPDATE ... WHERE value = $expected (and INSERT ... ON CONFLICT DO NOTHING for absent); DynamoDB ConditionExpression; SQLite BEGIN IMMEDIATE. FileMigrationStore (subpath quantum-safe-ts/file-store) is a tested single-host implementation.

Parameters ​

key ​

string

expected ​

string | undefined

value ​

string

Returns ​

boolean | Promise<boolean>


get() ​

get(key): string | Promise<string | undefined> | undefined

Defined in: migrate.ts:376

Returns the value stored under key, or undefined when there is none.

Parameters ​

key ​

string

Returns ​

string | Promise<string | undefined> | undefined


keys() ​

keys(): Iterable<string, any, any> | Promise<Iterable<string, any, any>>

Defined in: migrate.ts:380

Lists every key in the store.

Returns ​

Iterable<string, any, any> | Promise<Iterable<string, any, any>>


set() ​

set(key, value): void | Promise<void>

Defined in: migrate.ts:378

Stores value under key, replacing any existing value.

Parameters ​

key ​

string

value ​

string

Returns ​

void | Promise<void>

Apache-2.0.