Documentation
¶
Index ¶
- Variables
- type Client
- type ConnectHandler
- type Http
- func (h *Http) Close() error
- func (h *Http) GetRequestID() uint64
- func (h *Http) Send(ctx context.Context, req *rony.MessageEnvelope, res *rony.MessageEnvelope) error
- func (h *Http) SendWithDetails(ctx context.Context, req *rony.MessageEnvelope, res *rony.MessageEnvelope, ...) (err error)
- func (h *Http) Start() error
- type HttpConfig
- type MessageHandler
- type Router
- type Websocket
- func (ws *Websocket) Close() error
- func (ws *Websocket) ClusterInfo(replicaSets ...uint64) (*rony.Edges, error)
- func (ws *Websocket) ConnInfo() string
- func (ws *Websocket) GetRequestID() uint64
- func (ws *Websocket) Send(ctx context.Context, req, res *rony.MessageEnvelope) (err error)
- func (ws *Websocket) SendTo(ctx context.Context, req, res *rony.MessageEnvelope, serverID string) error
- func (ws *Websocket) SendWithDetails(ctx context.Context, req, res *rony.MessageEnvelope, retry int, ...) error
- func (ws *Websocket) Start() error
- func (ws *Websocket) Tracer() trace.Tracer
- type WebsocketConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoConnection = fmt.Errorf("no connection") ErrNoHost = fmt.Errorf("no host") ErrTimeout = fmt.Errorf("time out") ErrReplicaMaster = fmt.Errorf("leader redirect") ErrReplicaSetSession = fmt.Errorf("replica redirect session") ErrReplicaSetRequest = fmt.Errorf("replica redirect request") ErrUnknownResponse = fmt.Errorf("unknown response") )
Functions ¶
This section is empty.
Types ¶
type ConnectHandler ¶ added in v0.14.13
type ConnectHandler func(c *Websocket)
type Http ¶ added in v0.0.49
type Http struct {
// contains filtered or unexported fields
}
Http connects to edge servers with HTTP transport.
func NewHttp ¶ added in v0.0.49
func NewHttp(config HttpConfig) *Http
func (*Http) GetRequestID ¶ added in v0.0.49
GetRequestID implements Client interface
func (*Http) Send ¶ added in v0.0.49
func (h *Http) Send(ctx context.Context, req *rony.MessageEnvelope, res *rony.MessageEnvelope) error
func (*Http) SendWithDetails ¶ added in v0.1.8
type HttpConfig ¶ added in v0.0.49
type HttpConfig struct {
Name string
SeedHostPort string
HeaderFunc func() map[string]string
ReadTimeout time.Duration
WriteTimeout time.Duration
ContextTimeout time.Duration
RequestMaxRetry int
Router Router
Secure bool
Tracer trace.Tracer
}
HttpConfig holds the configurations for the Http client.
type MessageHandler ¶
type MessageHandler func(m *rony.MessageEnvelope)
type Router ¶ added in v0.1.5
type Router interface {
UpdateRoute(req *rony.MessageEnvelope, replicaSet uint64)
GetRoute(req *rony.MessageEnvelope) (replicaSet uint64)
}
type Websocket ¶
type Websocket struct {
// contains filtered or unexported fields
}
Websocket client which could handle multiple connections
func NewWebsocket ¶
func NewWebsocket(config WebsocketConfig) *Websocket
func (*Websocket) ClusterInfo ¶ added in v0.6.54
func (*Websocket) GetRequestID ¶
func (*Websocket) SendWithDetails ¶
type WebsocketConfig ¶ added in v0.0.49
type WebsocketConfig struct {
Name string
SeedHostPort string
IdleTimeout time.Duration
DialTimeout time.Duration
// Handler must not block in function because other incoming messages might get blocked.
// This handler must return quickly and pass a deep copy of the MessageEnvelope to other
// routines.
Handler MessageHandler
HeaderFunc func() map[string]string
Secure bool
// RequestMaxRetry is the maximum number client sends a request if any network layer error occurs
RequestMaxRetry int
// RequestTimeout is the timeout for each individual request on each try.
RequestTimeout time.Duration
// ContextTimeout is the amount that Send function will wait until times out. This includes all the retries.
ContextTimeout time.Duration
// Router is an optional parameter which give more control over selecting the target host based on each request.
Router Router
// OnConnect will be called everytime the websocket connection is established.
OnConnect ConnectHandler
Tracer trace.Tracer
}
WebsocketConfig holds the configs for the Websocket client
Click to show internal directories.
Click to hide internal directories.