client

package
v0.0.0-...-7a622f3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package client implements a client for the Perfetto consumer API. This is an internal package only to be used from within the gapis/perfetto package and provides implementation details for the perfetto.Client class.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindHandler

type BindHandler func(methods map[string]*Method, err error)

BindHandler is the callback invoked when the Bind completes.

type BindSync

type BindSync struct {
	Handler BindHandler
	// contains filtered or unexported fields
}

BindSync is a sync helper to turn async Bind calls into sync ones. Use the Handler struct member in calling Bind() and then call Wait.

func NewBindSync

func NewBindSync(ctx context.Context) *BindSync

NewBindSync returns a new BindSync.

func (*BindSync) Wait

func (s *BindSync) Wait(ctx context.Context) (map[string]*Method, error)

Wait waits on the sync and returns the result of the Bind call.

type Connection

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

Connection is a connection to the Perfetto service.

func Connect

func Connect(ctx context.Context, conn net.Conn, cleanup app.Cleanup) (*Connection, error)

Connect creates a new connection that uses the established socket to communicate with the Perfetto service.

func (*Connection) Bind

func (c *Connection) Bind(ctx context.Context, service string, handler BindHandler) error

Bind binds to the given proto service.

func (*Connection) Close

func (c *Connection) Close(ctx context.Context)

Close closes this connection and the underlying socket.

func (*Connection) Invoke

func (c *Connection) Invoke(ctx context.Context, m *Method, args proto.Message, handler InvokeHandler) error

Invoke invokes the given method and calls the handler on a response.

type InvokeHandler

type InvokeHandler func(data []byte, more bool, err error)

InvokeHandler is the callback invoked when an Invoke gets a response. For streaming RPCs it may be invoked multiple times.

func NewIgnoreHandler

func NewIgnoreHandler(ctx context.Context, cb func(error)) InvokeHandler

NewIgnoreHandler returns an InvokeHanlder that ignores the returned result, but propagates errors and ensure the response is not streaming.

func NewReadHandler

func NewReadHandler(ctx context.Context, cb func(*ipc.ReadBuffersResponse, bool, error)) InvokeHandler

NewReadHandler returns an InvokeHandler that handles unmarshalling the proto bytes of a ReadBuffers response and invokes the given callback.

func NewTraceHandler

func NewTraceHandler(ctx context.Context, cb func(*ipc.EnableTracingResponse, error)) InvokeHandler

NewTraceHandler returns an InvokeHandler that handles unmarshalling the proto bytes of an EnableTrace response and invokes the given callback.

type InvokeSync

type InvokeSync struct {
	Handler InvokeHandler
	// contains filtered or unexported fields
}

InvokeSync is a sync helper to turn async Invoke calls into sync ones. Use the Handler struct member in calling Invoke() and then call Wait.

func NewInvokeSync

func NewInvokeSync(ctx context.Context, cb func(data []byte) error) *InvokeSync

NewInvokeSync returns a new InvokeSync. The given callback is called upon every successful streamed result.

func NewQuerySync

func NewQuerySync(ctx context.Context, cb func(*common.TracingServiceState) error) *InvokeSync

NewQuerySync returns an InvokeSync that handles unmarshalling the proto bytes and invokes the given callback.

func (*InvokeSync) Wait

func (s *InvokeSync) Wait(ctx context.Context) error

Wait waits on the sync and returns the error the Invoke call.

type Method

type Method struct {
	Name string
	// contains filtered or unexported fields
}

Method represents an RPC method that can be called on the Perfetto service.

type PacketWriter

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

PacketWriter serializes Perfetto packets to a Writer.

func NewPacketWriter

func NewPacketWriter(out io.Writer) *PacketWriter

NewPacketWriter returns a packet writer that serializes to the given writer.

func (*PacketWriter) Write

func (w *PacketWriter) Write(slices []*ipc.ReadBuffersResponse_Slice) error

Write serializes the given packet slices.

Jump to

Keyboard shortcuts

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