Documentation ¶
Index ¶
- type Acknowledgment
- type Manager
- func (m *Manager) Add(ctx context.Context, rs []Resource) error
- func (m *Manager) BuildDiscoveryResponse(subscribed []string) (*discovery_v3.DiscoveryResponse, []string, error)
- func (m *Manager) ConfigAsYAML(verbose bool) ([]byte, error)
- func (m *Manager) Delete(ctx context.Context, n string)
- func (m *Manager) List() []Resource
- func (m *Manager) ListKeys() []string
- func (m *Manager) Replace(ctx context.Context, rs []Resource) error
- func (m *Manager) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (m *Manager) Stream(ctx context.Context, reqCh chan *discovery_v3.DiscoveryRequest, ...) error
- func (m *Manager) StreamGRPC(stream Stream) error
- type Resource
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acknowledgment ¶
type Acknowledgment struct { Node string // The id of the node. Version string // The full version. Ack bool // Whether this is an ack or nack. }
Acknowledgment is an event that represents the client accepting or rejecting a configuration.
type Manager ¶
type Manager struct { // Name is the name of this manager, for logging/monitoring. Name string // VersionPrefix is a prefix to prepend to the version number, typically the server's pod name. VersionPrefix string // Type is the type of xDS resource being managed, like "type.googleapis.com/envoy.config.cluster.v3.Cluster". Type string // OnAck is a function that will be called when a config is accepted or rejected. OnAck func(Acknowledgment) // Logger is a zap logger to use to log manager events. Per-connection events are logged // via the logger stored in the request context. Logger *zap.Logger // Draining is a channel that, when closed, will drain client connections. Draining chan struct{} // contains filtered or unexported fields }
Manager consumes a stream of resource change, and notifies connected xDS clients of the change. It is not safe to mutate any public fields after the manager has received a client connection.
func NewManager ¶
NewManager creates a new manager. resource is an instance of the type to manage.
func (*Manager) Add ¶
Add adds or replaces (by name) managed resources, and notifies connected clients of the change.
func (*Manager) BuildDiscoveryResponse ¶
func (m *Manager) BuildDiscoveryResponse(subscribed []string) (*discovery_v3.DiscoveryResponse, []string, error)
func (*Manager) ConfigAsYAML ¶
ConfigAsYAML dumps the currently-tracked resources as YAML.
func (*Manager) Delete ¶
Delete deletes a single resource by name and notifies clients of the change.
func (*Manager) Replace ¶
Replace repaces the entire set of managed resources with the provided argument, and notifies connected clients of the change.
func (*Manager) ServeHTTP ¶
func (m *Manager) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP dumps the currently-tracked resources as YAML.
It will normally omit defaults, but with "?verbose" in the query params, it will print those too.
func (*Manager) Stream ¶
func (m *Manager) Stream(ctx context.Context, reqCh chan *discovery_v3.DiscoveryRequest, resCh chan *discovery_v3.DiscoveryResponse) error
Stream manages a client connection. Requests from the client are read from reqCh, responses are written to resCh, and the function returns when no further progress can be made.
func (*Manager) StreamGRPC ¶
StreamGRPC adapts a gRPC stream of DiscoveryRequest -> DiscoveryResponse to the API required by the Stream function.
type Stream ¶
type Stream interface { Context() context.Context Recv() (*discovery_v3.DiscoveryRequest, error) Send(*discovery_v3.DiscoveryResponse) error }
Stream is the API shared among all envoy_api_v2.[type]DiscoveryService_Stream[type]Server streams.