Add tracing to EXIF DAO methods
This commit is contained in:
34
src/files.rs
34
src/files.rs
@@ -143,6 +143,7 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
|
||||
let mut exif_dao_guard = exif_dao.lock().expect("Unable to get ExifDao");
|
||||
let exif_results = exif_dao_guard
|
||||
.query_by_exif(
|
||||
&span_context,
|
||||
req.camera_make.as_deref(),
|
||||
req.camera_model.as_deref(),
|
||||
req.lens_model.as_deref(),
|
||||
@@ -276,7 +277,7 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
|
||||
// Batch fetch EXIF data
|
||||
let mut exif_dao_guard = exif_dao.lock().expect("Unable to get ExifDao");
|
||||
let exif_map: std::collections::HashMap<String, i64> = exif_dao_guard
|
||||
.get_exif_batch(&file_paths)
|
||||
.get_exif_batch(&span_context, &file_paths)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.filter_map(|exif| exif.date_taken.map(|dt| (exif.file_path, dt)))
|
||||
@@ -451,7 +452,7 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
|
||||
// Batch fetch EXIF data
|
||||
let mut exif_dao_guard = exif_dao.lock().expect("Unable to get ExifDao");
|
||||
let exif_map: std::collections::HashMap<String, i64> = exif_dao_guard
|
||||
.get_exif_batch(&file_paths)
|
||||
.get_exif_batch(&span_context, &file_paths)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.filter_map(|exif| exif.date_taken.map(|dt| (exif.file_path, dt)))
|
||||
@@ -896,6 +897,7 @@ mod tests {
|
||||
impl crate::database::ExifDao for MockExifDao {
|
||||
fn store_exif(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
data: crate::database::models::InsertImageExif,
|
||||
) -> Result<crate::database::models::ImageExif, crate::database::DbError> {
|
||||
// Return a dummy ImageExif for tests
|
||||
@@ -923,6 +925,7 @@ mod tests {
|
||||
|
||||
fn get_exif(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
_: &str,
|
||||
) -> Result<Option<crate::database::models::ImageExif>, crate::database::DbError> {
|
||||
Ok(None)
|
||||
@@ -930,6 +933,7 @@ mod tests {
|
||||
|
||||
fn update_exif(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
data: crate::database::models::InsertImageExif,
|
||||
) -> Result<crate::database::models::ImageExif, crate::database::DbError> {
|
||||
// Return a dummy ImageExif for tests
|
||||
@@ -955,18 +959,24 @@ mod tests {
|
||||
})
|
||||
}
|
||||
|
||||
fn delete_exif(&mut self, _: &str) -> Result<(), crate::database::DbError> {
|
||||
fn delete_exif(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
_: &str,
|
||||
) -> Result<(), crate::database::DbError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_all_with_date_taken(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
) -> Result<Vec<(String, i64)>, crate::database::DbError> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
fn get_exif_batch(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
_: &[String],
|
||||
) -> Result<Vec<crate::database::models::ImageExif>, crate::database::DbError> {
|
||||
Ok(Vec::new())
|
||||
@@ -974,6 +984,7 @@ mod tests {
|
||||
|
||||
fn query_by_exif(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
_: Option<&str>,
|
||||
_: Option<&str>,
|
||||
_: Option<&str>,
|
||||
@@ -984,15 +995,26 @@ mod tests {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
fn get_camera_makes(&mut self) -> Result<Vec<(String, i64)>, crate::database::DbError> {
|
||||
fn get_camera_makes(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
) -> Result<Vec<(String, i64)>, crate::database::DbError> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
fn update_file_path(&mut self, old_path: &str, new_path: &str) -> Result<(), DbError> {
|
||||
fn update_file_path(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
_old_path: &str,
|
||||
_new_path: &str,
|
||||
) -> Result<(), DbError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_all_file_paths(&mut self) -> Result<Vec<String>, DbError> {
|
||||
fn get_all_file_paths(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
) -> Result<Vec<String>, DbError> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user