ytclient

package
v0.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromConnParams

func FromConnParams(cfg ConnParams, lgr log.Logger) (yt.Client, error)

func NewYtClientWrapper

func NewYtClientWrapper(clientType ClientType, lgr log.Logger, ytConfig *yt.Config) (yt.Client, error)

NewYtClientWrapper creates YT client and make operations to extract correct logger for YT from second parameter which user passes. You may also can pass any logger or none at all (nil), then it should work properly as you create client with NewClient function of YT library by yourself.

Usage example with four commonly used parameters around Data Transfer code:

client, err := ytclient.NewYtClientWrapper(ytclient.HTTP, logger, &yt.Config{
	Proxy:                 dst.Cluster(),
	Token:                 dst.Token(),
	AllowRequestsFromJob:  true,
	DisableProxyDiscovery: dst.GetConnectionData().DisableProxyDiscovery,
})
if err != nil {
	return nil, xerrors.Errorf("unable to initialize yt client: %w", err)
}

Types

type ClientType

type ClientType string
const (
	HTTP ClientType = "http"
	RPC  ClientType = "rpd"
)

type ConnParams

type ConnParams interface {
	Proxy() string
	Token() string
	DisableProxyDiscovery() bool
	CompressionCodec() yt.ClientCompressionCodec
}

Jump to

Keyboard shortcuts

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