Documentation ¶
Overview ¶
Package backend is goma service backend of /cxx-compiler-service/*.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth interface { // Auth checks HTTP access, and returns new context with enduser info. Auth(context.Context, *http.Request) (context.Context, error) }
Auth authenticates the request.
type Backend ¶
type Backend interface { Ping() http.Handler Exec() http.Handler ByteStream() http.Handler StoreFile() http.Handler LookupFile() http.Handler Execlog() http.Handler }
Backend is interface of backend for frontend. TODO: provides switching backend, httprpc backend (e.g. to clients5.google.com/cxx-compiler-service/*) and remote backend (e.g. to <cluster>.endpoints.<project>.cloud.goog)
type ExeclogServer ¶
type ExeclogServer struct {
Client execlogpb.LogServiceClient
}
ExeclogServer handles /sl.
func (ExeclogServer) SaveLog ¶
func (s ExeclogServer) SaveLog(ctx context.Context, req *gomapb.SaveLogReq) (*gomapb.SaveLogResp, error)
SaveLog handles /sl.
type FileServer ¶
type FileServer struct {
Client filepb.FileServiceClient
}
FileServer handles /s and /l.
func (FileServer) LookupFile ¶
func (s FileServer) LookupFile(ctx context.Context, req *gomapb.LookupFileReq) (*gomapb.LookupFileResp, error)
LookupFile handles /l.
func (FileServer) StoreFile ¶
func (s FileServer) StoreFile(ctx context.Context, req *gomapb.StoreFileReq) (*gomapb.StoreFileResp, error)
StoreFile handles /s.
type GRPC ¶
type GRPC struct { ExecServer FileServer ExeclogServer ByteStreamClient bspb.ByteStreamClient Auth Auth // api key. used for remote backend. APIKey string // trace prefix and label. used for local backend. Namespace string Cluster string }
GRPC is grpc backend in the same cluster (local) or other cluter (remote).
func FromLocalBackend ¶
FromLocalBackend creates new GRPC from cfg. returned func would release resources associated with GRPC.
func FromRemoteBackend ¶
func FromRemoteBackend(ctx context.Context, cfg *pb.RemoteBackend, opt Option) (GRPC, func(), error)
FromRemoteBackend creates new GRPC from cfg. returned func would release resources associated with GRPC.
func (GRPC) ByteStream ¶
ByteStream returns http handler for bytestream.
func (GRPC) LookupFile ¶
LookupFile returns http handler for lookup file request.
type HTTPRPC ¶
type HTTPRPC struct {
// contains filtered or unexported fields
}
HTTPRPC is httprpc backend.
func FromHTTPRPCBackend ¶
FromHTTPRPCBackend creates new httprpc backend from cfg.
func NewHTTPRPC ¶
NewHTTPRPC creates httprpc backend proxies to target (scheme + host). target's path etc will be ignored.
func (HTTPRPC) ByteStream ¶
ByteStream forwards requests to target.
func (HTTPRPC) LookupFile ¶
LookupFile forwards requests to target.
type Mixer ¶
type Mixer struct { Auth Auth // contains filtered or unexported fields }
Mixer is mixer backend, dispatched by group of enduser.
func FromBackendRule ¶
func FromBackendRule(ctx context.Context, cfg *pb.BackendRule, opt Option) (mixer Mixer, cleanup func(), err error)
FromBackendRule creates new Mixer from cfg. returned func would release resources associated with Mixer.