client

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Package client provides helper methods and types for starting GAPIR instances and communicating with them. The actual interaction is achieved via the gRPC service defined in: gapir/replay_service/service.proto The client package abstracts the RPC handling details and offers a higher-level interface, in particular it can manage several live GAPIR instances at the same time.

Index

Constants

View Source
const (
	// LaunchArgsKey is the bind device property key used to control the command
	// line arguments when launching GAPIR. The property must be of type []string.
	LaunchArgsKey = "gapir-launch-args"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles multiple GAPIR instances identified by ReplayerKey.

func New

func New(ctx context.Context) *Client

New returns a new Client with no replayers.

func (*Client) BeginReplay

func (client *Client) BeginReplay(ctx context.Context, key *ReplayerKey, payload string, dependent string) error

BeginReplay sends a replay request to the replayer identified by key.

func (*Client) Connect

func (client *Client) Connect(ctx context.Context, device bind.Device, abi *device.ABI) (*ReplayerKey, error)

Connect starts a GAPIR instance and return its ReplayerKey.

func (*Client) PrewarmReplay

func (client *Client) PrewarmReplay(ctx context.Context, key *ReplayerKey, payload string, cleanup string) error

PrewarmReplay requests the GAPIR device to get itself into the given state

func (*Client) SetReplayExecutor

func (client *Client) SetReplayExecutor(ctx context.Context, key *ReplayerKey, executor ReplayExecutor) (func(), error)

SetReplayExecutor assigns a replay executor to the replayer identified by key. It returns a cleanup function to remove the executor once the replay is finished.

type ReplayExecutor

type ReplayExecutor interface {
	// HandlePostData handles the given post data message.
	HandlePostData(context.Context, *gapir.PostData) error
	// HandleNotification handles the given notification message.
	HandleNotification(context.Context, *gapir.Notification) error
	// HandleFinished is notified when the given replay is finished.
	HandleFinished(context.Context, error) error
	// HandleFenceReadyRequest handles when the replayer is waiting for the server
	// to execute the registered FenceReadyRequestCallback for fence ID provided
	// in the FenceReadyRequest.
	HandleFenceReadyRequest(context.Context, *gapir.FenceReadyRequest) error
}

ReplayExecutor must be implemented by replay executors to handle some live interactions with a running replay.

type ReplayerKey

type ReplayerKey struct {
	// contains filtered or unexported fields
}

ReplayerKey is used to uniquely identify a GAPIR instance.

Jump to

Keyboard shortcuts

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