grpc

package
v0.0.0-...-9fc37f3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(opts ...component.Option) (component.Component, error)

NewService new api service

func RegisterClientServer

func RegisterClientServer(s *grpc.Server, srv ClientServer)

Types

type ClientClient

type ClientClient interface {
	// Call allows a single request to be made
	Call(ctx context.Context, in *message.Request, opts ...grpc.CallOption) (*message.Response, error)
	// Stream is a bidirectional stream
	Stream(ctx context.Context, opts ...grpc.CallOption) (Client_StreamClient, error)
	// Publish publishes a payload and returns an empty payload
	Publish(ctx context.Context, in *message.Payload, opts ...grpc.CallOption) (*message.Payload, error)
}

ClientClient is the client API for Client service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewClientClient

func NewClientClient(cc *grpc.ClientConn) ClientClient

type ClientServer

type ClientServer interface {
	// Call allows a single request to be made
	Call(context.Context, *message.Request) (*message.Response, error)
	// Stream is a bidirectional stream
	Stream(Client_StreamServer) error
	// Publish publishes a payload and returns an empty payload
	Publish(context.Context, *message.Payload) (*message.Payload, error)
}

ClientServer is the server API for Client service.

type Client_StreamClient

type Client_StreamClient interface {
	Send(*message.Request) error
	Recv() (*message.Response, error)
	grpc.ClientStream
}

type Client_StreamServer

type Client_StreamServer interface {
	Send(*message.Response) error
	Recv() (*message.Request, error)
	grpc.ServerStream
}

type Message

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

func (*Message) Service

func (p *Message) Service() *service.Service

type Service

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

Service api service

func (*Service) Call

func (p *Service) Call(ctx context.Context, req *message.Request) (*message.Response, error)

Call 路由

func (*Service) Publish

Publish 路由

func (*Service) Route

func (p *Service) Route(_ message.Message) (interface{}, error)

Route 路由

func (*Service) Start

func (p *Service) Start() error

Start start service TODO server options

func (*Service) Stop

func (p *Service) Stop() error

Stop stop service

func (*Service) Stream

func (p *Service) Stream(Client_StreamServer) error

Stream 路由

type UnimplementedClientServer

type UnimplementedClientServer struct {
}

UnimplementedClientServer can be embedded to have forward compatible implementations.

func (*UnimplementedClientServer) Call

func (*UnimplementedClientServer) Publish

func (*UnimplementedClientServer) Stream

Jump to

Keyboard shortcuts

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