MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / next_inode_adj

Method next_inode_adj

atomic-core/src/pristine/inode_graph/impls.rs:51–111  ·  view source on GitHub ↗
(
        &self,
        adj: &mut InodeAdjState,
    )

Source from the content-addressed store, hash-verified

49 }
50
51 fn next_inode_adj(
52 &self,
53 adj: &mut InodeAdjState,
54 ) -> Option<Result<SerializedGraphEdge, Self::InodeError>> {
55 if adj.is_exhausted() {
56 return None;
57 }
58
59 if !adj.is_loaded() {
60 let table = match self.txn.open_multimap_table(INODE_GRAPH) {
61 Ok(t) => t,
62 Err(e) => {
63 adj.mark_exhausted();
64 return Some(Err(PristineError::Table(Box::new(e))));
65 }
66 };
67
68 let inode_id = adj.inode.get();
69 let key = encode_inode_vertex(
70 inode_id,
71 adj.node.change.get(),
72 adj.node.start.get(),
73 adj.node.end.get(),
74 );
75
76 let values = match table.get(&key) {
77 Ok(v) => v,
78 Err(e) => {
79 adj.mark_exhausted();
80 return Some(Err(PristineError::Storage(Box::new(e))));
81 }
82 };
83
84 let mut matching_edges: Vec<SerializedGraphEdge> = Vec::new();
85 for result in values {
86 match result {
87 Ok(v) => {
88 let edge = deserialize_edge(v.value());
89 let flag = edge.flag();
90 if flag >= adj.min_flag && flag <= adj.max_flag {
91 matching_edges.push(edge);
92 }
93 }
94 Err(e) => {
95 adj.mark_exhausted();
96 return Some(Err(PristineError::Storage(Box::new(e))));
97 }
98 }
99 }
100 adj.set_edges(matching_edges);
101 }
102
103 if adj.position < adj.edges.len() {
104 let edge = adj.edges[adj.position];
105 adj.advance();
106 Some(Ok(edge))
107 } else {
108 adj.mark_exhausted();

Callers 3

test_inode_adj_iterationFunction · 0.45
test_flag_filteringFunction · 0.45
nextMethod · 0.45

Calls 12

TableClass · 0.85
encode_inode_vertexFunction · 0.85
is_exhaustedMethod · 0.80
is_loadedMethod · 0.80
mark_exhaustedMethod · 0.80
flagMethod · 0.80
set_edgesMethod · 0.80
deserialize_edgeFunction · 0.70
getMethod · 0.65
pushMethod · 0.45
lenMethod · 0.45
advanceMethod · 0.45

Tested by 2

test_inode_adj_iterationFunction · 0.36
test_flag_filteringFunction · 0.36