grpc: google.golang.org/grpc/internal/hierarchy Index | Files

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

Package Files

hierarchy.go

func Get Uses

func Get(addr resolver.Address) []string

Get returns the hierarchical path of addr.

func Group Uses

func Group(addrs []resolver.Address) map[string][]resolver.Address

Group splits a slice of addresses into groups based on the first hierarchy path. The first hierarchy path will be removed from the result.

Input: [

{addr0, path: [p0, wt0]}
{addr1, path: [p0, wt1]}
{addr2, path: [p1, wt2]}
{addr3, path: [p1, wt3]}

]

Addresses will be split into p0/p1, and the p0/p1 will be removed from the path.

Output: {

p0: [
  {addr0, path: [wt0]},
  {addr1, path: [wt1]},
],
p1: [
  {addr2, path: [wt2]},
  {addr3, path: [wt3]},
],

}

If hierarchical path is not set, or has no path in it, the address is dropped.

func Set Uses

func Set(addr resolver.Address, path []string) resolver.Address

Set overrides the hierarchical path in addr with path.

Package hierarchy imports 2 packages (graph) and is imported by 2 packages. Updated 2020-04-19. Refresh now. Tools for package owners.