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