(
&self,
sandbox_id: &str,
sandbox_name: &str,
)
| 1113 | } |
| 1114 | |
| 1115 | pub async fn get_sandbox( |
| 1116 | &self, |
| 1117 | sandbox_id: &str, |
| 1118 | sandbox_name: &str, |
| 1119 | ) -> Result<Option<Sandbox>, Status> { |
| 1120 | if !sandbox_id.is_empty() { |
| 1121 | validate_sandbox_id(sandbox_id)?; |
| 1122 | } |
| 1123 | |
| 1124 | let registry = self.registry.lock().await; |
| 1125 | let sandbox = if sandbox_id.is_empty() { |
| 1126 | registry |
| 1127 | .values() |
| 1128 | .find(|record| record.snapshot.name == sandbox_name) |
| 1129 | .map(|record| record.snapshot.clone()) |
| 1130 | } else { |
| 1131 | registry |
| 1132 | .get(sandbox_id) |
| 1133 | .map(|record| record.snapshot.clone()) |
| 1134 | }; |
| 1135 | Ok(sandbox) |
| 1136 | } |
| 1137 | |
| 1138 | pub async fn current_snapshots(&self) -> Vec<Sandbox> { |
| 1139 | let registry = self.registry.lock().await; |
no test coverage detected