pxapi

package
v0.0.0-...-18b1827 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package pxapi provides the Go client interface for Pixie. WARNING: The API defined in this package is not stable and can change without notice. The same goes for the package path: (github.com/pixie-labs/pixie/api/go)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProtoFromUUIDStrOrNil

func ProtoFromUUIDStrOrNil(u string) *pb.UUID

ProtoFromUUIDStrOrNil generates proto from string representation of a UUID (nil value is used if parsing fails).

func ProtoToUUIDStr

func ProtoToUUIDStr(pb *pb.UUID) string

ProtoToUUIDStr generates an expensive string representation of a UUID proto.

Types

type Client

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

Client is the base client to use pixie cloud + vizier.

func NewClient

func NewClient(ctx context.Context, opts ...ClientOption) (*Client, error)

NewClient creates a new Pixie API Client.

func (*Client) GetVizierInfo

func (c *Client) GetVizierInfo(ctx context.Context, clusterID string) (*VizierInfo, error)

GetVizierInfo gets info about the given clusterID.

func (*Client) ListViziers

func (c *Client) ListViziers(ctx context.Context) ([]*VizierInfo, error)

ListViziers gets a list of Viziers registered with Pixie.

func (*Client) NewVizierClient

func (c *Client) NewVizierClient(ctx context.Context, vizierID string) (*VizierClient, error)

NewVizierClient creates a new vizier client, for the passed in vizierID.

type ClientOption

type ClientOption func(client *Client)

ClientOption configures options on the client.

func WithAPIKey

func WithAPIKey(auth string) ClientOption

WithAPIKey is the option to specify the API key to use.

func WithBearerAuth

func WithBearerAuth(auth string) ClientOption

WithBearerAuth is the option to specify bearer auth to use.

func WithCloudAddr

func WithCloudAddr(cloudAddr string) ClientOption

WithCloudAddr is the option to specify cloud address to use.

type ResultsStats

type ResultsStats struct {
	AcceptedBytes int64
	TotalBytes    int64

	ExecutionTime    time.Duration
	CompilationTime  time.Duration
	BytesProcessed   int64
	RecordsProcessed int64
}

ResultsStats stores statistics about the data.

type ScriptResults

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

ScriptResults tracks the results of a script, and provides mechanisms to cancel, etc.

func (*ScriptResults) Close

func (s *ScriptResults) Close() error

Close will terminate the call.

func (*ScriptResults) Stats

func (s *ScriptResults) Stats() *ResultsStats

Stats returns the execution and script stats.

func (*ScriptResults) Stream

func (s *ScriptResults) Stream() error

Stream will start streaming the results. Since the API is streaming fist, even a non streaming script requires this to be called to get all the results.

type TableMuxer

type TableMuxer interface {
	// AcceptTable is passed the table information, if nil is returned then the table stream is ignored.
	AcceptTable(ctx context.Context, metadata types.TableMetadata) (TableRecordHandler, error)
}

TableMuxer is an interface to route tables to the correct handler.

type TableRecordHandler

type TableRecordHandler interface {
	// HandleInit is called to initialize the table handler interface.
	HandleInit(ctx context.Context, metadata types.TableMetadata) error
	// HandleRecord is called whenever a new row of the data is available.
	HandleRecord(ctx context.Context, record *types.Record) error
	// HandleDone is called when the table streaming has been completed.
	HandleDone(ctx context.Context) error
}

TableRecordHandler is an interface that processes a table record-wise.

type VizierClient

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

VizierClient is the client for a single vizier.

func (*VizierClient) ExecuteScript

func (v *VizierClient) ExecuteScript(ctx context.Context, pxl string, mux TableMuxer) (*ScriptResults, error)

ExecuteScript runs the script on vizier.

type VizierInfo

type VizierInfo struct {
	// Name of the vizier.
	Name string
	// ID of the Vizier (uuid as a string).
	ID string
	// Status of the Vizier.
	Status VizierStatus
	// Version of the installed vizier.
	Version string
	// DirectAccess says the cluster has direct access mode enabled. This means the data transfer will bypass the cloud.
	DirectAccess bool
}

VizierInfo has information of a single Vizier.

type VizierStatus

type VizierStatus string

VizierStatus stores the enumeration of all vizier statuses.

const (
	VizierStatusUnknown      VizierStatus = "Unknown"
	VizierStatusHealthy      VizierStatus = "Healthy"
	VizierStatusUnhealthy    VizierStatus = "Unhealthy"
	VizierStatusDisconnected VizierStatus = "Disconnected"
)

Vizier Statuses.

Directories

Path Synopsis
Package errdefs has the public error types used by the API.
Package errdefs has the public error types used by the API.
Package types tracks all the Pixie types used in the Go API.
Package types tracks all the Pixie types used in the Go API.

Jump to

Keyboard shortcuts

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