Skip to main content

GetCompactionState

This operation returns the current state of a compaction operation.

go
func (c *Client) GetCompactionState(ctx context.Context, option GetCompactionStateOption, callOptions ...grpc.CallOption) (entity.CompactionState, error)

Request Syntax​

Creates the request for GetCompactionState().

go
option := milvusclient.NewGetCompactionStateOption(compactionID)

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

PARAMETERS:

  • compactionID (int64) -

    [REQUIRED]

    The compaction ID value.

BUILDER METHODS:

  • NewGetCompactionStateOption(compactionID int64)

    Creates the request for GetCompactionState().

RETURN TYPE:

entity.CompactionState, error

RETURNS:

The current state of the compaction operation. Returns an error if the operation fails.

PARAMETERS:

  • CompactionStateRunning (entity.CompactionState) -

    Compaction is currently executing (maps to the underlying CompactionState_Executing state).

  • CompactionStateCompleted (entity.CompactionState) -

    Compaction has completed (maps to the underlying CompactionState_Completed state).

ERROR HANDLING:

  • error

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

Example​

Demonstrates GetCompactionState() usage.

go
import (
"context"
"fmt"

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

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

compactID := int64(123)

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

state, err := cli.GetCompactionState(ctx, milvusclient.NewGetCompactionStateOption(compactID))
if err != nil {
// handle err
}
fmt.Println(state)
Minimum SDK versionv3.0.x
Was this page helpful?