All Products
Search
Document Center

Tablestore:Query information about all tunnels of a data table

Last Updated:Jul 05, 2024

After you create a tunnel, you can call the ListTunnel operation to query information about all tunnels of a table, including the tunnel name, type, ID, and stage, and whether the data is expired.

Prerequisites

  • A TunnelClient instance is initialized.

  • A tunnel is created for the data table. For more information, see Create a tunnel.

Parameters

Request parameters

Parameter

Description

TableName

The name of the data table whose tunnel information you want to query.

Response parameters

Parameter

Description

List<TunnelInfo>

The information about the tunnels. The following information is included in the response:

  • TunnelId: the ID of the tunnel.

  • TunnelType: the type of the tunnel. Valid values: BaseData, Stream, and BaseAndStream. The BaseData type indicates that the tunnel is used to consume full data of the data table. The Stream type indicates that the tunnel is used to consume incremental data of the data table. The BaseAndStream type indicates that the tunnel is used to consume differential data of the data table.

  • TableName: the name of the data table for which the tunnel is created.

  • InstanceName: the name of the instance in which the tunnel is located.

  • Stage: the stage of the tunnel. Valid values: InitBaseDataAndStreamShard, ProcessBaseData, and ProcessStream. The InitBaseDataAndStreamShard stage indicates that the tunnel is being initialized. The ProcessBaseData stage indicates that the tunnel is being used to consume full data. The ProcessStream stage indicates that the tunnel is being used to consume incremental data.

  • Expired: indicates whether the data is expired.

    If true is returned, contact Tablestore technical support by using DingTalk at the earliest opportunity.

ResponseInfo

Other fields returned in the request, including the RequestId field in the request. RequestId uniquely identifies the request.

Examples

The following sample code provides an example on how to query information about all tunnels of a table:

req := &tunnel.ListTunnelRequest{
    TableName: "<TABLE_NAME>",
}
resp, err := tunnelClient.ListTunnel(req)
if err != nil {
    log.Fatal("List tunnel failed", err)
} else {
    for i := 0; i < len(resp.Tunnels); i++ {
        log.Println(resp.Tunnels[i].TableName, resp.Tunnels[i].TunnelName, resp.Tunnels[i].TunnelId)
    }
}

References

  • For information about the API operation that you can call to query information about all tunnels of a data table, see ListTunnel.

  • If you want to quickly use Tunnel Service to consume data, see Getting started.

  • You can query information about a tunnel. For more information, see Query information about a tunnel.

  • You can delete a tunnel that you no longer require. For more information, see Delete a tunnel.