MCPcopy
hub / github.com/grpc/grpc-go / headerHashRoute

Function headerHashRoute

balancer/ringhash/ringhash_e2e_test.go:716–728  ·  view source on GitHub ↗

headerHashRoute creates a RouteConfiguration with a hash policy that uses the provided header.

(routeName, virtualHostName, clusterName, header string)

Source from the content-addressed store, hash-verified

714// headerHashRoute creates a RouteConfiguration with a hash policy that uses the
715// provided header.
716func headerHashRoute(routeName, virtualHostName, clusterName, header string) *v3routepb.RouteConfiguration {
717 route := e2e.DefaultRouteConfig(routeName, virtualHostName, clusterName)
718 hashPolicy := v3routepb.RouteAction_HashPolicy{
719 PolicySpecifier: &v3routepb.RouteAction_HashPolicy_Header_{
720 Header: &v3routepb.RouteAction_HashPolicy_Header{
721 HeaderName: header,
722 },
723 },
724 }
725 action := route.VirtualHosts[0].Routes[0].Action.(*v3routepb.Route_Route)
726 action.Route.HashPolicy = []*v3routepb.RouteAction_HashPolicy{&hashPolicy}
727 return route
728}
729
730// Tests that ring hash policy that hashes using a header value can send RPCs
731// to specific backends based on their hash.

Calls 1

DefaultRouteConfigFunction · 0.92

Tested by

no test coverage detected