From b551c441e10c94ccfe188d9bcc783efe78cd5083 Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Sun, 1 Mar 2026 21:10:48 +0100 Subject: file_processor: Skip files already in the DB with same size and mtime --- include/database_interaction.h | 3 +++ include/file_processor.h | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'include') diff --git a/include/database_interaction.h b/include/database_interaction.h index 5ff6f66..c236cf2 100644 --- a/include/database_interaction.h +++ b/include/database_interaction.h @@ -29,8 +29,11 @@ int dbi_insert_hashes(const char *blake2, const char *sha256, const char *sha512 int64_t dbi_select_fileinfo_by_hash_path_filename_ids(int64_t hash_id, int64_t path_id, int64_t filename_id); int64_t dbi_select_fileinfo_by_path_filename_ids(int64_t pname_id, int64_t fname_id); +int dbi_select_fileinfo_by_id_resolved(int64_t id, struct df_fileinfo *fi); int dbi_insert_fileinfo(struct df_fileinfo *fi); +int dbi_fill_fileinfo(struct df_fileinfo *fi); + int dbi_update_fileinfo_last_seen(int64_t id); int dbi_update_fileinfo_complete(struct df_fileinfo *fi, int64_t existing_id); diff --git a/include/file_processor.h b/include/file_processor.h index 06b6d1d..e8f66f2 100644 --- a/include/file_processor.h +++ b/include/file_processor.h @@ -7,6 +7,8 @@ #ifndef FILE_PROCESSOR_H #define FILE_PROCESSOR_H +#include +#include #include #define DF_BYTE_SIZE_256 32 @@ -44,7 +46,9 @@ struct df_fileinfo { unsigned char sha512[DF_BYTE_SIZE_512]; /**< The SHA512 hash in binary form. */ #endif struct df_hashstrings hashes; /**< The BLAKE2-512, SHA256 and SHA512 hash of the file */ + time_t last_seen; /**< time_t value when the file was last seen, filled by the database */ struct stat statbuf; /**< Result of lstat() call. Symlinks are to be ignored and filtered out earlier. */ + int64_t id; /**< to be set only when filled by the database */ }; -- cgit v1.3