Documentation ¶
Overview ¶
Package manager provides functions to start or stop monitoring of a target.
Index ¶
Constants ¶
const ( // Address is deprecated, proxies should support multiple addresses via the // Addresses metadata key. Address = "address" Addresses = "addresses" Password = "password" Target = "target" Username = "username" )
gRPC metadata keys.
const AddrSeparator = ";"
AddrSeparator delimits the chain of addresses used to connect to a target.
Variables ¶
var ( // ErrPending indicates a pending subscription attempt for the target exists. ErrPending = errors.New("subscription already pending") // RetryBaseDelay is the initial retry interval for target connections. RetryBaseDelay = time.Second // RetryMaxDelay caps the retry interval for target connections. RetryMaxDelay = time.Minute // RetryRandomization is the randomization factor applied to the retry // interval. RetryRandomization = 0.5 )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Connect will be invoked when a target connects. Connect func(string) // Credentials is an optional client used to lookup passwords for targets // with a specified username and password ID. Credentials CredentialsClient // Reset will be invoked when a target disconnects. Reset func(string) // Sync will be invoked in response to gNMI sync updates. Sync func(string) // Timeout defines the optional duration to wait for a gRPC dial. Timeout time.Duration // Update will be invoked in response to gNMI updates. Update func(*gpb.Notification) // ConnectionManager is used to create gRPC connections. ConnectionManager ConnectionManager // ConnectError record error from subcribe connections. ConnectError func(string, error) }
Config is used by Manager to handle updates.
type ConnectionManager ¶
type ConnectionManager interface {
Connection(ctx context.Context, addr string) (conn *grpc.ClientConn, done func(), err error)
}
ConnectionManager defines a function to create a *grpc.ClientConn along with a done function that will be called when the returned connection handle is unused.
type CredentialsClient ¶
CredentialsClient is an interface for credentials lookup.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides functionality for making gNMI subscriptions to targets and handling updates.
func NewManager ¶
NewManager returns a new target Manager.
func (*Manager) Add ¶
Add adds the target to Manager and starts a streaming subscription that continues until Remove is called. Failed subscriptions are retried using exponential backoff.
After Add returns successfully, re-adding a target returns an error, unless first removed.