internal

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package internal supports the options and transport packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Creds

func Creds(ctx context.Context, ds *DialSettings) (*google.Credentials, error)

Creds returns credential information obtained from DialSettings, or if none, then it returns default credential information.

Types

type DialSettings

type DialSettings struct {
	Endpoint        string
	Scopes          []string
	TokenSource     oauth2.TokenSource
	Credentials     *google.Credentials
	CredentialsFile string // if set, Token Source is ignored.
	CredentialsJSON []byte
	UserAgent       string
	APIKey          string
	Audiences       []string
	HTTPClient      *http.Client
	GRPCDialOpts    []grpc.DialOption
	GRPCConn        *grpc.ClientConn
	NoAuth          bool

	// Google API system parameters. For more information please read:
	// https://cloud.google.com/apis/docs/system-parameters
	QuotaProject  string
	RequestReason string
}

DialSettings holds information needed to establish a connection with a Google API service.

func (*DialSettings) Validate

func (ds *DialSettings) Validate() error

Validate reports an error if ds is invalid.

type Operation added in v1.0.1

type Operation uint8
const Add Operation = iota

type PoolResolver

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

PoolResolver provides a fixed list of addresses to load balance between and does not provide further updates.

func NewPoolResolver

func NewPoolResolver(size int, o *DialSettings) *PoolResolver

NewPoolResolver returns a PoolResolver This is an EXPERIMENTAL API and may be changed or removed in the future.

func (*PoolResolver) Close

func (r *PoolResolver) Close()

Close releases resources associated with the pool and causes Next to unblock.

func (*PoolResolver) Next

func (r *PoolResolver) Next() ([]*Update, error)

Next returns a static list of updates on the first call, and blocks indefinitely until Close is called on subsequent calls.

func (*PoolResolver) Resolve

func (r *PoolResolver) Resolve(target string) (Watcher, error)

Resolve returns a Watcher for the endpoint defined by the DialSettings provided to NewPoolResolver.

type Update added in v1.0.1

type Update struct {
	// Op indicates the operation of the update.
	Op Operation
	// Addr is the updated address. It is empty string if there is no address update.
	Addr string
	// Metadata is the updated metadata. It is nil if there is no metadata update.
	// Metadata is not required for a custom naming implementation.
	Metadata interface{}
}

type Watcher added in v1.0.1

type Watcher interface {
	// Next blocks until an update or error happens. It may return one or more
	// updates. The first call should get the full set of the results. It should
	// return an error if and only if Watcher cannot recover.
	Next() ([]*Update, error)
	// Close closes the Watcher.
	Close()
}

Jump to

Keyboard shortcuts

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