server

package
v0.0.0-...-b601dcb Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	pb.UnimplementedMessageServer

	GRPCHost string `long:"grpc-host" description:"the IP to listen on for grpc" default:"0.0.0.0" env:"GRPC_HOST"`
	GRPCPort string `long:"grpc-port" description:"the port to listen on for grpc's insecure connections" default:"6653" env:"GRPC_PORT"`
	// contains filtered or unexported fields
}

Server server

func NewServer

func NewServer() *Server

NewServer ...

func (*Server) Close

func (s *Server) Close() (err error)

Close clean all data if need

func (*Server) Ping

func (s *Server) Ping(context.Context, *empty.Empty) (*empty.Empty, error)

Ping test grpc server health

func (*Server) Publish

func (s *Server) Publish(_ context.Context, req *pb.PubReq) (resp *pb.PubResp, err error)

Publish publish topic message

func (*Server) Serve

func (s *Server) Serve() (err error)

Serve ...

func (*Server) Subscribe

func (s *Server) Subscribe(req *pb.SubReq, stream pb.Message_SubscribeServer) (err error)

Subscribe subscribe topic or topics

type StatsHandler

type StatsHandler struct{}

StatsHandler Handler defines the interface for the related stats handling (e.g., RPCs, connections).

func (*StatsHandler) HandleConn

func (h *StatsHandler) HandleConn(ctx context.Context, s stats.ConnStats)

HandleConn processes the Conn stats.

func (*StatsHandler) HandleRPC

func (h *StatsHandler) HandleRPC(ctx context.Context, s stats.RPCStats)

HandleRPC processes the RPC stats.

func (*StatsHandler) TagConn

func (h *StatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context

TagConn can attach some information to the given context. The returned context will be used for stats handling. For conn stats handling, the context used in HandleConn for this connection will be derived from the context returned. For RPC stats handling,

  • On server side, the context used in HandleRPC for all RPCs on this

connection will be derived from the context returned.

  • On client side, the context is not derived from the context returned.

func (*StatsHandler) TagRPC

func (h *StatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context

TagRPC can attach some information to the given context. The context used for the rest lifetime of the RPC will be derived from the returned context.

Jump to

Keyboard shortcuts

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