package hierarchy
import "google.golang.org/grpc/internal/hierarchy"
Package hierarchy contains functions to set and get hierarchy string from addresses.
This package is experimental.
Index ¶
- func FromEndpoint(endpoint resolver.Endpoint) []string
- func Group(endpoints []resolver.Endpoint) map[string][]resolver.Endpoint
- func SetInEndpoint(endpoint resolver.Endpoint, path []string) resolver.Endpoint
Functions ¶
func FromEndpoint ¶
FromEndpoint returns the hierarchical path of endpoint.
func Group ¶
Group splits a slice of endpoints into groups based on the first hierarchy path. The first hierarchy path will be removed from the result.
Input: [
{endpoint0, path: [p0, wt0]}
{endpoint1, path: [p0, wt1]}
{endpoint2, path: [p1, wt2]}
{endpoint3, path: [p1, wt3]}
]
Endpoints will be split into p0/p1, and the p0/p1 will be removed from the path.
Output:
{
p0: [
{endpoint0, path: [wt0]},
{endpoint1, path: [wt1]},
],
p1: [
{endpoint2, path: [wt2]},
{endpoint3, path: [wt3]},
],
}
If hierarchical path is not set, or has no path in it, the endpoint is dropped.
func SetInEndpoint ¶
SetInEndpoint overrides the hierarchical path in endpoint with path.
Source Files ¶
hierarchy.go
- Version
- v1.80.0-dev
- Published
- Jan 21, 2026
- Platform
- windows/amd64
- Imports
- 1 packages
- Last checked
- 6 minutes ago –
Tools for package owners.