server: go.chromium.org/goma/server/backend Index | Files

package backend

import "go.chromium.org/goma/server/backend"

Package backend is goma service backend of /cxx-compiler-service/*.

Index

Package Files

backend.go ctx.go doc.go error.go exec.go execlog.go file.go grpc.go httprpc.go local.go mixer.go remote.go

type Auth Uses

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 Uses

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)

func FromProto Uses

func FromProto(ctx context.Context, cfg *pb.BackendConfig, opt Option) (Backend, func(), error)

FromProto creates Backend based on cfg. returned func will release resources associated with Backend.

type ExecServer Uses

type ExecServer struct {
    Client execpb.ExecServiceClient
}

ExecServer handles /e.

func (ExecServer) Exec Uses

func (s ExecServer) Exec(ctx context.Context, req *gomapb.ExecReq) (*gomapb.ExecResp, error)

Exec handles /e.

type ExeclogServer Uses

type ExeclogServer struct {
    Client execlogpb.LogServiceClient
}

ExeclogServer handles /sl.

func (ExeclogServer) SaveLog Uses

func (s ExeclogServer) SaveLog(ctx context.Context, req *gomapb.SaveLogReq) (*gomapb.SaveLogResp, error)

SaveLog handles /sl.

type FileServer Uses

type FileServer struct {
    Client filepb.FileServiceClient
}

FileServer handles /s and /l.

func (FileServer) LookupFile Uses

func (s FileServer) LookupFile(ctx context.Context, req *gomapb.LookupFileReq) (*gomapb.LookupFileResp, error)

LookupFile handles /l.

func (FileServer) StoreFile Uses

func (s FileServer) StoreFile(ctx context.Context, req *gomapb.StoreFileReq) (*gomapb.StoreFileResp, error)

StoreFile handles /s.

type GRPC Uses

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 Uses

func FromLocalBackend(ctx context.Context, cfg *pb.LocalBackend, opt Option) (GRPC, func(), error)

FromLocalBackend creates new GRPC from cfg. returned func would release resources associated with GRPC.

func FromRemoteBackend Uses

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 Uses

func (g GRPC) ByteStream() http.Handler

ByteStream returns http handler for bytestream.

func (GRPC) Exec Uses

func (g GRPC) Exec() http.Handler

Exec returns http handler for exec request.

func (GRPC) Execlog Uses

func (g GRPC) Execlog() http.Handler

Execlog returns http handler for execlog request.

func (GRPC) LookupFile Uses

func (g GRPC) LookupFile() http.Handler

LookupFile returns http handler for lookup file request.

func (GRPC) Ping Uses

func (g GRPC) Ping() http.Handler

Ping returns http handler for ping.

func (GRPC) StoreFile Uses

func (g GRPC) StoreFile() http.Handler

StoreFile returns http handler for store file request.

type HTTPRPC Uses

type HTTPRPC struct {
    // contains filtered or unexported fields
}

HTTPRPC is httprpc backend.

func FromHTTPRPCBackend Uses

func FromHTTPRPCBackend(ctx context.Context, cfg *pb.HttpRpcBackend) (HTTPRPC, func(), error)

FromHTTPRPCBackend creates new httprpc backend from cfg.

func NewHTTPRPC Uses

func NewHTTPRPC(target *url.URL) HTTPRPC

NewHTTPRPC creates httprpc backend proxies to target (scheme + host). target's path etc will be ignored.

func (HTTPRPC) ByteStream Uses

func (h HTTPRPC) ByteStream() http.Handler

ByteStream forwards requests to target.

func (HTTPRPC) Exec Uses

func (h HTTPRPC) Exec() http.Handler

Exec forwards requests to target.

func (HTTPRPC) Execlog Uses

func (h HTTPRPC) Execlog() http.Handler

Execlog forwards requests to target.

func (HTTPRPC) LookupFile Uses

func (h HTTPRPC) LookupFile() http.Handler

LookupFile forwards requests to target.

func (HTTPRPC) Ping Uses

func (h HTTPRPC) Ping() http.Handler

Ping forwards requests to target.

func (HTTPRPC) StoreFile Uses

func (h HTTPRPC) StoreFile() http.Handler

StoreFile forwards requests to target.

type Mixer Uses

type Mixer struct {
    Auth Auth
    // contains filtered or unexported fields
}

Mixer is mixer backend, dispatched by group of enduser.

func FromBackendRule Uses

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.

func (Mixer) ByteStream Uses

func (m Mixer) ByteStream() http.Handler

func (Mixer) Exec Uses

func (m Mixer) Exec() http.Handler

func (Mixer) Execlog Uses

func (m Mixer) Execlog() http.Handler

func (Mixer) LookupFile Uses

func (m Mixer) LookupFile() http.Handler

func (Mixer) Ping Uses

func (m Mixer) Ping() http.Handler

func (Mixer) StoreFile Uses

func (m Mixer) StoreFile() http.Handler

type Option Uses

type Option struct {
    Auth      Auth
    APIKeyDir string
}

Option is backend option.

Package backend imports 38 packages (graph) and is imported by 1 packages. Updated 2019-05-20. Refresh now. Tools for package owners.