Documentation
¶
Index ¶
- Variables
- type Processor
- type ProcessorFactory
- type Server
- func (s *Server) Check(context.Context, *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
- func (s *Server) List(context.Context, *grpc_health_v1.HealthListRequest) (*grpc_health_v1.HealthListResponse, error)
- func (s *Server) LoadConfig(ctx context.Context, config *filterapi.Config) error
- func (s *Server) Process(stream extprocv3.ExternalProcessor_ProcessServer) error
- func (s *Server) Register(path string, newProcessor ProcessorFactory)
- func (s *Server) Watch(*grpc_health_v1.HealthCheckRequest, grpc_health_v1.Health_WatchServer) error
Constants ¶
This section is empty.
Variables ¶
var LogRequestHeaderAttributes map[string]string
LogRequestHeaderAttributes is the mapping of request headers to log as dynamic metadata attributes. This is configured at the startup of the extproc server.
Functions ¶
This section is empty.
Types ¶
type Processor ¶
type Processor interface {
// ProcessRequestHeaders processes the request headers message.
ProcessRequestHeaders(context.Context, *corev3.HeaderMap) (*extprocv3.ProcessingResponse, error)
// ProcessRequestBody processes the request body message.
ProcessRequestBody(context.Context, *extprocv3.HttpBody) (*extprocv3.ProcessingResponse, error)
// ProcessResponseHeaders processes the response headers message.
ProcessResponseHeaders(context.Context, *corev3.HeaderMap) (*extprocv3.ProcessingResponse, error)
// ProcessResponseBody processes the response body message.
ProcessResponseBody(context.Context, *extprocv3.HttpBody) (*extprocv3.ProcessingResponse, error)
// SetBackend instructs the processor to set the backend to use for the request. This is only called
// when the processor is used in the upstream filter.
//
// routerProcessor is the processor that is the "parent" which was used to determine the route at the
// router level. It holds the additional state that can be used to determine the backend to use.
SetBackend(ctx context.Context, backend *filterapi.Backend, handler filterapi.BackendAuthHandler, routerProcessor Processor) error
}
Processor is the interface for the processor which corresponds to a single gRPC stream per the external processor filter. This decouples the processor implementation detail from the server implementation.
This can be either a router filter level processor or an upstream filter level processor.
type ProcessorFactory ¶
type ProcessorFactory func(_ *filterapi.RuntimeConfig, _ map[string]string, _ *slog.Logger, isUpstreamFilter bool) (Processor, error)
ProcessorFactory is the factory function used to create new instances of a processor.
func NewFactory ¶ added in v0.5.0
func NewFactory[ReqT any, RespT any, RespChunkT any, EndpointSpecT endpointspec.Spec[ReqT, RespT, RespChunkT]]( f metrics.Factory, tracer tracingapi.RequestTracer[ReqT, RespT, RespChunkT], _ EndpointSpecT, ) ProcessorFactory
NewFactory creates a ProcessorFactory with the given parameters.
Type Parameters: * ReqT: The request type. * RespT: The response type. * RespChunkT: The chunk type for streaming responses.
Parameters: * f: Metrics factory for creating metrics instances. * tracer: Request tracer for tracing requests and responses. * parseBody: Function to parse the request body. * selectTranslator: Function to select the appropriate translator based on the output schema.
Returns: * ProcessorFactory: A factory function to create processors based on the configuration.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the external processor server.
func (*Server) Check ¶
func (s *Server) Check(context.Context, *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
Check implements grpc_health_v1.HealthServer.
func (*Server) List ¶ added in v0.2.0
func (s *Server) List(context.Context, *grpc_health_v1.HealthListRequest) (*grpc_health_v1.HealthListResponse, error)
List implements grpc_health_v1.HealthServer.
func (*Server) LoadConfig ¶
LoadConfig updates the configuration of the external processor.
func (*Server) Process ¶
func (s *Server) Process(stream extprocv3.ExternalProcessor_ProcessServer) error
Process implements extprocv3.ExternalProcessorServer.
func (*Server) Register ¶
func (s *Server) Register(path string, newProcessor ProcessorFactory)
Register a new processor for the given request path.
func (*Server) Watch ¶
func (s *Server) Watch(*grpc_health_v1.HealthCheckRequest, grpc_health_v1.Health_WatchServer) error
Watch implements grpc_health_v1.HealthServer.