Build the provenance graph.
(self)
| 185 | |
| 186 | /// Build the provenance graph. |
| 187 | pub fn build(self) -> ProvenanceGraph { |
| 188 | let timestamp = self.timestamp.unwrap_or_else(|| { |
| 189 | std::time::SystemTime::now() |
| 190 | .duration_since(std::time::UNIX_EPOCH) |
| 191 | .map(|d| d.as_millis() as i64) |
| 192 | .unwrap_or(0) |
| 193 | }); |
| 194 | |
| 195 | let stats = ProvenanceStats::from_graph(&self.nodes, &self.edges); |
| 196 | |
| 197 | ProvenanceGraph { |
| 198 | version: SCHEMA_VERSION, |
| 199 | timestamp, |
| 200 | session_id: self.session_id, |
| 201 | agent_name: self.agent_name, |
| 202 | agent_display_name: self.agent_display_name, |
| 203 | agent_vendor: self.agent_vendor, |
| 204 | nodes: self.nodes, |
| 205 | edges: self.edges, |
| 206 | changes_explained: self.changes_explained, |
| 207 | previous: self.previous, |
| 208 | stats, |
| 209 | profile: self.profile, |
| 210 | plan_id: self.plan_id, |
| 211 | todos: self.todos, |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | // ============================================================================= |
no outgoing calls