Documentation ¶
Index ¶
- Constants
- type Config
- type Proxy
- type Service
- func (svc *Service) AddListener(l func(event int, ctx interface{}))
- func (svc *Service) AddOption(opt grpc.ServerOption)
- func (svc *Service) AddRRService(r func(server *grpc.Server, rr *roadrunner.Server)) error
- func (svc *Service) AddService(r func(server *grpc.Server)) error
- func (svc *Service) AddStreamServerInterceptor(interceptor grpc.StreamServerInterceptor) error
- func (svc *Service) AddUnaryServerInterceptor(interceptor grpc.UnaryServerInterceptor) error
- func (svc *Service) Attach(ctr roadrunner.Controller)
- func (svc *Service) Init(cfg *Config, r *rpc.Service, e env.Environment) (ok bool, err error)
- func (svc *Service) Serve() (err error)
- func (svc *Service) Server() *roadrunner.Server
- func (svc *Service) Stop()
- type TLS
- type UnaryCallEvent
- type WorkerList
Constants ¶
const EventUnaryCall = 8001
EventUnaryCall thrown after every unary call.
const ID = "grpc"
ID sets public GRPC service ID for roadrunner.Container.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Address to listen. Listen string // Proto file associated with the service. Proto string // TLS defined authentication method (TLS for now). TLS TLS // Workers configures roadrunner grpc and worker pool. Workers *roadrunner.ServerConfig }
Config describes GRPC service configuration.
func (*Config) EnableTLS ¶
EnableTLS returns true if rr must listen TLS connections.
func (*Config) Hydrate ¶
Hydrate the config and validate it's values.
func (*Config) Listener ¶
Listener creates new rpc socket Listener.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy manages GRPC/RoadRunner bridge.
func NewProxy ¶
func NewProxy(name string, metadata string, rr *roadrunner.Server) *Proxy
NewProxy creates new service proxy object.
func (*Proxy) RegisterMethod ¶
RegisterMethod registers new RPC method.
func (*Proxy) ServiceDesc ¶
func (p *Proxy) ServiceDesc() *grpc.ServiceDesc
ServiceDesc returns service description for the proxy.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages set of GPRC services, options and connections.
func (*Service) AddListener ¶
AddListener attaches grpc event watcher.
func (*Service) AddOption ¶
func (svc *Service) AddOption(opt grpc.ServerOption)
AddOption adds new GRPC server option. Codec and TLS options are controlled by service internally.
func (*Service) AddRRService ¶
AddService would be invoked after GRPC service creation.
func (*Service) AddService ¶
AddService would be invoked after GRPC service creation.
func (*Service) AddStreamServerInterceptor ¶
func (svc *Service) AddStreamServerInterceptor(interceptor grpc.StreamServerInterceptor) error
添加stream 拦截器
func (*Service) AddUnaryServerInterceptor ¶
func (svc *Service) AddUnaryServerInterceptor(interceptor grpc.UnaryServerInterceptor) error
添加普通拦截器
func (*Service) Attach ¶
func (svc *Service) Attach(ctr roadrunner.Controller)
Attach attaches cr. Currently only one cr is supported.
func (*Service) Init ¶
Init service.
func (*Service) Server ¶
func (svc *Service) Server() *roadrunner.Server
Server returns associated rr server (if any).
type TLS ¶
type TLS struct { // Key defined private server key. Key string // Cert is https certificate. Cert string }
TLS defines auth credentials.
type UnaryCallEvent ¶
type UnaryCallEvent struct { // Info contains unary call info. Info *grpc.UnaryServerInfo // Context associated with the call. Context context.Context // Error associated with event. Error error // contains filtered or unexported fields }
UnaryCallEvent contains information about invoked method.
func (*UnaryCallEvent) Elapsed ¶
func (e *UnaryCallEvent) Elapsed() time.Duration
Elapsed returns duration of the invocation.