Documentation
¶
Overview ¶
Package client provides helper methods and types for communicating with the GAPIR service.
Index ¶
- Constants
- type Client
- type Connection
- func (c *Connection) BeginReplay(ctx context.Context, id string, dep string) error
- func (c *Connection) Close()
- func (c *Connection) HandleReplayCommunication(ctx context.Context, handler ReplayResponseHandler, connected chan error) error
- func (c *Connection) Ping(ctx context.Context) error
- func (c *Connection) PrewarmReplay(ctx context.Context, payload string, cleanup string) error
- func (c *Connection) SendPayload(ctx context.Context, payload Payload) error
- func (c *Connection) SendResources(ctx context.Context, resources []byte) error
- func (c *Connection) Shutdown(ctx context.Context) error
- type CrashDump
- type Notification
- type Payload
- type PostData
- type ReplayResponseHandler
- type ResourceInfo
- type ResourceRequest
- type Resources
- type Severity
Constants ¶
const LaunchArgsKey tyLaunchArgsKey = "<gapir-launch-args>"
LaunchArgsKey is the bind device property key used to control the command line arguments when launching GAPIR. The property must be of type []string.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is interface used to connect to GAPIR instances on devices.
type Connection ¶ added in v1.2.0
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a connection between GAPIS and GAPIR. It wraps the internal gRPC connections and holds authentication token. A new Connection should be created only by client.Client. TODO: The functionality of replay stream and Ping/Shutdown can be separated. The GAPIS code should only use the replay stream, Ping/Shutdown should be managed by client.session.
func (*Connection) BeginReplay ¶ added in v1.3.1
BeginReplay begins a replay stream connection and attach the authentication, if any, token in the metadata.
func (*Connection) Close ¶ added in v1.2.0
func (c *Connection) Close()
Close shutdown the GAPIR connection.
func (*Connection) HandleReplayCommunication ¶ added in v1.2.0
func (c *Connection) HandleReplayCommunication( ctx context.Context, handler ReplayResponseHandler, connected chan error) error
HandleReplayCommunication handles the communication with the GAPIR device on a replay stream connection. It sends a replay request with the given replayID to the connected GAPIR device, expects the device to request payload and sends the given payload to the device. Then for each received message from the device, it determines the type of the message and pass it to the corresponding given handler to process the type-checked message.
func (*Connection) Ping ¶ added in v1.2.0
func (c *Connection) Ping(ctx context.Context) error
Ping sends a ping to the connected GAPIR device and expect a response to make sure the connection is alive.
func (*Connection) PrewarmReplay ¶ added in v1.3.1
PrewarmReplay requests the GAPIR device to get itself into the given state
func (*Connection) SendPayload ¶ added in v1.2.0
func (c *Connection) SendPayload(ctx context.Context, payload Payload) error
SendPayload sends the given payload to the connected GAPIR device.
func (*Connection) SendResources ¶ added in v1.2.0
func (c *Connection) SendResources(ctx context.Context, resources []byte) error
SendResources sends the given resources data to the connected GAPIR device.
type CrashDump ¶ added in v1.2.0
CrashDump contains the Filepath of the crash dump file on GAPIR device, and the CrashData in bytes
type Notification ¶ added in v1.2.0
type Notification = replaysrv.Notification
Notification contains an Id, the ApiIndex, Label, Msg in string and arbitary Data in bytes.
type Payload ¶ added in v1.2.0
Payload contains StackSize, VolatileMemorySize, Constants, a list of information of Resources, and Opcodes for replay in bytes.
type PostData ¶ added in v1.2.0
PostData contains a list of PostDataPieces, each piece contains an Id in string and Data in bytes
type ReplayResponseHandler ¶ added in v1.2.0
type ReplayResponseHandler interface { // HandlePayloadRequest handles the given payload request message. HandlePayloadRequest(context.Context, string, *Connection) error // HandleResourceRequest handles the given resource request message. HandleResourceRequest(context.Context, *ResourceRequest, *Connection) error // HandleCrashDump handles the given crash dump message. HandleCrashDump(context.Context, *CrashDump, *Connection) error // HandlePostData handles the given post data message. HandlePostData(context.Context, *PostData, *Connection) error // HandleNotification handles the given notification message. HandleNotification(context.Context, *Notification, *Connection) error // HandleFinished handles the replay complete HandleFinished(context.Context, error, *Connection) error }
ReplayResponseHandler handles all kinds of ReplayResponse messages received from a connected GAPIR device.
type ResourceInfo ¶ added in v1.2.0
type ResourceInfo = replaysrv.ResourceInfo
ResourceInfo contains Id and Size information of a resource.
type ResourceRequest ¶ added in v1.2.0
type ResourceRequest = replaysrv.ResourceRequest
ResourceRequest contains the total expected size of requested resources data in bytes and the Ids of the resources to be requested.