Build the provenance graph.
(self)
| 141 | |
| 142 | /// Build the provenance graph. |
| 143 | pub fn build(self) -> ProvenanceGraph { |
| 144 | let timestamp = self.timestamp.unwrap_or_else(|| { |
| 145 | std::time::SystemTime::now() |
| 146 | .duration_since(std::time::UNIX_EPOCH) |
| 147 | .map(|d| d.as_secs() as i64) |
| 148 | .unwrap_or(0) |
| 149 | }); |
| 150 | |
| 151 | let stats = ProvenanceStats::from_graph(&self.nodes, &self.edges); |
| 152 | |
| 153 | ProvenanceGraph { |
| 154 | version: SCHEMA_VERSION, |
| 155 | timestamp, |
| 156 | session_id: self.session_id, |
| 157 | agent_name: self.agent_name, |
| 158 | agent_display_name: self.agent_display_name, |
| 159 | agent_vendor: self.agent_vendor, |
| 160 | nodes: self.nodes, |
| 161 | edges: self.edges, |
| 162 | changes_explained: self.changes_explained, |
| 163 | previous: self.previous, |
| 164 | stats, |
| 165 | profile: self.profile, |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | // ============================================================================= |
no outgoing calls