rpc

package
v0.1.59 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceIsNil  = errors.New("[rpc] service 不能为nil")
	ErrStructPtrOnly = errors.New("[rpc] service 只能传入结构体指针")
)

Functions

func ClientWithCompressor added in v0.1.47

func ClientWithCompressor(compressor compress.Compressor) clientOption

func ClientWithSerializer added in v0.1.46

func ClientWithSerializer(s serialize.Serializer) clientOption

func ContextWithOneway added in v0.1.46

func ContextWithOneway(ctx context.Context) context.Context

func IsOneWayContext added in v0.1.46

func IsOneWayContext(ctx context.Context) bool

func ReadMsg added in v0.1.44

func ReadMsg(conn net.Conn) ([]byte, error)

Types

type Client added in v0.1.43

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

func NewClient added in v0.1.46

func NewClient(addr string, opts ...clientOption) *Client

func (*Client) Invoke added in v0.1.43

func (c *Client) Invoke(ctx context.Context, req *message.Request) (*message.Response, error)

type Proxy

type Proxy interface {
	Invoke(ctx context.Context, req *message.Request) (*message.Response, error)
}

type Server added in v0.1.43

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

func NewServer added in v0.1.43

func NewServer() *Server

func (*Server) Invoke added in v0.1.44

func (s *Server) Invoke(ctx context.Context, req *message.Request) (*message.Response, error)

func (*Server) Register added in v0.1.43

func (s *Server) Register(srv Service)

func (*Server) RegisterCompressor added in v0.1.47

func (s *Server) RegisterCompressor(compressor compress.Compressor)

func (*Server) RegisterSerializer added in v0.1.46

func (s *Server) RegisterSerializer(serializer serialize.Serializer)

func (*Server) Start added in v0.1.43

func (s *Server) Start(addr string) error

type Service

type Service interface {
	Name() string
}

type UserServiceImpl added in v0.1.43

type UserServiceImpl struct {
	testdata.UserService
}

func (*UserServiceImpl) GetUserByID added in v0.1.43

func (*UserServiceImpl) GetUserByIDProto added in v0.1.46

func (u *UserServiceImpl) GetUserByIDProto(ctx context.Context, req *gen.GetUserByIdReq) (*gen.GetUserByIdResp, error)

type UserServiceTimeOut added in v0.1.47

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

func (*UserServiceTimeOut) GetUserByID added in v0.1.47

func (*UserServiceTimeOut) Name added in v0.1.47

func (u *UserServiceTimeOut) Name() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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