Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fin db

Manav Rathi2ae98148ae37
diff --git a/web/packages/new/photos/services/ml/db.ts b/web/packages/new/photos/services/ml/db.ts
index 53a081910c..7252483845 100644
--- a/web/packages/new/photos/services/ml/db.ts
+++ b/web/packages/new/photos/services/ml/db.ts
@@ -444,8 +444,8 @@ export const clusterGroups = async () => {
/**
* Replace the face clusters stored locally with the given ones.
*
- * This function deletes all entries from the person object store, and then
- * inserts the given {@link clusters} into it.
+ * This function deletes all entries from the face cluster object store, and
+ * then inserts the given {@link clusters} into it.
*/
export const setFaceClusters = async (clusters: FaceCluster[]) => {
const db = await mlDB();
@@ -456,19 +456,19 @@ export const setFaceClusters = async (clusters: FaceCluster[]) => {
};
/**
- * Update the person store to reflect the given changes, in order.
+ * Update the cluster group store to reflect the given changes.
*
* @param diff A list of changes to apply. Each entry is either
*
- * - A string, in which case the person with the given string as their ID
- * should be deleted from the store, or
+ * - A string, in which case the cluster group with the given string as their
+ * ID should be deleted from the store, or
*
- * - A person, in which case it should add or overwrite the entry for the
- * corresponding person (as identified by their {@link id}).
+ * - A cgroup, in which case it should add or overwrite the entry for the
+ * corresponding cluster group (as identified by its {@link id}).
*/
-export const applyPersonDiff = async (diff: (string | CGroup)[]) => {
+export const applyCGroupDiff = async (diff: (string | CGroup)[]) => {
const db = await mlDB();
- const tx = db.transaction("person", "readwrite");
+ const tx = db.transaction("cluster-group", "readwrite");
// See: [Note: Diff response will have at most one entry for an id]
await Promise.all(
diff.map((d) =>
diff --git a/web/packages/new/photos/services/user-entity.ts b/web/packages/new/photos/services/user-entity.ts
index 5d12f975a3..81b451503e 100644
--- a/web/packages/new/photos/services/user-entity.ts
+++ b/web/packages/new/photos/services/user-entity.ts
@@ -8,7 +8,7 @@ import { nullToUndefined } from "@/utils/transform";
import { z } from "zod";
import { gunzip } from "./gzip";
import type { CGroup } from "./ml/cluster-new";
-import { applyPersonDiff } from "./ml/db";
+import { applyCGroupDiff } from "./ml/db";
/**
* User entities are predefined lists of otherwise arbitrary data that the user
@@ -344,7 +344,7 @@ export const syncPersons = async () => {
const entities = await userEntityDiff(type, sinceTime, entityKeyB64);
if (entities.length == 0) break;
- await applyPersonDiff(
+ await applyCGroupDiff(
await Promise.all(
entities.map(async ({ id, data }) =>
data ? await parse(id, data) : id,