π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix Rust ML DB file ID set decoding
laurenspriemf15cd58121ca
diff --git a/mobile/apps/photos/lib/db/ml/rust_db.dart b/mobile/apps/photos/lib/db/ml/rust_db.dartindex bc24ce0008..90dcf9ce29 100644--- a/mobile/apps/photos/lib/db/ml/rust_db.dart+++ b/mobile/apps/photos/lib/db/ml/rust_db.dart@@ -373,7 +373,11 @@ class RustMLDataDB with MLDataDBOrchestration implements IMLDataDB<int> {Future<int> getErroredFaceCount() async => (await _db).getErroredFaceCount();@override- Future<Set<int>> getErroredFileIDs() async => (await _db).getErroredFileIds();+ Future<Set<int>> getErroredFileIDs() async {+ final db = await _db;+ final fileIDs = await db.getErroredFileIds();+ return fileIDs.inner.toSet();+ }@overrideFuture<void> pruneResolvedFaceErrorResults(List<int> fileIDs) async =>@@ -382,10 +386,13 @@ class RustMLDataDB with MLDataDBOrchestration implements IMLDataDB<int> {);@override- Future<Set<int>> getFileIDsWithErrorResults(List<int> fileIDs) async =>- (await _db).getFileIdsWithErrorResults(- fileIds: Int64List.fromList(fileIDs),- );+ Future<Set<int>> getFileIDsWithErrorResults(List<int> fileIDs) async {+ final db = await _db;+ final result = await db.getFileIdsWithErrorResults(+ fileIds: Int64List.fromList(fileIDs),+ );+ return result.inner.toSet();+ }@overrideFuture<void> deleteFaceIndexForFiles(List<int> fileIDs) async =>@@ -563,15 +570,22 @@ class RustMLDataDB with MLDataDBOrchestration implements IMLDataDB<int> {}@override- Future<Set<int>> getAllFileIDsOfFaceIDsNotInAnyCluster() async =>- (await _db).getAllFileIdsOfFaceIdsNotInAnyCluster();+ Future<Set<int>> getAllFileIDsOfFaceIDsNotInAnyCluster() async {+ final db = await _db;+ final fileIDs = await db.getAllFileIdsOfFaceIdsNotInAnyCluster();+ return fileIDs.inner.toSet();+ }@overrideFuture<Set<int>> getAllFilesAssociatedWithAllClusters({List<String>? exceptClusters,- }) async => (await _db).getAllFilesAssociatedWithAllClusters(- exceptClusters: exceptClusters,- );+ }) async {+ final db = await _db;+ final fileIDs = await db.getAllFilesAssociatedWithAllClusters(+ exceptClusters: exceptClusters,+ );+ return fileIDs.inner.toSet();+ }@overrideFuture<List<EmbeddingVector>> getAllClipVectors() async {@@ -639,8 +653,11 @@ class RustMLDataDB with MLDataDBOrchestration implements IMLDataDB<int> {(await _db).getPetIndexedFileCount(minimumMlVersion: minimumMlVersion);@override- Future<Set<int>> getFullyIndexedFileIds({required bool includePets}) async =>- (await _db).getFullyIndexedFileIds(includePets: includePets);+ Future<Set<int>> getFullyIndexedFileIds({required bool includePets}) async {+ final db = await _db;+ final fileIDs = await db.getFullyIndexedFileIds(includePets: includePets);+ return fileIDs.inner.toSet();+ }@overrideFuture<(List<(String, int?, int)>, List<(String, int?, int)>)>@@ -737,8 +754,11 @@ class RustMLDataDB with MLDataDBOrchestration implements IMLDataDB<int> {}@override- Future<Set<int>> getFileIDsWithFDData({DataType? type}) async =>- (await _db).getFileIdsWithFdData(dataType: type?.toJson());+ Future<Set<int>> getFileIDsWithFDData({DataType? type}) async {+ final db = await _db;+ final fileIDs = await db.getFileIdsWithFdData(dataType: type?.toJson());+ return fileIDs.inner.toSet();+ }}rust.FaceRow _toFaceRow(Face face) {diff --git a/rust/bindings/frb/photos/src/api/ml_db_api.rs b/rust/bindings/frb/photos/src/api/ml_db_api.rsindex 60a87eed58..e5dbb7fe24 100644--- a/rust/bindings/frb/photos/src/api/ml_db_api.rs+++ b/rust/bindings/frb/photos/src/api/ml_db_api.rs@@ -269,8 +269,8 @@ impl MlDb {Ok(self.inner.get_errored_face_count()?)}- pub fn get_errored_file_ids(&self) -> Result<HashSet<i64>, MlDbError> {- Ok(self.inner.get_errored_file_ids()?)+ pub fn get_errored_file_ids(&self) -> Result<Vec<i64>, MlDbError> {+ Ok(self.inner.get_errored_file_ids()?.into_iter().collect())}pub fn prune_resolved_face_error_results(&self, file_ids: Vec<i64>) -> Result<(), MlDbError> {@@ -280,8 +280,12 @@ impl MlDb {pub fn get_file_ids_with_error_results(&self,file_ids: Vec<i64>,- ) -> Result<HashSet<i64>, MlDbError> {- Ok(self.inner.get_file_ids_with_error_results(&file_ids)?)+ ) -> Result<Vec<i64>, MlDbError> {+ Ok(self+ .inner+ .get_file_ids_with_error_results(&file_ids)?+ .into_iter()+ .collect())}pub fn delete_face_index_for_files(&self, file_ids: Vec<i64>) -> Result<(), MlDbError> {@@ -305,28 +309,31 @@ impl MlDb {Ok(self.inner.get_unclustered_face_count()?)}- pub fn get_all_file_ids_of_face_ids_not_in_any_cluster(- &self,- ) -> Result<HashSet<i64>, MlDbError> {+ pub fn get_all_file_ids_of_face_ids_not_in_any_cluster(&self) -> Result<Vec<i64>, MlDbError> {Ok(self.inner- .get_all_file_ids_of_face_ids_not_in_any_cluster()?)+ .get_all_file_ids_of_face_ids_not_in_any_cluster()?+ .into_iter()+ .collect())}pub fn get_all_files_associated_with_all_clusters(&self,except_clusters: Option<Vec<String>>,- ) -> Result<HashSet<i64>, MlDbError> {+ ) -> Result<Vec<i64>, MlDbError> {Ok(self.inner- .get_all_files_associated_with_all_clusters(except_clusters.as_deref())?)+ .get_all_files_associated_with_all_clusters(except_clusters.as_deref())?+ .into_iter()+ .collect())}- pub fn get_fully_indexed_file_ids(- &self,- include_pets: bool,- ) -> Result<HashSet<i64>, MlDbError> {- Ok(self.inner.get_fully_indexed_file_ids(include_pets)?)+ pub fn get_fully_indexed_file_ids(&self, include_pets: bool) -> Result<Vec<i64>, MlDbError> {+ Ok(self+ .inner+ .get_fully_indexed_file_ids(include_pets)?+ .into_iter()+ .collect())}pub fn update_face_id_to_cluster_id(@@ -832,7 +839,11 @@ impl MlDb {pub fn get_file_ids_with_fd_data(&self,data_type: Option<String>,- ) -> Result<HashSet<i64>, MlDbError> {- Ok(self.inner.get_file_ids_with_fd_data(data_type.as_deref())?)+ ) -> Result<Vec<i64>, MlDbError> {+ Ok(self+ .inner+ .get_file_ids_with_fd_data(data_type.as_deref())?+ .into_iter()+ .collect())}}