MCPcopy Create free account
hub / github.com/CodeBendKit/codeseek / _save_file_hashes

Method _save_file_hashes

rust-core/src/codegraph/parser.rs:956–974  ·  view source on GitHub ↗

保存文件哈希值

(&self, dir: &Path, hashes: &HashMap<String, String>)

Source from the content-addressed store, hash-verified

954
955 /// 保存文件哈希值
956 fn _save_file_hashes(&self, dir: &Path, hashes: &HashMap<String, String>) -> Result<(), String> {
957 use crate::storage::PersistenceManager;
958 use md5;
959
960 let persistence = PersistenceManager::new();
961
962 // 使用目录路径的MD5哈希作为项目ID(与HTTP接口保持一致)
963 let project_id = format!("{:x}", md5::compute(dir.to_string_lossy().as_bytes()));
964 info!("Saving file hashes for project ID: {}", project_id);
965
966 // 为每个文件保存哈希值
967 for (file_path, hash) in hashes {
968 if let Err(e) = persistence.save_file_hash(&project_id, file_path, hash) {
969 warn!("Failed to save hash for {}: {}", file_path, e);
970 }
971 }
972
973 Ok(())
974 }
975
976 /// 检查文件是否应该跳过(基于MD5哈希值)
977 fn _should_skip_file(&self, file_path: &PathBuf, file_hashes: &mut HashMap<String, String>) -> Result<bool, String> {

Callers 2

build_code_graphMethod · 0.80

Calls 1

save_file_hashMethod · 0.80

Tested by

no test coverage detected