Skip to main content

smriti/db/
mod.rs

1//! Database module for Smriti
2//!
3//! Uses SQLite with the database stored on the indexed drive itself,
4//! making the index fully portable.
5
6/// Maximum rows per multi-row INSERT statement. SQLite's default
7/// SQLITE_MAX_VARIABLE_NUMBER is 999 in older builds and 32766 in
8/// newer ones; staying at 200 rows per chunk keeps every existing
9/// repo (which never exceeds 5 columns per row) well under either
10/// limit, while still giving a ~3× speedup vs. one INSERT per row.
11pub const MAX_ROWS_PER_INSERT: usize = 200;
12
13/// Per-drive metadata folder. Kept as `.photovault` for backwards
14/// compatibility with libraries indexed before the Smriti rename —
15/// renaming would orphan every user's existing thumbnails / db /
16/// face crops on disk. Treat the on-disk folder name as part of the
17/// wire contract; new code reads this constant rather than the
18/// literal so the link to the legacy name stays explicit.
19pub const LIBRARY_METADATA_DIR: &str = ".photovault";
20
21pub mod album_repo;
22pub mod album_suggestion_repo;
23pub mod burst_repo;
24pub mod connection;
25pub mod document_repo;
26pub mod duplicate_repo;
27pub mod excluded_folder_repo;
28pub mod face_repo;
29pub mod geonames;
30pub mod inferred_identity_repo;
31pub mod migrations;
32pub mod photo_repo;
33pub mod recent_search_repo;
34pub mod schema;
35pub mod stack_repo;
36pub mod takeout_import_repo;
37pub mod trash_repo;
38
39pub use album_repo::{AlbumRecord, AlbumRepo};
40pub use album_suggestion_repo::{AlbumSuggestionRecord, AlbumSuggestionRepo};
41pub use burst_repo::{BurstGroupMemberRecord, BurstGroupRecord, BurstRepo};
42pub use connection::{db_path_for, open_secondary, tile_cache_dir, Database};
43pub use document_repo::DocumentRepo;
44pub use duplicate_repo::{DuplicateGroupMemberRecord, DuplicateGroupRecord, DuplicateRepo};
45pub use excluded_folder_repo::{ExcludedFolderRecord, ExcludedFolderRepo};
46pub use face_repo::{FaceClusterRecord, FaceDetail, FaceRepo, FaceStatus, ReviewItem};
47pub use inferred_identity_repo::InferredIdentityRepo;
48pub use photo_repo::PhotoRepo;
49pub use recent_search_repo::{RecentSearch, RecentSearchRepo};
50pub use schema::create_schema;
51pub use stack_repo::{PhotoStackMemberRecord, PhotoStackRecord, PhotoStackRepo, StackCandidate};
52pub use takeout_import_repo::{TakeoutImportRepo, TakeoutLedgerItem};
53pub use trash_repo::{TrashRepo, TrashedPhotoRecord};