channel

package
v35.0.0-...-5880ead Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseBuilder

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

BaseBuilder is used to parse the different parameters of the connection string according to the specification documented here:

https://github.com/apache/spark/blob/master/connector/connect/docs/client-connection-string.md

func NewBuilder

func NewBuilder(connection string) (*BaseBuilder, error)

NewBuilder creates a new instance of the BaseBuilder. This constructor effectively parses the connection string and extracts the relevant parameters directly.

The following parameters to the connection string are reserved: user_id, session_id, use_ssl, and token. These parameters are not allowed to be injected as headers.

func (*BaseBuilder) Build

func (cb *BaseBuilder) Build(ctx context.Context) (*grpc.ClientConn, error)

Build finalizes the creation of the gprc.ClientConn by creating a GRPC channel with the necessary options extracted from the connection string. For TLS connections, this function will load the system certificates.

func (*BaseBuilder) Headers

func (cb *BaseBuilder) Headers() map[string]string

func (*BaseBuilder) Host

func (cb *BaseBuilder) Host() string

func (*BaseBuilder) Port

func (cb *BaseBuilder) Port() int

func (*BaseBuilder) SessionId

func (cb *BaseBuilder) SessionId() string

func (*BaseBuilder) Token

func (cb *BaseBuilder) Token() string

func (*BaseBuilder) User

func (cb *BaseBuilder) User() string

type Builder

type Builder interface {
	// Build creates the grpc.ClientConn according to the configuration of the builder.
	// Implementations are free to provide additional paramters in their implementation
	// and simply must satisfy this minimal set of requirements.
	Build(ctx context.Context) (*grpc.ClientConn, error)
	// User identifies the username passed as part of the Spark Connect requests.
	User() string
	// Headers refers to the request metadata that is passed for every request from the
	// client to the server.
	Headers() map[string]string
	// SessionId identifies the client side session identifier. This value must be a UUID formatted
	// as a string.
	SessionId() string
}

Builder is the interface that is used to implement different patterns that create the GRPC connection.

This allows other consumers to plugin custom authentication and authorization handlers without having to extend directly the Spark Connect code.

type ChannelBuilder deprecated

type ChannelBuilder = BaseBuilder

ChannelBuilder re-exports BaseBuilder as its previous name for compatibility.

Deprecated: use BaseBuilder instead.

Jump to

Keyboard shortcuts

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