edgec

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: BSD-3-Clause Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout        = fmt.Errorf("time out")
	ErrLeaderRedirect = fmt.Errorf("leader redirect")
)

Functions

This section is empty.

Types

type Client

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

type Config

type Config struct {
	HostPort     string
	IdleTimeout  time.Duration
	DialTimeout  time.Duration
	Handler      MessageHandler
	Header       map[string]string
	Secure       bool
	ForceConnect 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
}

type MessageHandler

type MessageHandler func(m *rony.MessageEnvelope)

type Websocket

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

func NewWebsocket

func NewWebsocket(config Config) *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) (err error)

func (*Websocket) SendWithContext

func (c *Websocket) SendWithContext(ctx context.Context, req, res *rony.MessageEnvelope) (err error)

func (*Websocket) SendWithDetails

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

Jump to

Keyboard shortcuts

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