Documentation ¶
Overview ¶
Package serve implements the "jig serve" command, serving GRPC services via an evaluator.
Index ¶
- func NewFS(vfs ...fs.FS) fs.FS
- func NewFSFromDirs(dirs ...string) fs.FS
- type Evaluator
- type EvaluatorFunc
- type Option
- type Server
- func (s *Server) ListenAndServe(listenAddr string) error
- func (s *Server) Serve(lis net.Listener) error
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetHTTPHandler(handler http.Handler)
- func (s *Server) Stop()
- func (s *Server) UnknownHandler(srv interface{}, ss grpc.ServerStream) error
- type TestServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFSFromDirs ¶ added in v0.0.21
NewFSFromDirs combines the top level directories of multiple directories.
Types ¶
type Evaluator ¶ added in v0.0.21
func JsonnetEvaluator ¶ added in v0.0.21
func JsonnetEvaluator() Evaluator
type EvaluatorFunc ¶ added in v0.0.21
type Option ¶ added in v0.0.16
Option is a functional option to configure Server
func WithFileDescriptorSets ¶ added in v0.0.32
func WithFileDescriptorSets(fds ...*descriptorpb.FileDescriptorSet) Option
func WithLogger ¶ added in v0.0.17
func WithProtosets ¶ added in v0.0.19
type Server ¶
func NewServer ¶ added in v0.0.14
NewServer creates a new Server for given evaluator, e.g. Jsonnet and data Directories.
func (*Server) ListenAndServe ¶ added in v0.0.14
func (*Server) ServeHTTP ¶ added in v0.0.26
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*Server) SetHTTPHandler ¶ added in v0.0.28
SetHTTPHandler sets a http.Handler to be called for non-grpc traffic. It must be called before Serve or ListenAndServe are called.
func (*Server) UnknownHandler ¶ added in v0.0.28
func (s *Server) UnknownHandler(srv interface{}, ss grpc.ServerStream) error
UnknownHandler handles gRPC method calls that are not statically implemented. It is registered as the UnknownServiceHandler of the grpc server.
UnknownHandler can be called from a non-grpc.Server entry point, possibly a HTTP server or even an internal dispatch bypassing the network. In order for this handler to know which method is being invoked, the `srv` argument can be (ab)used to pass the full name of the method. In this case the dynamic type of `srv` must be `protoreflect.FullName` and it must contain the fully-qualified method name (pkg.service.method).
Alternatively, the stream context (ss.Context()) must contain a grpc.ServerTransportStream, retrievable with grpc.ServerTransportStreamFromContext(), on which the `Method()` method will be called to find the method name. This should return the method as a HTTP path (/pkg.service/method), as is done by grpc.Server.
type TestServer ¶ added in v0.0.8
type TestServer struct { Server // contains filtered or unexported fields }
func NewTestServer ¶ added in v0.0.14
func NewTestServer(eval Evaluator, vfs fs.FS, options ...Option) *TestServer
NewTestServer starts and returns a new TestServer. The caller should call Stop when finished, to shut it down.
func NewUnstartedTestServer ¶ added in v0.0.32
func NewUnstartedTestServer(eval Evaluator, vfs fs.FS, options ...Option) *TestServer
NewTestServer starts and returns a new TestServer. The caller should call Stop when finished, to shut it down.
func (*TestServer) Addr ¶ added in v0.0.8
func (ts *TestServer) Addr() string
func (*TestServer) Start ¶ added in v0.0.8
func (ts *TestServer) Start()