(client *Client, tableID int, backupID int64)
| 38 | } |
| 39 | |
| 40 | func QueryBackupStatus(client *Client, tableID int, backupID int64) error { |
| 41 | resp, errRecall := client.Meta.QueryBackupStatus(tableID, backupID) |
| 42 | if errRecall != nil { |
| 43 | return errRecall |
| 44 | } |
| 45 | fmt.Printf("[hint]: %s\n", resp.GetHintMessage()) |
| 46 | |
| 47 | type backupItemStruct struct { |
| 48 | BackupID int64 `json:"BackupID"` |
| 49 | AppName string `json:"AppName"` |
| 50 | StartTime string `json:"StartTime"` |
| 51 | EndTime string `json:"EndTime"` |
| 52 | Status string `json:"Status"` |
| 53 | BackupProviderType string `json:"BackupProviderType"` |
| 54 | BackupPath string `json:"BackupPath"` |
| 55 | } |
| 56 | |
| 57 | var tbList []interface{} |
| 58 | for _, item := range resp.GetBackupItems() { |
| 59 | var status string |
| 60 | if item.IsBackupFailed { |
| 61 | status = "failed" |
| 62 | } else if item.EndTimeMs == 0 { |
| 63 | status = "in progress" |
| 64 | } else { |
| 65 | status = "completed" |
| 66 | } |
| 67 | |
| 68 | startTime := time.Unix(item.StartTimeMs/1000, 0).String() |
| 69 | var endTime string |
| 70 | if item.EndTimeMs == 0 { |
| 71 | endTime = "-" |
| 72 | } else { |
| 73 | endTime = time.Unix(item.EndTimeMs/1000, 0).String() |
| 74 | } |
| 75 | |
| 76 | tbList = append(tbList, backupItemStruct{ |
| 77 | BackupID: item.BackupID, |
| 78 | AppName: item.AppName, |
| 79 | StartTime: startTime, |
| 80 | EndTime: endTime, |
| 81 | Status: status, |
| 82 | BackupProviderType: item.BackupProviderType, |
| 83 | BackupPath: item.BackupPath, |
| 84 | }) |
| 85 | } |
| 86 | // formats into tabular |
| 87 | tabular.Print(client, tbList) |
| 88 | return nil |
| 89 | } |
| 90 | |
| 91 | func RestoreTable(client *Client, oldClusterName string, oldTableName string, oldTableID int, |
| 92 | backupID int64, providerType string, newTableName string, restorePath string, skipBadPartition bool, policyName string) error { |
nothing calls this directly
no test coverage detected