Documentation ¶
Index ¶
- Constants
- Variables
- func FindOperatorNamespace(clientset *kubernetes.Clientset) (string, error)
- func FindVizierNamespace(clientset *kubernetes.Clientset) (string, error)
- func FirstHealthyVizier(cloudAddr string) (uuid.UUID, error)
- func FormatErrorMessage(err error) string
- func GetCloudAddrFromKubeConfig(config *rest.Config) string
- func GetClusterIDFromKubeConfig(config *rest.Config) uuid.UUID
- func GetCurrentOrFirstHealthyVizier(cloudAddr string) (uuid.UUID, error)
- func GetCurrentVizier(cloudAddr string) (uuid.UUID, error)
- func GetFuncsToExecute(script *script.ExecutableScript) ([]*vizierpb.ExecuteScriptRequest_FuncToExecute, error)
- func GetVizierInfo(cloudAddr string, clusterID uuid.UUID) (*cloudpb.ClusterInfo, error)
- func GetVizierList(cloudAddr string) ([]*cloudpb.ClusterInfo, error)
- func MustFindVizierNamespace() string
- func RunScript(ctx context.Context, conns []*Connector, execScript *script.ExecutableScript, ...) (chan *ExecData, error)
- func RunScriptAndOutputResults(ctx context.Context, conns []*Connector, execScript *script.ExecutableScript, ...) error
- type Connector
- func ConnectHealthyDefaultVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID) ([]*Connector, error)
- func ConnectToAllViziers(cloudAddr string) ([]*Connector, error)
- func ConnectionToHealthyVizierByID(cloudAddr string, clusterID uuid.UUID) (*Connector, error)
- func ConnectionToVizierByID(cloudAddr string, clusterID uuid.UUID) (*Connector, error)
- func MustConnectHealthyDefaultVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID) []*Connector
- func MustConnectVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID, directVzAddr string, ...) []*Connector
- func NewConnector(cloudAddr string, vzInfo *cloudpb.ClusterInfo, directVzAddr string, ...) (*Connector, error)
- func (c *Connector) DebugLogRequest(ctx context.Context, podName string, prev bool, container string) (chan *DebugLogResponse, error)
- func (c *Connector) DebugPodsRequest(ctx context.Context) (chan *DebugPodsResponse, error)
- func (c *Connector) ExecuteScriptStream(ctx context.Context, script *script.ExecutableScript, ...) (chan *ExecData, error)
- type DataFormatter
- type DebugLogResponse
- type DebugPodsResponse
- type ErrorCode
- type ExecData
- type Lister
- type ScriptExecutionError
- type StreamOutputAdapter
- func (v *StreamOutputAdapter) ExecStats() (*vizierpb.QueryExecutionStats, error)
- func (v *StreamOutputAdapter) Finish() error
- func (v *StreamOutputAdapter) Formatters() ([]DataFormatter, error)
- func (v *StreamOutputAdapter) MutationInfo() (*vizierpb.MutationInfo, error)
- func (v *StreamOutputAdapter) TotalBytes() int
- func (v *StreamOutputAdapter) Views() ([]components.TableView, error)
- func (v *StreamOutputAdapter) WaitForCompletion() error
- type StreamWriterFactorFunc
- type TableInfo
Constants ¶
const FormatInMemory string = "inmemory"
FormatInMemory denotes the inmemory format.
Variables ¶
var ( // ErrMetadataMissing is returned when table was malformed missing data. ErrMetadataMissing = errors.New("metadata missing for table") // ErrDuplicateMetadata is returned when table is malformed an contains multiple metadata. ErrDuplicateMetadata = errors.New("duplicate table metadata received") )
Functions ¶
func FindOperatorNamespace ¶
func FindOperatorNamespace(clientset *kubernetes.Clientset) (string, error)
FindOperatorNamespace finds the namespace running the vizier-operator.
func FindVizierNamespace ¶
func FindVizierNamespace(clientset *kubernetes.Clientset) (string, error)
FindVizierNamespace looks for the namespace that the vizier is running in for the current context.
func FirstHealthyVizier ¶
FirstHealthyVizier returns the cluster ID of the first healthy vizier.
func FormatErrorMessage ¶
FormatErrorMessage converts Vizier error messages into stylized strings.
func GetCloudAddrFromKubeConfig ¶
GetCloudAddrFromKubeConfig returns the cloud address given the kubeconfig. If anything fails, then will return an empty string.
func GetClusterIDFromKubeConfig ¶
GetClusterIDFromKubeConfig returns the clusterID given the kubeconfig. If anything fails, then will return a nil UUID.
func GetCurrentOrFirstHealthyVizier ¶
GetCurrentOrFirstHealthyVizier tries to get the vizier from the current context. If unavailable, it gets the ID of the first healthy Vizier.
func GetCurrentVizier ¶
GetCurrentVizier tries to get the ID of the current Vizier, even if it is unhealthy.
func GetFuncsToExecute ¶
func GetFuncsToExecute(script *script.ExecutableScript) ([]*vizierpb.ExecuteScriptRequest_FuncToExecute, error)
GetFuncsToExecute extracts the funcs to execute from the script.
func GetVizierInfo ¶
GetVizierInfo returns the info about the vizier running on the specified cluster, if it exists.
func GetVizierList ¶
func GetVizierList(cloudAddr string) ([]*cloudpb.ClusterInfo, error)
GetVizierList gets a list of all viziers.
func MustFindVizierNamespace ¶
func MustFindVizierNamespace() string
MustFindVizierNamespace exits the current program if a Vizier namespace can't be found.
func RunScript ¶
func RunScript(ctx context.Context, conns []*Connector, execScript *script.ExecutableScript, encOpts *vizierpb.ExecuteScriptRequest_EncryptionOptions) (chan *ExecData, error)
RunScript runs the script and return the data channel
func RunScriptAndOutputResults ¶
func RunScriptAndOutputResults(ctx context.Context, conns []*Connector, execScript *script.ExecutableScript, format string, useEncryption bool) error
RunScriptAndOutputResults runs the specified script on vizier and outputs based on format string.
Types ¶
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector is an interface to Vizier.
func ConnectHealthyDefaultVizier ¶
func ConnectHealthyDefaultVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID) ([]*Connector, error)
ConnectHealthyDefaultVizier connects to the healthy default vizier based on parameters.
func ConnectToAllViziers ¶
ConnectToAllViziers connects to all available viziers.
func ConnectionToHealthyVizierByID ¶
ConnectionToHealthyVizierByID connects to the input clusterID if it is healthy. It returns an error if the clusterID provided corresponds to a cluster that is not healthy.
func ConnectionToVizierByID ¶
ConnectionToVizierByID connects to the vizier on specified ID. It will not check for Vizier health.
func MustConnectHealthyDefaultVizier ¶
func MustConnectHealthyDefaultVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID) []*Connector
MustConnectHealthyDefaultVizier vizier will connect to default vizier based on parameters.
func MustConnectVizier ¶
func MustConnectVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID, directVzAddr string, directKey string) []*Connector
MustConnectVizier will connect to Pixie cloud or directly to a vizier service.
func NewConnector ¶
func NewConnector(cloudAddr string, vzInfo *cloudpb.ClusterInfo, directVzAddr string, directVzKey string) (*Connector, error)
NewConnector returns a new connector.
func (*Connector) DebugLogRequest ¶
func (c *Connector) DebugLogRequest(ctx context.Context, podName string, prev bool, container string) (chan *DebugLogResponse, error)
DebugLogRequest sends a debug log request and returns data in a chan.
func (*Connector) DebugPodsRequest ¶
func (c *Connector) DebugPodsRequest(ctx context.Context) (chan *DebugPodsResponse, error)
DebugPodsRequest sends a debug pods request and returns data in a chan.
func (*Connector) ExecuteScriptStream ¶
func (c *Connector) ExecuteScriptStream(ctx context.Context, script *script.ExecutableScript, encOpts *vizierpb.ExecuteScriptRequest_EncryptionOptions) (chan *ExecData, error)
ExecuteScriptStream execute a vizier query as a stream.
type DataFormatter ¶
type DataFormatter interface { // FormatValue formats the value for a particular column. FormatValue(colIdx int, val interface{}) interface{} }
DataFormatter formats data for a given Relation.
func NewDataFormatterForTable ¶
func NewDataFormatterForTable(relation *vizierpb.Relation) DataFormatter
NewDataFormatterForTable creates a new data formatter based on the input relation.
type DebugLogResponse ¶
DebugLogResponse contains information about debug logs.
type DebugPodsResponse ¶
type DebugPodsResponse struct { ControlPlanePods []*vizierpb.VizierPodStatus DataPlanePods []*vizierpb.VizierPodStatus Err error }
DebugPodsResponse contains information about debug logs.
type ErrorCode ¶
type ErrorCode int
ErrorCode is the base type for vizier error codes.
const ( // CodeUnknown is placeholder for unknown errors. CodeUnknown ErrorCode = iota // CodeTimeout is for execution timeouts. CodeTimeout // CodeBadData occurs when bad data/format is received from vizier. CodeBadData // CodeGRPCError is used for GRPC errors. CodeGRPCError // CodeCompilerError is used for compilations errors. CodeCompilerError // CodeCanceled is used for script cancellation. CodeCanceled )
func GetErrorCode ¶
GetErrorCode gets the error code for vizier errors.
type ExecData ¶
type ExecData struct { Resp *vizierpb.ExecuteScriptResponse ClusterID uuid.UUID Err error }
ExecData contains information from script executions.
type Lister ¶
type Lister struct {
// contains filtered or unexported fields
}
Lister allows fetching information about Viziers from the cloud.
func (*Lister) GetVizierInfo ¶
GetVizierInfo returns information about a connected vizier.
func (*Lister) GetViziersInfo ¶
func (l *Lister) GetViziersInfo() ([]*cloudpb.ClusterInfo, error)
GetViziersInfo returns information about connected viziers.
type ScriptExecutionError ¶
type ScriptExecutionError struct {
// contains filtered or unexported fields
}
ScriptExecutionError occurs for errors during script execution on vizier.
func (*ScriptExecutionError) Code ¶
func (s *ScriptExecutionError) Code() ErrorCode
Code returns the error code.
func (*ScriptExecutionError) CompilerErrors ¶
func (s *ScriptExecutionError) CompilerErrors() []string
CompilerErrors returns compiler errors as strings if any.
func (*ScriptExecutionError) Error ¶
func (s *ScriptExecutionError) Error() string
Error returns the errors message.
type StreamOutputAdapter ¶
type StreamOutputAdapter struct {
// contains filtered or unexported fields
}
StreamOutputAdapter adapts the vizier output to the StreamWriters.
func NewStreamOutputAdapter ¶
func NewStreamOutputAdapter(ctx context.Context, stream chan *ExecData, format string, decOpts *vizierpb.ExecuteScriptRequest_EncryptionOptions) *StreamOutputAdapter
NewStreamOutputAdapter creates a new vizier output adapter.
func NewStreamOutputAdapterWithFactory ¶
func NewStreamOutputAdapterWithFactory(ctx context.Context, stream chan *ExecData, format string, decOpts *vizierpb.ExecuteScriptRequest_EncryptionOptions, factoryFunc func(*vizierpb.ExecuteScriptResponse_MetaData) components.OutputStreamWriter) *StreamOutputAdapter
NewStreamOutputAdapterWithFactory creates a new vizier output adapter factory.
func (*StreamOutputAdapter) ExecStats ¶
func (v *StreamOutputAdapter) ExecStats() (*vizierpb.QueryExecutionStats, error)
ExecStats returns the reported execution stats. This function is only valid with format = inmemory and after Finish.
func (*StreamOutputAdapter) Finish ¶
func (v *StreamOutputAdapter) Finish() error
Finish must be called to wait for the output and flush all the data.
func (*StreamOutputAdapter) Formatters ¶
func (v *StreamOutputAdapter) Formatters() ([]DataFormatter, error)
Formatters gets all the data formatters. This function is only valid with format = inmemory and after Finish.
func (*StreamOutputAdapter) MutationInfo ¶
func (v *StreamOutputAdapter) MutationInfo() (*vizierpb.MutationInfo, error)
MutationInfo returns the mutation info. This function is only valid after Finish.
func (*StreamOutputAdapter) TotalBytes ¶
func (v *StreamOutputAdapter) TotalBytes() int
TotalBytes returns the total bytes of messages passed to this adapter.
func (*StreamOutputAdapter) Views ¶
func (v *StreamOutputAdapter) Views() ([]components.TableView, error)
Views gets all the accumulated views. This function is only valid with format = inmemory and after Finish.
func (*StreamOutputAdapter) WaitForCompletion ¶
func (v *StreamOutputAdapter) WaitForCompletion() error
WaitForCompletion waits for the stream to complete, but does not flush the data.
type StreamWriterFactorFunc ¶
type StreamWriterFactorFunc = func(md *vizierpb.ExecuteScriptResponse_MetaData) components.OutputStreamWriter
StreamWriterFactorFunc is a stream writer factory.