client

package
v0.0.0-...-cb4d464 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

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

This section is empty.

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.

func ProtoResponse

func ProtoResponse(notifs ...client.Notification) (*gpb.SubscribeResponse, error)

ProtoResponse converts client library Notification types into gNMI SubscribeResponse proto. An error is returned if any notifications have invalid paths or if update values can't be converted to gpb.TypedValue.

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