Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: Apache-2.0 Imports: 17 Imported by: 34

Documentation

Overview

Package client contains transport implementation for the parent client library using gnmi.proto.

Note: this package should not be used directly. Use github.com/openconfig/gnmi/client instead.

Index

Constants

View Source
const Type = "gnmi"

Type defines the name resolution for this client type.

Variables

View Source
var ToSubscribeRequest = subscribe

ToSubscribeRequest is the function used to convert a client.Query into a *gpb.SubscribeRequest. It can be stubbed for unit test.

Functions

func New

New returns a new initialized client. If error is nil, returned Client has established a connection to d. Close needs to be called for cleanup.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles execution of the query and caching of its results.

func NewFromConn

func NewFromConn(ctx context.Context, conn *grpc.ClientConn, d client.Destination) (*Client, error)

NewFromConn creates and returns the client based on the provided transport.

func (*Client) Capabilities

func (c *Client) Capabilities(ctx context.Context, r *gpb.CapabilityRequest) (*gpb.CapabilityResponse, error)

Capabilities calls the gNMI Capabilities RPC.

func (*Client) Close

func (c *Client) Close() error

Close forcefully closes the underlying connection, terminating the query right away. It's safe to call Close multiple times.

func (*Client) Get

func (c *Client) Get(ctx context.Context, r *gpb.GetRequest) (*gpb.GetResponse, error)

Get calls the gNMI Get RPC.

func (*Client) Peer

func (c *Client) Peer() string

Peer returns the peer of the current stream. If the client is not created or if the peer is not valid nil is returned.

func (*Client) Poll

func (c *Client) Poll() error

Poll will send a single gNMI poll request to the server.

func (*Client) Recv

func (c *Client) Recv() error

Recv will recieve a single message from the server and process it based on the provided handlers (Proto or Notification).

func (*Client) Set

func (c *Client) Set(ctx context.Context, r *gpb.SetRequest) (*gpb.SetResponse, error)

Set calls the gNMI Set RPC.

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, q client.Query) error

Subscribe sends the gNMI Subscribe RPC to the server.

Jump to

Keyboard shortcuts

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