php-grpc: github.com/spiral/php-grpc Index | Files | Directories

package grpc

import "github.com/spiral/php-grpc"

Index

Package Files

codec.go config.go proxy.go rpc.go service.go

Constants

const ID = "grpc"

ID sets public GRPC service ID for roadrunner.Container.

type Config Uses

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 Uses

func (c *Config) EnableTLS() bool

EnableTLS returns true if rr must listen TLS connections.

func (*Config) Hydrate Uses

func (c *Config) Hydrate(cfg service.Config) error

Hydrate the config and validate it's values.

func (*Config) Listener Uses

func (c *Config) Listener() (net.Listener, error)

Listener creates new rpc socket Listener.

func (*Config) Valid Uses

func (c *Config) Valid() error

Valid validates the configuration.

type Proxy Uses

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

Proxy manages GRPC/RoadRunner bridge.

func NewProxy Uses

func NewProxy(name string, metadata string, rr *roadrunner.Server) *Proxy

NewProxy creates new service proxy object.

func (*Proxy) RegisterMethod Uses

func (p *Proxy) RegisterMethod(method string)

RegisterMethod registers new RPC method.

func (*Proxy) ServiceDesc Uses

func (p *Proxy) ServiceDesc() *grpc.ServiceDesc

ServiceDesc returns service description for the proxy.

type Service Uses

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

Service manages set of GPRC services, options and connections.

func (*Service) AddListener Uses

func (svc *Service) AddListener(l func(event int, ctx interface{}))

AddListener attaches grpc event watcher.

func (*Service) AddOption Uses

func (svc *Service) AddOption(opt grpc.ServerOption)

AddOption adds new GRPC server option. Codec and TLS options are controlled by service internally.

func (*Service) AddService Uses

func (svc *Service) AddService(r func(server *grpc.Server)) error

AddService would be invoked after GRPC service creation.

func (*Service) Attach Uses

func (svc *Service) Attach(ctr roadrunner.Controller)

Attach attaches cr. Currently only one cr is supported.

func (*Service) Init Uses

func (svc *Service) Init(cfg *Config, r *rpc.Service, e env.Environment) (ok bool, err error)

Init service.

func (*Service) Serve Uses

func (svc *Service) Serve() (err error)

Serve GRPC grpc.

func (*Service) Stop Uses

func (svc *Service) Stop()

Stop the service.

type TLS Uses

type TLS struct {
    // Key defined private server key.
    Key string

    // Cert is https certificate.
    Cert string
}

TLS defines auth credentials.

type WorkerList Uses

type WorkerList struct {
    // Workers is list of workers.
    Workers []*util.State `json:"workers"`
}

WorkerList contains list of workers.

Directories

PathSynopsis
example/client
example/client/proto
parser
tests
tests/ext

Package grpc imports 24 packages (graph). Updated 2019-06-04. Refresh now. Tools for package owners.