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
- func New(ctx context.Context, d client.Destination) (client.Impl, error)
- func ProtoResponse(notifs ...client.Notification) (*gpb.SubscribeResponse, error)
- type Client
- func (c *Client) Capabilities(ctx context.Context, r *gpb.CapabilityRequest) (*gpb.CapabilityResponse, error)
- func (c *Client) Close() error
- func (c *Client) Get(ctx context.Context, r *gpb.GetRequest) (*gpb.GetResponse, error)
- func (c *Client) Peer() string
- func (c *Client) Poll() error
- func (c *Client) Recv() error
- func (c *Client) Set(ctx context.Context, r *gpb.SetRequest) (*gpb.SetResponse, error)
- func (c *Client) Subscribe(ctx context.Context, q client.Query) error
Constants ¶
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 ¶
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 ¶
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) Recv ¶
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.