Files
Luncher/server/src/storage/memory.ts
T
batmanisko 67abbf19b5
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 20s
CI / Build server (push) Successful in 26s
CI / Build client (push) Successful in 35s
CI / Playwright E2E tests (push) Failing after 1m56s
CI / Build and push Docker image (push) Has been skipped
CI / Notify (push) Successful in 1s
feat: podpora high-availability a multi-replica nasazení
- Socket.io Redis adapter pro sdílený stav přes repliky
- graceful shutdown serveru
- WATCH/MULTI v updateData pro race-condition-safe aktualizace
- lease mechanismus pro push reminder (zabrání duplicitnímu odesílání)
- k8s/ manifesty pro testovací kind cluster
- Dockerfile: opraven EXPOSE port na 3001
- .gitignore: ignorovány Claude pracovní soubory
2026-05-20 17:16:19 +02:00

39 lines
1.1 KiB
TypeScript

import { StorageInterface } from "./StorageInterface";
const store = new Map<string, unknown>();
/** Vymaže všechna data z in-memory úložiště. Slouží k resetu mezi testy. */
export function resetMemoryStorage(): void {
store.clear();
}
/**
* In-memory implementace úložiště. Používá se výhradně v testovacím prostředí.
*/
export default class MemoryStorage implements StorageInterface {
hasData(key: string): Promise<boolean> {
return Promise.resolve(store.has(key));
}
getData<Type>(key: string): Promise<Type | undefined> {
return Promise.resolve(store.get(key) as Type | undefined);
}
setData<Type>(key: string, data: Type): Promise<void> {
store.set(key, data);
return Promise.resolve();
}
updateData<Type>(key: string, mutator: (current: Type | undefined) => Type): Promise<Type> {
const current = store.get(key) as Type | undefined;
const next = mutator(current);
store.set(key, next);
return Promise.resolve(next);
}
healthCheck(): Promise<boolean> {
return Promise.resolve(true);
}
}