builder

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: Zlib Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	// Addr is the server address on which a connection will be established.
	Addr string

	// ServerName is the name of this address.
	// If non-empty, the ServerName is used as the transport certification authority for
	// the address, instead of the hostname from the Dial target string. In most cases,
	// this should not be set.
	//
	// If RpcMethod is GRPCLB, ServerName should be the name of the remote load
	// balancer, not the name of the backend.
	//
	// WARNING: ServerName must only be populated with trusted values. It
	// is insecure to populate it with data from untrusted inputs since untrusted
	// values could be used to bypass the authority checks performed by TLS.
	ServerName string

	// Attributes contains arbitrary data about this address intended for
	// consumption by the load balancing policy.
	Attributes *attributes.Attributes
}

Notice: This type is EXPERIMENTAL and may be changed or removed in a later release.

type Builder

type Builder interface {
	// Build creates a new resolver for the given target.
	//
	// gRPC dial calls Build synchronously, and fails if the returned error is
	// not nil.
	Build(target Target, cc Connector) (Resolver, error)

	// Scheme returns the scheme supported by this resolver.
	Scheme() string

	// RpcMethod grpc or thrift
	RpcMethod() string
}

Builder creates a resolver that will be used to watch name resolution updates.

type Connector

type Connector interface {
	// UpdateState updates the state of the ClientConn appropriately.
	UpdateState(State)

	// ReportError notifies the ClientConn that the Resolver encountered an
	// error.  The ClientConn will notify the load balancer and begin calling
	// ResolveNow on the Resolver with exponential backoff.
	ReportError(error)
}

type Resolver

type Resolver interface {
	// ResolveNow will be called by gRPC to try to resolve the target name
	// again. It's just a hint, resolver can ignore this if it's not necessary.
	//
	// It could be called multiple times concurrently.
	ResolveNow()

	// Close closes the resolver.
	Close()
}

Resolver watches for the updates on the specified target. Updates include address updates and service config updates.

type State

type State struct {
	// Addresses is the latest set of resolved addresses for the target.
	Addresses []Address

	// Attributes contains arbitrary data about the resolver intended for
	// consumption by the load balancing policy.
	Attributes *attributes.Attributes
}

State contains the current Resolver state relevant to the ClientConn.

type Target

type Target struct {
	Scheme    string
	Authority string
	Endpoint  string
}

Target

  • "dns://some_authority/foo.bar" Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"}

Jump to

Keyboard shortcuts

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