mirror of
https://github.com/immich-app/immich.git
synced 2025-07-03 21:40:00 +02:00
chore(server): rename domain repositories
-> interfaces
(#8147)
rename domain repositories
This commit is contained in:
parent
44ed1f0919
commit
b588a87d4a
155 changed files with 385 additions and 390 deletions
server/src/interfaces
53
server/src/interfaces/database.interface.ts
Normal file
53
server/src/interfaces/database.interface.ts
Normal file
|
@ -0,0 +1,53 @@
|
|||
import { Version } from 'src/utils/version';
|
||||
|
||||
export enum DatabaseExtension {
|
||||
CUBE = 'cube',
|
||||
EARTH_DISTANCE = 'earthdistance',
|
||||
VECTOR = 'vector',
|
||||
VECTORS = 'vectors',
|
||||
}
|
||||
|
||||
export type VectorExtension = DatabaseExtension.VECTOR | DatabaseExtension.VECTORS;
|
||||
|
||||
export enum VectorIndex {
|
||||
CLIP = 'clip_index',
|
||||
FACE = 'face_index',
|
||||
}
|
||||
|
||||
export enum DatabaseLock {
|
||||
GeodataImport = 100,
|
||||
Migrations = 200,
|
||||
StorageTemplateMigration = 420,
|
||||
CLIPDimSize = 512,
|
||||
LibraryWatch = 1337,
|
||||
}
|
||||
|
||||
export const extName: Record<DatabaseExtension, string> = {
|
||||
cube: 'cube',
|
||||
earthdistance: 'earthdistance',
|
||||
vector: 'pgvector',
|
||||
vectors: 'pgvecto.rs',
|
||||
} as const;
|
||||
|
||||
export interface VectorUpdateResult {
|
||||
restartRequired: boolean;
|
||||
}
|
||||
|
||||
export const IDatabaseRepository = 'IDatabaseRepository';
|
||||
|
||||
export interface IDatabaseRepository {
|
||||
getExtensionVersion(extensionName: string): Promise<Version | null>;
|
||||
getAvailableExtensionVersion(extension: DatabaseExtension): Promise<Version | null>;
|
||||
getPreferredVectorExtension(): VectorExtension;
|
||||
getPostgresVersion(): Promise<Version>;
|
||||
createExtension(extension: DatabaseExtension): Promise<void>;
|
||||
updateExtension(extension: DatabaseExtension, version?: Version): Promise<void>;
|
||||
updateVectorExtension(extension: VectorExtension, version?: Version): Promise<VectorUpdateResult>;
|
||||
reindex(index: VectorIndex): Promise<void>;
|
||||
shouldReindex(name: VectorIndex): Promise<boolean>;
|
||||
runMigrations(options?: { transaction?: 'all' | 'none' | 'each' }): Promise<void>;
|
||||
withLock<R>(lock: DatabaseLock, callback: () => Promise<R>): Promise<R>;
|
||||
tryLock(lock: DatabaseLock): Promise<boolean>;
|
||||
isBusy(lock: DatabaseLock): boolean;
|
||||
wait(lock: DatabaseLock): Promise<void>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue