discovery

package
v3.42.5-rc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Example (DiscoverCluster)
ctx := context.TODO()
db, err := ydb.Open(ctx, "grpcs://localhost:2135/local")
if err != nil {
	fmt.Printf("failed to connect: %v", err)
	return
}
defer db.Close(ctx) // cleanup resources
endpoints, err := db.Discovery().Discover(ctx)
if err != nil {
	fmt.Printf("discover failed: %v", err)
	return
}
fmt.Printf("%s endpoints:\n", db.Name())
for i, e := range endpoints {
	fmt.Printf("%d) %s\n", i, e.String())
}
Output:

Example (WhoAmI)
ctx := context.TODO()
db, err := ydb.Open(ctx, "grpcs://localhost:2135/local")
if err != nil {
	fmt.Printf("failed to connect: %v", err)
	return
}
defer db.Close(ctx) // cleanup resources
whoAmI, err := db.Discovery().WhoAmI(ctx)
if err != nil {
	fmt.Printf("discover failed: %v", err)
	return
}
fmt.Printf("%s whoAmI: %s\n", db.Name(), whoAmI.String())
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Discover(ctx context.Context) ([]endpoint.Endpoint, error)
	WhoAmI(ctx context.Context) (*WhoAmI, error)
}

type WhoAmI

type WhoAmI struct {
	User   string
	Groups []string
}

func (WhoAmI) String

func (w WhoAmI) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL