Spaces:
Sleeping
Sleeping
Download apps/server/src/database/database.ts from phucsd/Oloka-Video-Dev: direct link, hf CLI and curl.
- Browser
- Download file 866 Bytes
-
https://huggingface.co/spaces/phucsd/Oloka-Video-Dev/resolve/main/apps/server/src/database/database.ts
- Command line
-
hf download hf://spaces/phucsd/Oloka-Video-Dev/apps/server/src/database/database.ts
-
curl -L -o database.ts https://huggingface.co/spaces/phucsd/Oloka-Video-Dev/resolve/main/apps/server/src/database/database.ts
866 Bytes
| import type { ReadyResponse } from "@oloka/contracts"; | |
| import type { DatabaseSync } from "node:sqlite"; | |
| export type DatabaseReadiness = ReadyResponse["checks"]["database"]; | |
| export type TransactionMode = "read" | "deferred" | "immediate"; | |
| export interface TransactionContext { | |
| readonly database: DatabaseSync; | |
| } | |
| export class PersistenceBusyError extends Error { | |
| readonly code = "PERSISTENCE_BUSY"; | |
| constructor(options?: ErrorOptions) { | |
| super("Persistence is temporarily busy", options); | |
| this.name = "PersistenceBusyError"; | |
| } | |
| } | |
| export interface TransactionRunner { | |
| run<T>( | |
| mode: TransactionMode, | |
| operation: (context: TransactionContext) => T, | |
| ): T; | |
| } | |
| export interface SystemDatabase { | |
| readonly transactions: TransactionRunner; | |
| migrate(): Promise<void>; | |
| checkReadiness(): Promise<DatabaseReadiness>; | |
| close(): Promise<void>; | |
| } | |