Commit a snapshot for a table. Corresponds to Python `RESTApi.commit_snapshot`.
(
&self,
identifier: &Identifier,
table_uuid: &str,
snapshot: &Snapshot,
statistics: &[PartitionStatistics],
)
| 456 | /// |
| 457 | /// Corresponds to Python `RESTApi.commit_snapshot`. |
| 458 | pub async fn commit_snapshot( |
| 459 | &self, |
| 460 | identifier: &Identifier, |
| 461 | table_uuid: &str, |
| 462 | snapshot: &Snapshot, |
| 463 | statistics: &[PartitionStatistics], |
| 464 | ) -> Result<bool> { |
| 465 | let database = identifier.database(); |
| 466 | let table = identifier.object(); |
| 467 | validate_non_empty_multi(&[(database, "database name"), (table, "table name")])?; |
| 468 | let path = self.resource_paths.commit_table(database, table); |
| 469 | let request = serde_json::json!({ |
| 470 | "tableUuid": table_uuid, |
| 471 | "snapshot": snapshot, |
| 472 | "statistics": statistics, |
| 473 | }); |
| 474 | let resp: serde_json::Value = self.client.post(&path, &request).await?; |
| 475 | Ok(resp |
| 476 | .get("success") |
| 477 | .and_then(|v| v.as_bool()) |
| 478 | .unwrap_or(false)) |
| 479 | } |
| 480 | |
| 481 | /// Rollback a table to a specific snapshot. |
| 482 | pub async fn rollback_to_snapshot( |