(
&self,
file_text: String,
remote_args: Vec<String>,
)
| 190 | } |
| 191 | |
| 192 | pub async fn process( |
| 193 | &self, |
| 194 | file_text: String, |
| 195 | remote_args: Vec<String>, |
| 196 | ) -> Result<ProverResponse> { |
| 197 | let hash = Self::generate_hash(&file_text); |
| 198 | |
| 199 | if let Some((out, err, status)) = self.check_cache(&hash).await? { |
| 200 | return Ok(ProverResponse { |
| 201 | out, |
| 202 | err, |
| 203 | status, |
| 204 | cached: true, |
| 205 | }); |
| 206 | } |
| 207 | |
| 208 | let mut temp_file = tempfile::Builder::new() |
| 209 | .suffix(".bpl") |
| 210 | .tempfile() |
| 211 | .context("Failed to create temporary file")?; |
| 212 | |
| 213 | use std::io::Write; |
| 214 | temp_file |
| 215 | .write_all(file_text.as_bytes()) |
| 216 | .context("Failed to write to temporary file")?; |
| 217 | |
| 218 | let temp_file_path = temp_file.path().to_string_lossy().to_string(); |
| 219 | |
| 220 | let (out, err, status) = match self.execute_boogie(&temp_file_path, remote_args).await { |
| 221 | Ok(output) => output, |
| 222 | Err(e) => ( |
| 223 | String::new(), |
| 224 | format!("Error executing boogie remotely: {}", e), |
| 225 | -1, |
| 226 | ), |
| 227 | }; |
| 228 | |
| 229 | if let Err(e) = self.cache_result(&hash, &out, &err, status).await { |
| 230 | println!("Failed to cache result: {}", e); |
| 231 | } else { |
| 232 | println!("Result cached successfully for hash: {}", hash); |
| 233 | } |
| 234 | |
| 235 | temp_file.close()?; |
| 236 | |
| 237 | Ok(ProverResponse { |
| 238 | out, |
| 239 | err, |
| 240 | status: status, |
| 241 | cached: false, |
| 242 | }) |
| 243 | } |
| 244 | } |
no test coverage detected