...

Package priority

import "google.golang.org/grpc/xds/internal/balancer/priority"
Overview
Index

Overview ▾

Package priority implements the priority balancer.

This balancer will be kept in internal until we use it in the xds balancers, and are confident its functionalities are stable. It will then be exported for more users.

Constants

Name is the name of the priority balancer.

const Name = "priority_experimental"

Variables

var (
    // ErrAllPrioritiesRemoved is returned by the picker when there's no priority available.
    ErrAllPrioritiesRemoved = errors.New("no priority is provided, all priorities are removed")
    // DefaultPriorityInitTimeout is the timeout after which if a priority is
    // not READY, the next will be started. It's exported to be overridden by
    // tests.
    DefaultPriorityInitTimeout = 10 * time.Second
)

DefaultSubBalancerCloseTimeout is defined as a variable instead of const for testing.

var DefaultSubBalancerCloseTimeout = 15 * time.Minute

type Child

Child is a child of priority balancer.

type Child struct {
    Config                     *internalserviceconfig.BalancerConfig `json:"config,omitempty"`
    IgnoreReresolutionRequests bool                                  `json:"ignoreReresolutionRequests,omitempty"`
}

type LBConfig

LBConfig represents priority balancer's config.

type LBConfig struct {
    serviceconfig.LoadBalancingConfig `json:"-"`

    // Children is a map from the child balancer names to their configs. Child
    // names can be found in field Priorities.
    Children map[string]*Child `json:"children,omitempty"`
    // Priorities is a list of child balancer names. They are sorted from
    // highest priority to low. The type/config for each child can be found in
    // field Children, with the balancer name as the key.
    Priorities []string `json:"priorities,omitempty"`
}