GetRefreshExternalCollectionProgress()
この操作は、指定された外部コレクションリフレッシュジョブの進行状況を返します。
func (c *Client) GetRefreshExternalCollectionProgress(ctx context.Context, option GetRefreshExternalCollectionProgressOption, callOptions ...grpc.CallOption) (*entity.RefreshExternalCollectionJobInfo, error)
リクエスト構文
GetRefreshExternalCollectionProgress() のリクエストを作成します。
option := client.NewGetRefreshExternalCollectionProgressOption(jobID)
result, err := client.GetRefreshExternalCollectionProgress(option)
パラメーター:
-
jobID (int64) -
[必須]
戻り値の型:
*entity.RefreshExternalCollectionJobInfo
戻り値:
指定された外部コレクションリフレッシュジョブの詳細を記録する構造体型です。
type RefreshExternalCollectionJobInfo struct {
JobID int64
CollectionName string
State RefreshExternalCollectionState
Progress int64
Reason string
ExternalSource string
StartTime int64
EndTime int64
}
パラメーター:
-
JobID (int64) -
リフレッシュジョブの一意識別子です。
-
CollectionName (string) -
リフレッシュ対象のコレクションの名前です。
-
State (RefreshExternalCollectionState) -
リフレッシュジョブの現在の状態です。リフレッシュジョブは、
RefreshStateInProgressからRefreshStateCompletedまたはRefreshStateFailedに遷移します。 -
Progress (int64) -
リフレッシュジョブの進捗率です。
-
Reason (string) -
現在の状態に関する追加情報または理由です。
-
ExternalSource (string) -
外部データソース識別子です。
-
ExternalSpec (string) -
外部データソースの仕様(JSON)です。ファイル形式とオブジェクトストレージの設定を記述します。
-
StartTime (int64) -
ジョブが開始された時刻の Unix タイムスタンプです。
-
EndTime (int64) -
ジョブが完了した時刻の Unix タイムスタンプです。
エラー処理:
-
error
検証、リクエストの構築、または RPC に失敗します。失敗の詳細については、返されたエラーを確認してください。
例
GetRefreshExternalCollectionProgress() の使用例を示します。
refreshResult, err := client.RefreshExternalCollection(ctx,
client.NewRefreshExternalCollectionOption("test_collection"))
jobID := refreshResult.JobID
for {
progress, _ := client.GetRefreshExternalCollectionProgress(ctx,
client.NewGetRefreshExternalCollectionProgressOption(jobID))
fmt.Printf("State: %s\n", progress.State)
if progress.State == entity.RefreshStateCompleted {
fmt.Println("Refresh completed!")
break
}
if progress.State == entity.RefreshStateFailed {
fmt.Printf("Refresh failed: %s\n", progress.Reason)
break
}
time.Sleep(2 * time.Second)
}