package discovery

import "github.com/ydb-platform/ydb-go-sdk/v3/discovery"

Example (DiscoverCluster)

Code:

{
	ctx := context.TODO()
	db, err := ydb.Open(ctx, "grpc://localhost:2136/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())
	}
}
Example (WhoAmI)

Code:

{
	ctx := context.TODO()
	db, err := ydb.Open(ctx, "grpc://localhost:2136/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())
}

Index

Examples

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

Source Files

discovery.go

Version
v3.53.3
Published
Oct 17, 2023
Platform
darwin/amd64
Imports
4 packages
Last checked
5 minutes ago

Tools for package owners.