メインコンテンツまでスキップ

GetRefreshExternalCollectionProgress()

この操作は、指定された外部コレクションリフレッシュジョブの進行状況を返します。

go
func (c *Client) GetRefreshExternalCollectionProgress(ctx context.Context, option GetRefreshExternalCollectionProgressOption, callOptions ...grpc.CallOption) (*entity.RefreshExternalCollectionJobInfo, error)

リクエスト構文

go
option := client.NewGetRefreshExternalCollectionProgressOption(jobID)

result, err := client.GetRefreshExternalCollectionProgress(option)

パラメータ:

  • jobID (int64) -

    refresh_external_collection() によって返されるジョブ ID。

戻り値の型:

*entity.RefreshExternalCollectionJobInfo

戻り値:

指定された外部コレクションリフレッシュジョブの詳細を記録する構造体型です。

go
type RefreshExternalCollectionJobInfo struct {
JobID int64
CollectionName string
State RefreshExternalCollectionState
Progress int64
Reason string
ExternalSource string
StartTime int64
EndTime int64
}

パラメータ:

パラメータ:

  • JobID (int64) -

    現在のリクエストで指定されたジョブ ID。

  • CollectionName (string) -

    RefreshExternalCollection() で指定された外部コレクションの名前。

  • State (string) -

    指定されたジョブの現在の状態。指定可能な値は次のとおりです。

    • RefreshPending

    • RefreshInProgress

    • RefreshFailed

    • RefreshCompleted

  • Progress (int64) -

    指定されたジョブの現在の進行状況。値は 0 から 100 までの整数です。

  • Reason (string) -

    リフレッシュ操作が失敗した場合のエラーメッセージです。通常時は空文字列です。

  • ExternalSource (string) -

    RefreshExternalCollection() で指定された外部ソース URI。

  • StartTime (int64) -

    指定されたジョブが開始される時点のミリ秒単位のタイムスタンプ。

  • EndTime (int64) -

    指定されたジョブが終了する時点のミリ秒単位のタイムスタンプ。

例:

go
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)
}
Ctrl I