IClusterClient

public interface IClusterClient

com.android.tradefed.cluster.IClusterClient


用于与 TFC 后端交互的接口。

摘要

常量

String TYPE_NAME

唯一的配置对象类型名称。

公共方法

abstract IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader()

获取可用于上传 ClusterCommandEventIClusterEventUploader

abstract ClusterCommand.State getCommandState(String requestId, String commandId)

确定集群命令的状态。

default ClusterCommandStatus getCommandStatus(String requestId, String commandId)

获取集群命令的命令状态(状态和取消原因,如果已取消)。

abstract IClusterEventUploader<ClusterHostEvent> getHostEventUploader()

获取可用于上传 ClusterHostEventIClusterEventUploader

abstract TestContext getTestContext(String requestId, String commandId)
abstract TestEnvironment getTestEnvironment(String requestId)

获取请求的 TestEnvironment

abstract List<TestResource> getTestResources(String requestId)

获取请求的 TestResource

abstract List<ClusterCommand> leaseHostCommands(String clusterId, String hostname, List<ClusterDeviceInfo> devices, List<String> nextClusterIds, int maxTasksTolease)

为给定主机租用 ClusterCommand

abstract void updateTestContext(String requestId, String commandId, TestContext testContext)

常量

TYPE_NAME

public static final String TYPE_NAME

唯一的配置对象类型名称。用于从 GlobalConfiguration 中检索单例实例。

常量值: "cluster_client"

公共方法

getCommandEventUploader

public abstract IClusterEventUploader<ClusterCommandEvent> getCommandEventUploader ()

获取可用于上传 ClusterCommandEventIClusterEventUploader

返回
IClusterEventUploader<ClusterCommandEvent>

getCommandState

public abstract ClusterCommand.State getCommandState (String requestId, 
                String commandId)

确定集群命令的状态。

参数
requestId String:集群请求 ID

commandId String:集群命令 ID

返回
ClusterCommand.State 集群命令的状态;如果无法确定状态,则为 ClusterCommand.State.UNKNOWN 如果无法确定状态

getCommandStatus

public ClusterCommandStatus getCommandStatus (String requestId, 
                String commandId)

获取集群命令的命令状态(状态和取消原因,如果已取消)。

参数
requestId String:集群请求 ID

commandId String:集群命令 ID

返回
ClusterCommandStatus 一个 ClusterCommandStatus,表示状态和取消原因(如果命令 已取消)。如果无法确定状态,则状态为 ClusterCommand.State.UNKNOWN

getHostEventUploader

public abstract IClusterEventUploader<ClusterHostEvent> getHostEventUploader ()

获取可用于上传 ClusterHostEventIClusterEventUploader

返回
IClusterEventUploader<ClusterHostEvent>

getTestContext

public abstract TestContext getTestContext (String requestId, 
                String commandId)

参数
requestId String

commandId String

返回
TestContext

抛出
IOException
JSONException

getTestEnvironment

public abstract TestEnvironment getTestEnvironment (String requestId)

获取请求的 TestEnvironment

返回
TestEnvironment TestEnvironment 对象。

抛出
java.io.IOException
org.json.JSONException
IOException
JSONException

getTestResources

public abstract List<TestResource> getTestResources (String requestId)

获取请求的 TestResource

返回
List<TestResource> TestResource 的列表。

抛出
java.io.IOException
org.json.JSONException
IOException
JSONException

leaseHostCommands

public abstract List<ClusterCommand> leaseHostCommands (String clusterId, 
                String hostname, 
                List<ClusterDeviceInfo> devices, 
                List<String> nextClusterIds, 
                int maxTasksTolease)

为给定主机租用 ClusterCommand

参数
clusterId String:主机的集群 ID

hostname String:主机名

devices List:主机拥有的 deviceInfos

nextClusterIds List:要从中租用命令的下一个集群 ID 的列表。

maxTasksTolease int:当前可租用的任务数量上限

返回
List<ClusterCommand> ClusterCommand 的列表

抛出
org.json.JSONException
JSONException

updateTestContext

public abstract void updateTestContext (String requestId, 
                String commandId, 
                TestContext testContext)

参数
requestId String

commandId String

testContext TestContext

抛出
IOException
JSONException