smriti/db/face_repo/
mod.rs1mod gallery;
6mod read;
7mod undo;
8mod write;
9
10use rusqlite::Connection;
11
12pub use undo::{FaceSnapshot, FaceState};
13
14use crate::ml::FaceEmbedding;
15
16#[derive(Debug, Clone)]
17pub struct GalleryEmbedding {
18 pub cluster_id: i64,
19 pub face_id: i64,
20 pub embedding: FaceEmbedding,
21}
22
23#[derive(Debug, Clone)]
25pub struct FaceClusterRecord {
26 pub id: i64,
27 pub name: Option<String>,
28 pub representative_face_id: Option<i64>,
29 pub photo_count: i64,
30 pub face_thumbnail_path: Option<String>,
32}
33
34#[derive(Debug, Clone)]
36pub enum FaceStatus {
37 Confirmed,
38 Unconfirmed,
39 All,
40}
41
42#[derive(Debug, Clone)]
44pub struct FaceDetail {
45 pub face_id: i64,
46 pub photo_id: i64,
47 pub cluster_id: Option<i64>,
48 pub confidence: f32,
49 pub user_confirmed: i32,
50}
51
52#[derive(Debug, Clone, PartialEq)]
54pub struct PhotoFace {
55 pub face_id: i64,
56 pub bbox: (f32, f32, f32, f32),
58 pub cluster_id: Option<i64>,
59 pub name: Option<String>,
61 pub confirmed: bool,
63}
64
65#[derive(Debug, Clone, PartialEq, Eq)]
68pub struct MergeReceipt {
69 pub source_id: i64,
70 pub target_id: i64,
71 pub source_name: Option<String>,
72 pub source_user_named: bool,
73 pub face_ids: Vec<i64>,
75 pub target_took_name: bool,
77}
78
79pub struct FaceRepo<'a> {
80 pub(crate) conn: &'a Connection,
81}
82
83impl<'a> FaceRepo<'a> {
84 pub fn new(conn: &'a Connection) -> Self {
85 Self { conn }
86 }
87}