Documentation
¶
Index ¶
- Variables
- func RegisterFrontendServer(s *grpc.Server, srv FrontendServer)
- type Config
- type Frontend
- func (f *Frontend) Close()
- func (f *Frontend) Handler() http.Handler
- func (f *Frontend) Process(server Frontend_ProcessServer) error
- func (f *Frontend) RoundTrip(r *http.Request) (*http.Response, error)
- func (f *Frontend) RoundTripGRPC(ctx context.Context, req *ProcessRequest) (*ProcessResponse, error)
- func (f *Frontend) Wrap(trw Tripperware)
- type FrontendClient
- type FrontendServer
- type Frontend_ProcessClient
- type Frontend_ProcessServer
- type ProcessRequest
- func (*ProcessRequest) Descriptor() ([]byte, []int)
- func (this *ProcessRequest) Equal(that interface{}) bool
- func (m *ProcessRequest) GetHttpRequest() *httpgrpc.HTTPRequest
- func (this *ProcessRequest) GoString() string
- func (m *ProcessRequest) Marshal() (dAtA []byte, err error)
- func (m *ProcessRequest) MarshalTo(dAtA []byte) (int, error)
- func (*ProcessRequest) ProtoMessage()
- func (m *ProcessRequest) Reset()
- func (m *ProcessRequest) Size() (n int)
- func (this *ProcessRequest) String() string
- func (m *ProcessRequest) Unmarshal(dAtA []byte) error
- func (m *ProcessRequest) XXX_DiscardUnknown()
- func (m *ProcessRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ProcessRequest) XXX_Merge(src proto.Message)
- func (m *ProcessRequest) XXX_Size() int
- func (m *ProcessRequest) XXX_Unmarshal(b []byte) error
- type ProcessResponse
- func (*ProcessResponse) Descriptor() ([]byte, []int)
- func (this *ProcessResponse) Equal(that interface{}) bool
- func (m *ProcessResponse) GetHttpResponse() *httpgrpc.HTTPResponse
- func (this *ProcessResponse) GoString() string
- func (m *ProcessResponse) Marshal() (dAtA []byte, err error)
- func (m *ProcessResponse) MarshalTo(dAtA []byte) (int, error)
- func (*ProcessResponse) ProtoMessage()
- func (m *ProcessResponse) Reset()
- func (m *ProcessResponse) Size() (n int)
- func (this *ProcessResponse) String() string
- func (m *ProcessResponse) Unmarshal(dAtA []byte) error
- func (m *ProcessResponse) XXX_DiscardUnknown()
- func (m *ProcessResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ProcessResponse) XXX_Merge(src proto.Message)
- func (m *ProcessResponse) XXX_Size() int
- func (m *ProcessResponse) XXX_Unmarshal(b []byte) error
- type RoundTripFunc
- type Tripperware
- type Worker
- type WorkerConfig
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidLengthFrontend = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowFrontend = fmt.Errorf("proto: integer overflow")
)
Functions ¶
func RegisterFrontendServer ¶
func RegisterFrontendServer(s *grpc.Server, srv FrontendServer)
Types ¶
type Config ¶
type Config struct {
MaxOutstandingPerTenant int `yaml:"max_outstanding_per_tenant"`
CompressResponses bool `yaml:"compress_responses"`
DownstreamURL string `yaml:"downstream"`
LogQueriesLongerThan time.Duration `yaml:"log_queries_longer_than"`
}
Config for a Frontend.
func (*Config) RegisterFlags ¶
func (cfg *Config) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet.
type Frontend ¶
type Frontend struct {
// contains filtered or unexported fields
}
Frontend queues HTTP requests, dispatches them to backends, and handles retries for requests which failed.
func (*Frontend) Close ¶
func (f *Frontend) Close()
Close stops new requests and errors out any pending requests.
func (*Frontend) Process ¶
func (f *Frontend) Process(server Frontend_ProcessServer) error
Process allows backends to pull requests from the frontend.
func (*Frontend) RoundTrip ¶
func (f *Frontend) RoundTrip(r *http.Request) (*http.Response, error)
RoundTrip implement http.Transport.
func (*Frontend) RoundTripGRPC ¶
func (f *Frontend) RoundTripGRPC(ctx context.Context, req *ProcessRequest) (*ProcessResponse, error)
RoundTripGRPC round trips a proto (instead of a HTTP request).
type FrontendClient ¶
type FrontendClient interface {
Process(ctx context.Context, opts ...grpc.CallOption) (Frontend_ProcessClient, error)
}
FrontendClient is the client API for Frontend service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewFrontendClient ¶
func NewFrontendClient(cc *grpc.ClientConn) FrontendClient
type FrontendServer ¶
type FrontendServer interface {
Process(Frontend_ProcessServer) error
}
FrontendServer is the server API for Frontend service.
type Frontend_ProcessClient ¶
type Frontend_ProcessClient interface {
Send(*ProcessResponse) error
Recv() (*ProcessRequest, error)
grpc.ClientStream
}
type Frontend_ProcessServer ¶
type Frontend_ProcessServer interface {
Send(*ProcessRequest) error
Recv() (*ProcessResponse, error)
grpc.ServerStream
}
type ProcessRequest ¶
type ProcessRequest struct {
HttpRequest *httpgrpc.HTTPRequest `protobuf:"bytes,1,opt,name=httpRequest,proto3" json:"httpRequest,omitempty"`
}
func (*ProcessRequest) Descriptor ¶
func (*ProcessRequest) Descriptor() ([]byte, []int)
func (*ProcessRequest) GetHttpRequest ¶
func (m *ProcessRequest) GetHttpRequest() *httpgrpc.HTTPRequest
func (*ProcessRequest) ProtoMessage ¶
func (*ProcessRequest) ProtoMessage()
func (*ProcessRequest) XXX_DiscardUnknown ¶
func (m *ProcessRequest) XXX_DiscardUnknown()
func (*ProcessRequest) XXX_Marshal ¶
func (m *ProcessRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ProcessRequest) XXX_Unmarshal ¶
func (m *ProcessRequest) XXX_Unmarshal(b []byte) error
type ProcessResponse ¶
type ProcessResponse struct {
HttpResponse *httpgrpc.HTTPResponse `protobuf:"bytes,1,opt,name=httpResponse,proto3" json:"httpResponse,omitempty"`
}
func (*ProcessResponse) Descriptor ¶
func (*ProcessResponse) Descriptor() ([]byte, []int)
func (*ProcessResponse) GetHttpResponse ¶
func (m *ProcessResponse) GetHttpResponse() *httpgrpc.HTTPResponse
func (*ProcessResponse) ProtoMessage ¶
func (*ProcessResponse) ProtoMessage()
func (*ProcessResponse) XXX_DiscardUnknown ¶
func (m *ProcessResponse) XXX_DiscardUnknown()
func (*ProcessResponse) XXX_Marshal ¶
func (m *ProcessResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ProcessResponse) XXX_Unmarshal ¶
func (m *ProcessResponse) XXX_Unmarshal(b []byte) error
type RoundTripFunc ¶ added in v0.2.0
type RoundTripFunc func(*http.Request) (*http.Response, error)
RoundTripFunc is to http.RoundTripper what http.HandlerFunc is to http.Handler.
type Tripperware ¶ added in v0.4.0
type Tripperware func(http.RoundTripper) http.RoundTripper
Tripperware is a signature for all http client-side middleware.
type Worker ¶
type Worker interface {
Stop()
}
Worker is the counter-part to the frontend, actually processing requests.
type WorkerConfig ¶
type WorkerConfig struct {
Address string
Parallelism int
DNSLookupDuration time.Duration
GRPCClientConfig grpcclient.Config `yaml:"grpc_client_config"`
}
WorkerConfig is config for a worker.
func (*WorkerConfig) RegisterFlags ¶
func (cfg *WorkerConfig) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet.