resolver

package
v1.35.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package resolver provides internal resolver-related functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfigSelector

func SetConfigSelector(state resolver.State, cs ConfigSelector) resolver.State

SetConfigSelector sets the config selector in state and returns the new state.

Types

type ConfigSelector

type ConfigSelector interface {
	// Selects the configuration for the RPC, or terminates it using the error.
	// This error will be converted by the gRPC library to a status error with
	// code UNKNOWN if it is not returned as a status error.
	SelectConfig(RPCInfo) (*RPCConfig, error)
}

ConfigSelector controls what configuration to use for every RPC.

func GetConfigSelector

func GetConfigSelector(state resolver.State) ConfigSelector

GetConfigSelector retrieves the config selector from state, if present, and returns it or nil if absent.

type RPCConfig

type RPCConfig struct {
	// The context to use for the remainder of the RPC; can pass info to LB
	// policy or affect timeout or metadata.
	Context      context.Context
	MethodConfig serviceconfig.MethodConfig // configuration to use for this RPC
	OnCommitted  func()                     // Called when the RPC has been committed (retries no longer possible)
}

RPCConfig describes the configuration to use for each RPC.

type RPCInfo

type RPCInfo struct {
	// Context is the user's context for the RPC and contains headers and
	// application timeout.  It is passed for interception purposes and for
	// efficiency reasons.  SelectConfig should not be blocking.
	Context context.Context
	Method  string // i.e. "/Service/Method"
}

RPCInfo contains RPC information needed by a ConfigSelector.

type SafeConfigSelector

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

SafeConfigSelector allows for safe switching of ConfigSelector implementations such that previous values are guaranteed to not be in use when UpdateConfigSelector returns.

func (*SafeConfigSelector) SelectConfig

func (scs *SafeConfigSelector) SelectConfig(r RPCInfo) (*RPCConfig, error)

SelectConfig defers to the current ConfigSelector in scs.

func (*SafeConfigSelector) UpdateConfigSelector

func (scs *SafeConfigSelector) UpdateConfigSelector(cs ConfigSelector)

UpdateConfigSelector swaps to the provided ConfigSelector and blocks until all uses of the previous ConfigSelector have completed.

Directories

Path Synopsis
Package dns implements a dns resolver to be installed as the default resolver in grpc.
Package dns implements a dns resolver to be installed as the default resolver in grpc.
Package passthrough implements a pass-through resolver.
Package passthrough implements a pass-through resolver.
Package unix implements a resolver for unix targets.
Package unix implements a resolver for unix targets.

Jump to

Keyboard shortcuts

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