grpc: google.golang.org/grpc/balancer/rls/internal/keys Index | Files

package keys

import "google.golang.org/grpc/balancer/rls/internal/keys"

Package keys provides functionality required to build RLS request keys.

Index

Package Files

builder.go

type BuilderMap Uses

type BuilderMap map[string]builder

BuilderMap provides a mapping from a request path to the key builder to be used for that path. The BuilderMap is constructed by parsing the RouteLookupConfig received by the RLS balancer as part of its ServiceConfig, and is used by the picker in the data path to build the RLS keys to be used for a given request.

func MakeBuilderMap Uses

func MakeBuilderMap(cfg *rlspb.RouteLookupConfig) (BuilderMap, error)

MakeBuilderMap parses the provided RouteLookupConfig proto and returns a map from paths to key builders.

The following conditions are validated, and an error is returned if any of them is not met: grpc_keybuilders field * must have at least one entry * must not have two entries with the same Name * must not have any entry with a Name with the service field unset or empty * must not have any entries without a Name * must not have a headers entry that has required_match set * must not have two headers entries with the same key within one entry

func (BuilderMap) Equal Uses

func (bm BuilderMap) Equal(am BuilderMap) bool

Equal reports whether bm and am represent equivalent BuilderMaps.

func (BuilderMap) RLSKey Uses

func (bm BuilderMap) RLSKey(md metadata.MD, path string) KeyMap

RLSKey builds the RLS keys to be used for the given request, identified by the request path and the request headers stored in metadata.

type KeyMap Uses

type KeyMap struct {
    // Map is the representation of an RLS key as a Go map. This is used when
    // an actual RLS request is to be sent out on the wire, since the
    // RouteLookupRequest proto expects a Go map.
    Map map[string]string
    // Str is the representation of an RLS key as a string, sorted by keys.
    // Since the RLS keys are part of the cache key in the request cache
    // maintained by the RLS balancer, and Go maps cannot be used as keys for
    // Go maps (the cache is implemented as a map), we need a stringified
    // version of it.
    Str string
}

KeyMap represents the RLS keys to be used for a request.

Package keys imports 6 packages (graph) and is imported by 1 packages. Updated 2020-08-08. Refresh now. Tools for package owners.