GetLoadState
This operation returns the current load state and progress of a collection or partitions.
func (c *Client) GetLoadState(ctx context.Context, option GetLoadStateOption, callOptions ...grpc.CallOption) (entity.LoadState, error)
Request Syntax
Creates the request for GetLoadState().
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.
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 != nilfor failure details.
Example
Demonstrates GetLoadState() usage.
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)