rpc

package
v0.0.0-...-379bff8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MemCache = &MemoryCache{cache: make(map[string]*MethodCache)}
)
View Source
var (
	MethodNotFound = errors.New("没有找到对应的方法,请检查您的参数")
)

Functions

This section is empty.

Types

type DescriptorSource

type DescriptorSource interface {
	// ListServices returns a list of fully-qualified service names. It will be all services in a set of
	// descriptor files or the set of all services exposed by a gRPC server.
	ListServices() ([]string, error)
	// FindSymbol returns a descriptor for the given fully-qualified symbol name.
	FindSymbol(fullyQualifiedName string) (desc.Descriptor, error)
	// AllExtensionsForType returns all known extension fields that extend the given message type name.
	AllExtensionsForType(typeName string) ([]*desc.FieldDescriptor, error)
}

func DescriptorSourceFromServer

func DescriptorSourceFromServer(_ context.Context, refClient *grpcreflect.Client) DescriptorSource

type GrpcClient

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

func NewGrpcClient

func NewGrpcClient(service string) (*GrpcClient, error)

func (*GrpcClient) Close

func (c *GrpcClient) Close() error

func (*GrpcClient) InvokeWithReflect

func (c *GrpcClient) InvokeWithReflect(method etcd.Method, in io.ReadCloser, ip string, userInfo *auth.UserInfo, opts ...grpc.CallOption) (proto.Message, error)

func (*GrpcClient) Marshal

func (c *GrpcClient) Marshal(w io.Writer, msg proto.Message) error

func (*GrpcClient) SearchCallAddr

func (c *GrpcClient) SearchCallAddr(version, service, method string) (etcd.Method, error)

type MemoryCache

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

func (*MemoryCache) GetCache

func (r *MemoryCache) GetCache(service, method string) *MethodCache

func (*MemoryCache) SetCache

func (r *MemoryCache) SetCache(service, method string, cache *MethodCache)

type MethodCache

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

type ReflectionClient

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

func NewReflectionClient

func NewReflectionClient(conn *grpc.ClientConn) *ReflectionClient

func (*ReflectionClient) Args

func (r *ReflectionClient) Args(service, method string, in io.ReadCloser) (*MethodCache, error)

func (*ReflectionClient) Descriptor

func (r *ReflectionClient) Descriptor(dsc desc.Descriptor, service, method string) (*MethodCache, error)

func (*ReflectionClient) FindSymbol

func (r *ReflectionClient) FindSymbol(service string) (desc.Descriptor, error)

func (*ReflectionClient) InvokeUnary

func (r *ReflectionClient) InvokeUnary(ctx context.Context, msgFactory *dynamic.MessageFactory, method *desc.MethodDescriptor, req proto.Message, opts ...grpc.CallOption) (proto.Message, error)

func (*ReflectionClient) Marshal

func (r *ReflectionClient) Marshal(w io.Writer, msg proto.Message) error

func (*ReflectionClient) Stub

Jump to

Keyboard shortcuts

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