Use
This commit is contained in:
parent
5c92bc5b89
commit
e5a96222b9
2 changed files with 10 additions and 6 deletions
|
@ -30,7 +30,9 @@ export interface IndexStatus {
|
|||
* server ML data shape here exactly.
|
||||
*/
|
||||
export interface MinimalPersistedFileData {
|
||||
fileId: number;
|
||||
mlVersion: number;
|
||||
errorCount: number;
|
||||
faces?: { personId?: number; id: string }[];
|
||||
}
|
||||
|
||||
|
@ -42,7 +44,7 @@ const MLDATA_DB_NAME = "mldata";
|
|||
interface MLDb extends DBSchema {
|
||||
files: {
|
||||
key: number;
|
||||
value: MlFileData;
|
||||
value: MinimalPersistedFileData;
|
||||
indexes: { mlVersion: [number, number] };
|
||||
};
|
||||
people: {
|
||||
|
@ -267,7 +269,7 @@ class MLIDbStorage {
|
|||
|
||||
public async upsertFileInTx(
|
||||
fileId: number,
|
||||
upsert: (mlFile: MlFileData) => MlFileData,
|
||||
upsert: (mlFile: MinimalPersistedFileData) => MinimalPersistedFileData,
|
||||
) {
|
||||
const db = await this.db;
|
||||
const tx = db.transaction("files", "readwrite");
|
||||
|
@ -280,7 +282,7 @@ class MLIDbStorage {
|
|||
}
|
||||
|
||||
public async putAllFiles(
|
||||
mlFiles: Array<MlFileData>,
|
||||
mlFiles: MinimalPersistedFileData[],
|
||||
tx: IDBPTransaction<MLDb, ["files"], "readwrite">,
|
||||
) {
|
||||
await Promise.all(mlFiles.map((mlFile) => tx.store.put(mlFile)));
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import log from "@/next/log";
|
||||
import { CustomError, parseUploadErrorCodes } from "@ente/shared/error";
|
||||
import PQueue from "p-queue";
|
||||
import mlIDbStorage, { ML_SEARCH_CONFIG_NAME } from "services/face/db";
|
||||
import mlIDbStorage, {
|
||||
ML_SEARCH_CONFIG_NAME,
|
||||
type MinimalPersistedFileData,
|
||||
} from "services/face/db";
|
||||
import { putFaceEmbedding } from "services/face/remote";
|
||||
import { MlFileData } from "services/face/types";
|
||||
import { getLocalFiles } from "services/fileService";
|
||||
import { EnteFile } from "types/file";
|
||||
import { isInternalUserForML } from "utils/user";
|
||||
|
@ -104,7 +106,7 @@ class MachineLearningService {
|
|||
fileId,
|
||||
mlVersion: 0,
|
||||
errorCount: 0,
|
||||
} as MlFileData;
|
||||
} as MinimalPersistedFileData;
|
||||
}
|
||||
|
||||
private async getLocalFilesMap(syncContext: MLSyncContext) {
|
||||
|
|
Loading…
Add table
Reference in a new issue