endpoint

package
v0.0.0-...-b9d6073 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package endpoint is transport implement of different protocol.

Index

Constants

View Source
const (
	Grpc   = "grpc"
	Motan2 = "motan2"
	Mock   = "mockEndpoint"
)

ext name

View Source
const (
	GRPCSerialNum = 1
)

Variables

View Source
var (
	ErrChannelShutdown    = fmt.Errorf("The channel has been shutdown")
	ErrSendRequestTimeout = fmt.Errorf("Timeout err: send request timeout")
	ErrRecvRequestTimeout = fmt.Errorf("Timeout err: receive request timeout")
)

Functions

func GenerateRequestID

func GenerateRequestID() uint64

func GetRequestGroup

func GetRequestGroup(r motan.Request) string

func RegistDefaultEndpoint

func RegistDefaultEndpoint(extFactory motan.ExtentionFactory)

func VerifyConfig

func VerifyConfig(config *Config) error

Types

type Channel

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

func (*Channel) Call

func (c *Channel) Call(msg *mpro.Message, deadline time.Duration, rc *motan.RPCContext) (*mpro.Message, error)

func (*Channel) Close

func (c *Channel) Close() error

func (*Channel) IsClosed

func (c *Channel) IsClosed() bool

func (*Channel) NewStream

func (c *Channel) NewStream(msg *mpro.Message, rc *motan.RPCContext) (*Stream, error)

type ChannelPool

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

func NewChannelPool

func NewChannelPool(poolCap int, factory ConnFactory, config *Config, serialization motan.Serialization) (*ChannelPool, error)

func (*ChannelPool) Close

func (c *ChannelPool) Close() error

func (*ChannelPool) Get

func (c *ChannelPool) Get() (*Channel, error)

type Config

type Config struct {
	RequestTimeout time.Duration
}

Config : Config

func DefaultConfig

func DefaultConfig() *Config

type ConnFactory

type ConnFactory func() (net.Conn, error)

type GrpcEndPoint

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

func (*GrpcEndPoint) Call

func (g *GrpcEndPoint) Call(request motan.Request) motan.Response

func (*GrpcEndPoint) Destroy

func (g *GrpcEndPoint) Destroy()

func (*GrpcEndPoint) GetName

func (g *GrpcEndPoint) GetName() string

func (*GrpcEndPoint) GetURL

func (g *GrpcEndPoint) GetURL() *motan.URL

func (*GrpcEndPoint) Initialize

func (g *GrpcEndPoint) Initialize()

func (*GrpcEndPoint) IsAvailable

func (g *GrpcEndPoint) IsAvailable() bool

func (*GrpcEndPoint) SetProxy

func (g *GrpcEndPoint) SetProxy(proxy bool)

func (*GrpcEndPoint) SetSerialization

func (g *GrpcEndPoint) SetSerialization(s motan.Serialization)

func (*GrpcEndPoint) SetURL

func (g *GrpcEndPoint) SetURL(url *motan.URL)

type MockEndpoint

type MockEndpoint struct {
	URL          *motan.URL
	MockResponse motan.Response
}

func (*MockEndpoint) Call

func (m *MockEndpoint) Call(request motan.Request) motan.Response

func (*MockEndpoint) Destroy

func (m *MockEndpoint) Destroy()

func (*MockEndpoint) GetName

func (m *MockEndpoint) GetName() string

func (*MockEndpoint) GetURL

func (m *MockEndpoint) GetURL() *motan.URL

func (*MockEndpoint) IsAvailable

func (m *MockEndpoint) IsAvailable() bool

func (*MockEndpoint) SetProxy

func (m *MockEndpoint) SetProxy(proxy bool)

func (*MockEndpoint) SetSerialization

func (m *MockEndpoint) SetSerialization(s motan.Serialization)

func (*MockEndpoint) SetURL

func (m *MockEndpoint) SetURL(url *motan.URL)

type MotanEndpoint

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

func (*MotanEndpoint) Call

func (m *MotanEndpoint) Call(request motan.Request) motan.Response

func (*MotanEndpoint) Destroy

func (m *MotanEndpoint) Destroy()

func (*MotanEndpoint) GetName

func (m *MotanEndpoint) GetName() string

func (*MotanEndpoint) GetURL

func (m *MotanEndpoint) GetURL() *motan.URL

func (*MotanEndpoint) Initialize

func (m *MotanEndpoint) Initialize()

func (*MotanEndpoint) IsAvailable

func (m *MotanEndpoint) IsAvailable() bool

func (*MotanEndpoint) SetProxy

func (m *MotanEndpoint) SetProxy(proxy bool)

func (*MotanEndpoint) SetSerialization

func (m *MotanEndpoint) SetSerialization(s motan.Serialization)

func (*MotanEndpoint) SetURL

func (m *MotanEndpoint) SetURL(url *motan.URL)

type OutMsg

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

type Stream

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

func (*Stream) Close

func (s *Stream) Close()

func (*Stream) Recv

func (s *Stream) Recv() (*mpro.Message, error)

Recv sync recv

func (*Stream) Send

func (s *Stream) Send() error

func (*Stream) SetDeadline

func (s *Stream) SetDeadline(deadline time.Duration)

Jump to

Keyboard shortcuts

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