client

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2019 License: Apache-2.0 Imports: 32 Imported by: 14

Documentation

Overview

Package client provides helper methods and types for communicating with the GAPIR service.

Index

Constants

View Source
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.

func New

func New(ctx context.Context) *Client

New returns a newly construct Client.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, d bind.Device, abi *device.ABI) (*Connection, error)

Connect opens a connection to the replay device.

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

func (c *Connection) BeginReplay(ctx context.Context, id string, dep string) error

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

func (c *Connection) PrewarmReplay(ctx context.Context, payload string, cleanup string) error

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.

func (*Connection) Shutdown added in v1.2.0

func (c *Connection) Shutdown(ctx context.Context) error

Shutdown sends a signal to the connected GAPIR device to shutdown the connection server.

type CrashDump added in v1.2.0

type CrashDump = replaysrv.CrashDump

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

type Payload = replaysrv.Payload

Payload contains StackSize, VolatileMemorySize, Constants, a list of information of Resources, and Opcodes for replay in bytes.

type PostData added in v1.2.0

type PostData = replaysrv.PostData

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.

type Resources added in v1.2.0

type Resources = replaysrv.Resources

Resources contains a list of byte arrays Data each represent the data of a resource

type Severity added in v1.2.0

type Severity = severity.Severity

Severity represents the severity level of notification messages. It uses the same enum as gapis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL