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

Method _remove_file_entities

rust-core/src/storage/incremental.rs:305–335  ·  view source on GitHub ↗

移除文件相关的所有实体

(
        &mut self,
        file_path: &PathBuf,
        entity_graph: &mut EntityGraph,
        call_graph: &mut PetCodeGraph,
    )

Source from the content-addressed store, hash-verified

303
304 /// 移除文件相关的所有实体
305 fn _remove_file_entities(
306 &mut self,
307 file_path: &PathBuf,
308 entity_graph: &mut EntityGraph,
309 call_graph: &mut PetCodeGraph,
310 ) {
311 // 获取文件的所有实体ID
312 let entity_ids = self.file_index.get_all_entity_ids(file_path);
313 let function_ids = self.file_index.get_all_function_ids(file_path);
314 let _class_ids = self.file_index.get_all_class_ids(file_path);
315
316 // 从图中移除
317 for entity_id in entity_ids {
318 entity_graph.remove_entity(&entity_id);
319 }
320
321 for function_id in function_ids {
322 if let Some(node_index) = call_graph.get_node_index(&function_id) {
323 call_graph.graph.remove_node(node_index);
324 call_graph.function_to_node.remove(&function_id);
325 call_graph.node_to_function.remove(&node_index);
326 }
327 }
328
329 // 清理索引
330 self.file_index.remove_file(file_path);
331 self.snippet_index.clear_file_cache(file_path);
332
333 // 从元数据中移除
334 self.file_metadata.remove(file_path);
335 }
336
337 /// 更新代码片段索引
338 fn _update_snippet_index(

Callers 2

refresh_fileMethod · 0.45
_update_fileMethod · 0.45

Calls 7

get_all_entity_idsMethod · 0.80
get_all_function_idsMethod · 0.80
get_all_class_idsMethod · 0.80
remove_entityMethod · 0.80
get_node_indexMethod · 0.80
remove_fileMethod · 0.80
clear_file_cacheMethod · 0.80

Tested by

no test coverage detected