grpc

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2020 License: Apache-2.0 Imports: 25 Imported by: 6

Documentation

Index

Constants

View Source
const UnixSocket = "/tmp/test.sock"

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option overrides behavior of Server.

func WithGracePeriod

func WithGracePeriod(t time.Duration) Option

WithGracePeriod sets shutdown grace period for gRPC server. Server waits connections to drain for specified amount of time.

func WithListen

func WithListen(s string) Option

WithListen sets address to listen for gRPC server. Server accepts incoming connections on given address.

func WithNetwork added in v0.13.0

func WithNetwork(s string) Option

WithNetwork sets network to listen for gRPC server e.g tcp, udp or unix.

func WithTLSConfig

func WithTLSConfig(cfg *tls.Config) Option

WithTLSConfig sets TLS configuration for gRPC server.

type ReadWriteStoreServer added in v0.11.0

type ReadWriteStoreServer interface {
	storepb.StoreServer
	storepb.WriteableStoreServer
}

ReadWriteStoreServer is a StoreServer and a WriteableStoreServer.

type Server

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

A Server defines parameters to serve RPC requests, a wrapper around grpc.Server.

func New

func New(logger log.Logger, reg prometheus.Registerer, tracer opentracing.Tracer, comp component.Component, probe *prober.GRPCProbe, storeSrv storepb.StoreServer, rulesSrv rulespb.RulesServer, opts ...Option) *Server

New creates a new gRPC Store API. If rulesSrv is not nil, it also registers Rules API to the returned server.

func NewReadWrite added in v0.11.0

func NewReadWrite(logger log.Logger, reg prometheus.Registerer, tracer opentracing.Tracer, comp component.Component, probe *prober.GRPCProbe, storeSrv ReadWriteStoreServer, opts ...Option) *Server

NewReadWrite creates a new server that can be written to.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe listens on the TCP network address and handles requests on incoming connections.

func (*Server) Shutdown

func (s *Server) Shutdown(err error)

Shutdown gracefully shuts down the server by waiting, for specified amount of time (by gracePeriod) for connections to return to idle and then shut down.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL