Documentation ¶
Overview ¶
Package server provides an implementation of a streaming xDS server.
Index ¶
- type CallbackFuncs
- func (c CallbackFuncs) OnFetchRequest(ctx context.Context, req *discovery.DiscoveryRequest) error
- func (c CallbackFuncs) OnFetchResponse(req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse)
- func (c CallbackFuncs) OnStreamClosed(streamID int64)
- func (c CallbackFuncs) OnStreamOpen(ctx context.Context, streamID int64, typeURL string) error
- func (c CallbackFuncs) OnStreamRequest(streamID int64, req *discovery.DiscoveryRequest) error
- func (c CallbackFuncs) OnStreamResponse(streamID int64, req *discovery.DiscoveryRequest, ...)
- type Callbacks
- type HTTPGateway
- type Server
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackFuncs ¶ added in v0.9.7
type CallbackFuncs struct { StreamOpenFunc func(context.Context, int64, string) error StreamClosedFunc func(int64) StreamRequestFunc func(int64, *discovery.DiscoveryRequest) error StreamResponseFunc func(int64, *discovery.DiscoveryRequest, *discovery.DiscoveryResponse) FetchRequestFunc func(context.Context, *discovery.DiscoveryRequest) error FetchResponseFunc func(*discovery.DiscoveryRequest, *discovery.DiscoveryResponse) }
CallbackFuncs is a convenience type for implementing the Callbacks interface.
func (CallbackFuncs) OnFetchRequest ¶ added in v0.9.7
func (c CallbackFuncs) OnFetchRequest(ctx context.Context, req *discovery.DiscoveryRequest) error
OnFetchRequest invokes FetchRequestFunc.
func (CallbackFuncs) OnFetchResponse ¶ added in v0.9.7
func (c CallbackFuncs) OnFetchResponse(req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse)
OnFetchResponse invoked FetchResponseFunc.
func (CallbackFuncs) OnStreamClosed ¶ added in v0.9.7
func (c CallbackFuncs) OnStreamClosed(streamID int64)
OnStreamClosed invokes StreamClosedFunc.
func (CallbackFuncs) OnStreamOpen ¶ added in v0.9.7
OnStreamOpen invokes StreamOpenFunc.
func (CallbackFuncs) OnStreamRequest ¶ added in v0.9.7
func (c CallbackFuncs) OnStreamRequest(streamID int64, req *discovery.DiscoveryRequest) error
OnStreamRequest invokes StreamRequestFunc.
func (CallbackFuncs) OnStreamResponse ¶ added in v0.9.7
func (c CallbackFuncs) OnStreamResponse(streamID int64, req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse)
OnStreamResponse invokes StreamResponseFunc.
type Callbacks ¶
type Callbacks interface { // OnStreamOpen is called once an xDS stream is open with a stream ID and the type URL (or "" for ADS). // Returning an error will end processing and close the stream. OnStreamClosed will still be called. OnStreamOpen(context.Context, int64, string) error // OnStreamClosed is called immediately prior to closing an xDS stream with a stream ID. OnStreamClosed(int64) // OnStreamRequest is called once a request is received on a stream. // Returning an error will end processing and close the stream. OnStreamClosed will still be called. OnStreamRequest(int64, *discovery.DiscoveryRequest) error // OnStreamResponse is called immediately prior to sending a response on a stream. OnStreamResponse(int64, *discovery.DiscoveryRequest, *discovery.DiscoveryResponse) // OnFetchRequest is called for each Fetch request. Returning an error will end processing of the // request and respond with an error. OnFetchRequest(context.Context, *discovery.DiscoveryRequest) error // OnFetchResponse is called immediately prior to sending a response. OnFetchResponse(*discovery.DiscoveryRequest, *discovery.DiscoveryResponse) }
Callbacks is a collection of callbacks inserted into the server operation. The callbacks are invoked synchronously.
type HTTPGateway ¶
type HTTPGateway struct { // Log is an optional log for errors in response write Log log.Logger // Server is the underlying gRPC server Server Server }
HTTPGateway is a custom implementation of [gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway) specialized to Envoy xDS API.
type Server ¶
type Server interface { endpointservice.EndpointDiscoveryServiceServer clusterservice.ClusterDiscoveryServiceServer routeservice.RouteDiscoveryServiceServer listenerservice.ListenerDiscoveryServiceServer discoverygrpc.AggregatedDiscoveryServiceServer secretservice.SecretDiscoveryServiceServer runtimeservice.RuntimeDiscoveryServiceServer // Fetch is the universal fetch method. Fetch(context.Context, *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error) // StreamHandler is the universal stream method. StreamHandler(stream Stream, typeURL string) error }
Server is a collection of handlers for streaming discovery requests.
type Stream ¶ added in v0.9.8
type Stream interface { grpc.ServerStream Send(*discovery.DiscoveryResponse) error Recv() (*discovery.DiscoveryRequest, error) }
Generic RPC stream.