Documentation
¶
Index ¶
Constants ¶
View Source
const ( ReadMode_Once = "once" ReadMode_StreamOnChange = "stream_on_change" ReadMode_StreamSample = "stream_sample" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Write inserts the proto.Message (SubscribeResponse) into the cache under a subscription called `sub`
Write(ctx context.Context, sub string, m proto.Message)
// ReadAll, reads entries from the local cache, return the entries grouped by subscription name.
ReadAll() (map[string][]*gnmi.Notification, error)
// Read, reads a single path value from the cache filtering by subscription and target name
Read(sub, target string, p *gnmi.Path) (map[string][]*gnmi.Notification, error)
// Subscribes to the local cache and returns the notification over a channel
Subscribe(ctx context.Context, so *ReadOpts) chan *Notification
// Stops the cache
Stop()
// DeleteTarget deletes the target from the cache by name
DeleteTarget(name string)
// SetLogger sets a logger for the cache
SetLogger(l *log.Logger)
}
type Config ¶
type Config struct {
Type CacheType `mapstructure:"type,omitempty" json:"type,omitempty"`
Address string `mapstructure:"address,omitempty" json:"address,omitempty"`
Timeout time.Duration `mapstructure:"timeout,omitempty" json:"timeout,omitempty"`
Expiration time.Duration `mapstructure:"expiration,omitempty" json:"expiration,omitempty"`
Debug bool `mapstructure:"debug,omitempty" json:"debug,omitempty"`
// NATS, JS and Redis cfg options
Username string `mapstructure:"username,omitempty" json:"username,omitempty"`
Password string `mapstructure:"password,omitempty" json:"password,omitempty"`
// JS cfg options
MaxBytes int64 `mapstructure:"max-bytes,omitempty" json:"max-bytes,omitempty"`
MaxMsgsPerSubscription int64 `mapstructure:"max-msgs-per-subscription,omitempty" json:"max-msgs-per-subscription,omitempty"`
FetchBatchSize int `mapstructure:"fetch-batch-size,omitempty" json:"fetch-batch-size,omitempty"`
FetchWaitTime time.Duration `mapstructure:"fetch-wait-time,omitempty" json:"fetch-wait-time,omitempty"`
}
type Notification ¶
type Notification struct {
Name string
Notification *gnmi.Notification
Err error
}
Click to show internal directories.
Click to hide internal directories.