client

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalancedClient

type BalancedClient struct {
	Clients  []*ClientConfig
	Balancer *balancer.ClientBalancer[Upstream]
	Log      *slog.Logger
}

func NewBalancedClient

func NewBalancedClient(clients []*ClientConfig, labels []any) *BalancedClient

func (*BalancedClient) BatchCallContext

func (c *BalancedClient) BatchCallContext(ctx context.Context, batch *jsonrpc.RpcBatch) (err error)

func (*BalancedClient) Call

func (c *BalancedClient) Call(raw *jsonrpc.RawCall) (err error)

func (*BalancedClient) CallContext

func (c *BalancedClient) CallContext(ctx context.Context, raw *jsonrpc.RawCall) (err error)

func (*BalancedClient) CallEveryUpstream

func (c *BalancedClient) CallEveryUpstream(ctx context.Context, raw *jsonrpc.RawCall) (err error)

func (*BalancedClient) Close

func (c *BalancedClient) Close() error

func (*BalancedClient) Start

func (c *BalancedClient) Start() *BalancedClient

type ClientConfig

type ClientConfig struct {
	Url string
	//options  []rpc.ClientOption
	LimitRps uint
	Labels   []any
}

func (*ClientConfig) Close

func (c *ClientConfig) Close()

func (*ClientConfig) Dial

func (c *ClientConfig) Dial(ctx context.Context) (Upstream, error)

func (*ClientConfig) GetLimitRps

func (c *ClientConfig) GetLimitRps() uint32

func (*ClientConfig) IsConnectionError

func (c *ClientConfig) IsConnectionError(err error) bool

type EthRpcClient

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

func DialContext

func DialContext(ctx context.Context, rawUrl string) (*EthRpcClient, error)

func (*EthRpcClient) BatchCall

func (c *EthRpcClient) BatchCall(batch *jsonrpc.RpcBatch) error

func (*EthRpcClient) BatchCallContext

func (c *EthRpcClient) BatchCallContext(ctx context.Context, batch *jsonrpc.RpcBatch) error

func (*EthRpcClient) Call

func (c *EthRpcClient) Call(raw *jsonrpc.RawCall) error

func (*EthRpcClient) CallContext

func (c *EthRpcClient) CallContext(ctx context.Context, raw *jsonrpc.RawCall) error

func (*EthRpcClient) Close

func (c *EthRpcClient) Close() error

type Metrics

type Metrics struct {
	// requests number and duration
	Requests prometheus.Histogram
	// number of upstreams
	Upstreams prometheus.Gauge
}

type Upstream

type Upstream struct {
	Client  jsonrpc.IRpcClient
	Metrics Metrics
}

func (Upstream) Close

func (u Upstream) Close() error

Jump to

Keyboard shortcuts

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