Skip to main content

GetRestoreSnapshotState()

This operation queries the status and progress of an asynchronous restore snapshot job.

go
func (c *Client) GetRestoreSnapshotState(ctx context.Context, opt GetRestoreSnapshotStateOption, callOptions ...grpc.CallOption) (*milvuspb.RestoreSnapshotInfo, error)

Request Syntax​

Creates the request for GetRestoreSnapshotState().

go
option := client.NewGetRestoreSnapshotStateOption(jobID)

result, err := client.GetRestoreSnapshotState(option)

PARAMETERS:

  • jobID (int64) -

    [REQUIRED]

    The restore job ID.

RETURN TYPE:

milvuspb.RestoreSnapshotInfo, error

RETURNS:

A RestoreSnapshotInfo object recording the details of the specified restore snapshot job.

go
type RestoreSnapshotInfo struct {
JobId int64
SnapshotName string
DbName string
CollectionName string
State RestoreSnapshotState
Progress int64
Reason string
StartTime int64
TimeCost int64
}

PARAMETERS:

  • result (milvuspb.RestoreSnapshotInfo) -

    The RestoreSnapshotInfo object recording the details of the specified restore snapshot job.

ERROR HANDLING:

  • error

    The operation fails. Check err != nil for failure details.

Example​

Demonstrates GetRestoreSnapshotState() usage.

go
import (
"log"
"context"
"fmt"

"github.com/milvus-io/milvus/client/v3/milvusclient"
)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

milvusAddr := "YOUR_CLUSTER_ENDPOINT"

cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: milvusAddr,
})
if err != nil {
log.Fatal(err)
}

defer cli.Close(ctx)

option := milvusclient.NewGetRestoreSnapshotStateOption(12345)

info, err := cli.GetRestoreSnapshotState(ctx, option)
if err != nil {
// handle error
}

fmt.Println(info.GetState())
fmt.Println(info.GetProgress())
Minimum SDK versionv3.0.x
Was this page helpful?