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

Method _load_file_hashes

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

加载文件哈希值

(&self, dir: &Path)

Source from the content-addressed store, hash-verified

917
918 /// 加载文件哈希值
919 fn _load_file_hashes(&self, dir: &Path) -> Result<HashMap<String, String>, String> {
920 use crate::storage::PersistenceManager;
921 use md5;
922
923 let persistence = PersistenceManager::new();
924
925 // 尝试多种方式的项目ID
926 let project_ids = vec![
927 // 1. 使用目录名(原始方式)
928 dir.file_name()
929 .and_then(|n| n.to_str())
930 .unwrap_or("default")
931 .to_string(),
932 // 2. 使用目录路径的MD5哈希(HTTP接口方式)
933 format!("{:x}", md5::compute(dir.to_string_lossy().as_bytes())),
934 ];
935
936 for project_id in project_ids {
937 match persistence.load_file_hashes(&project_id) {
938 Ok(hashes) => {
939 if !hashes.is_empty() {
940 info!("Loaded {} file hashes for project ID: {}", hashes.len(), project_id);
941 return Ok(hashes);
942 }
943 },
944 Err(e) => {
945 debug!("Failed to load file hashes for project ID {}: {}", project_id, e);
946 continue;
947 }
948 }
949 }
950
951 info!("No file hashes found for any project ID");
952 Ok(HashMap::new())
953 }
954
955 /// 保存文件哈希值
956 fn _save_file_hashes(&self, dir: &Path, hashes: &HashMap<String, String>) -> Result<(), String> {

Callers 2

build_code_graphMethod · 0.80

Calls 1

load_file_hashesMethod · 0.80

Tested by

no test coverage detected