edgec

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: BSD-3-Clause Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConnection      = fmt.Errorf("no connection")
	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 Client

type Client interface {
	Send(req, res *rony.MessageEnvelope, leaderOnly bool) error
	Close() error
	GetRequestID() uint64
}

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) Close added in v0.0.49

func (h *Http) Close() error

Close implements Client interface

func (*Http) GetRequestID added in v0.0.49

func (h *Http) GetRequestID() uint64

GetRequestID implements Client interface

func (*Http) Send added in v0.0.49

func (h *Http) Send(req *rony.MessageEnvelope, res *rony.MessageEnvelope, leaderOnly bool) error

func (*Http) SendWithDetails added in v0.1.8

func (h *Http) SendWithDetails(req *rony.MessageEnvelope, res *rony.MessageEnvelope, retry int, timeout time.Duration, leaderOnly bool) (err error)

Send implements Client interface

func (*Http) Start added in v0.2.9

func (h *Http) Start() error

type HttpConfig added in v0.0.49

type HttpConfig struct {
	Name            string
	SeedHostPort    string
	Header          map[string]string
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	ContextTimeout  time.Duration
	RequestMaxRetry int
	Router          Router
	Secure          bool
}

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) Close

func (c *Websocket) Close() error

func (*Websocket) GetRequestID

func (c *Websocket) GetRequestID() uint64

func (*Websocket) Send

func (c *Websocket) Send(req, res *rony.MessageEnvelope, leaderOnly bool) (err error)

func (*Websocket) SendWithDetails

func (c *Websocket) SendWithDetails(
	req, res *rony.MessageEnvelope,
	waitToConnect bool, retry int, timeout time.Duration,
	leaderOnly bool,
) (err error)

func (*Websocket) Start added in v0.1.5

func (c *Websocket) Start() error

type WebsocketConfig added in v0.0.49

type WebsocketConfig struct {
	SeedHostPort string
	IdleTimeout  time.Duration
	DialTimeout  time.Duration
	Handler      MessageHandler
	Header       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         Router
}

WebsocketConfig holds the configs for the Websocket client

Jump to

Keyboard shortcuts

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