Describe a partition

更新时间:
复制 MD 格式

This topic describes how to use the DashVector Java SDK to retrieve the status of an existing partition in a collection.

Prerequisites

API definition

// class DashVectorCollection

public Response<Status> describePartition(String name);

Example

Note
  1. To run the sample code, you must replace YOUR_API_KEY and YOUR_CLUSTER_ENDPOINT with your API key and cluster endpoint.

  2. This example requires a collection named quickstart. For more information, see Create a collection.

  3. This example requires a partition named shoes. For more information, see Create a partition.

import com.aliyun.dashvector.DashVectorClient;
import com.aliyun.dashvector.DashVectorCollection;
import com.aliyun.dashvector.common.DashVectorException;
import com.aliyun.dashvector.models.responses.Response;

public class Main {
    public static void main(String[] args) throws DashVectorException {
      	DashVectorClient client = new DashVectorClient("YOUR_API_KEY", "YOUR_CLUSTER_ENDPOINT");
      	DashVectorCollection collection = client.get("quickstart");
      	
      	// Describe the partition.
        Response<Status> response = collection.describePartition("shoes");

        System.out.println(response);
        // example output:
        // {"code":0,"message":"","requestId":"f554cde8-6147-42b5-b794-8cb9c0ae57da","output":"SERVING"}
    }
}

Parameters

Parameter

Type

Required

Default

Description

name

String

Yes

-

The partition name.

Response

Note

The returned result is a Response<Status> object. The Response<Status> object contains information about the result of this operation, as shown in the following table.

Method

Type

Description

Example

getCode()

int

The status code of the response. For more information, see Status codes.

0

getMessage()

String

The response message.

success

getRequestId()

String

The request ID.

19215409-ea66-4db9-8764-26ce2eb5bb99

getOutput()

String

The status of the partition. For more information, see Status.

  • INITIALIZED: Creating

  • SERVING: In service

  • DROPPING: Being deleted

  • ERROR: Error

isSuccess()

Boolean

Indicates whether the request was successful.

true