Skip to main content

GetLoadState

This operation returns the current load state and progress of a collection or partitions.

go
func (c *Client) GetLoadState(ctx context.Context, option GetLoadStateOption, callOptions ...grpc.CallOption) (entity.LoadState, error)

Request Syntax​

Creates the request for GetLoadState().

go
option := milvusclient.NewGetLoadStateOption(collectionName, partitionNames)

result, err := client.GetLoadState(ctx, option)

PARAMETERS:

  • collectionName (string) -

    [REQUIRED]

    The name of the target collection.

  • partitionNames (...string) -

    [REQUIRED]

    The name(s) of the partition(s).

BUILDER METHODS:

  • NewGetLoadStateOption(collectionName string, partitionNames ...string)

    Creates the request for GetLoadState().

RETURN TYPE:

entity.LoadState, error

RETURNS:

The current load state of the collection or partitions. Returns an error if the operation fails.

go
type LoadState struct {
State LoadStateCode
Progress int64
}

PARAMETERS:

  • State (LoadStateCode) -

    The current state: LoadStateLoading, LoadStateLoaded, LoadStateUnloading, or LoadStateNotLoad.

  • Progress (int64) -

    The progress percentage.

ERROR HANDLING:

  • error

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

Example​

Demonstrates GetLoadState() usage.

go
import (
"context"
"fmt"

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

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

collectionName := `customized_setup_1`

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

loadState, err := cli.GetLoadState(ctx, milvusclient.NewGetLoadStateOption(collectionName))
if err != nil {
// handle err
}
fmt.Println(loadState)
Minimum SDK versionv3.0.x
Was this page helpful?