wsrpc

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 20 Imported by: 4

Documentation

Index

Constants

View Source
const MaxConsecutiveRequestFailures = 10

MaxConsecutiveRequestFailures controls how many consecutive requests are allowed to time out before we reset the connection

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	services.Service
	pb.MercuryClient
	ServerURL() string
	RawClient() pb.MercuryClient
}

func NewClient

func NewClient(opts ClientOpts) Client

Consumers of wsrpc package should not usually call NewClient directly, but instead use the Pool

type ClientOpts

type ClientOpts struct {
	Logger       logger.SugaredLogger
	CSASigner    crypto.Signer
	ServerPubKey []byte
	ServerURL    string
	CacheSet     cache.CacheSet

	// DialWithContext allows optional dependency injection for testing
	DialWithContext DialWithContextFunc
}

type Conn

type Conn interface {
	wsrpc.ClientInterface
	WaitForReady(ctx context.Context) bool
	GetState() grpc_connectivity.State
	Close() error
}

type DialWithContextFunc

type DialWithContextFunc func(ctxCaller context.Context, target string, opts ...wsrpc.DialOption) (Conn, error)

type GRPCCompatibilityWrapper

type GRPCCompatibilityWrapper struct {
	Client
}

func (GRPCCompatibilityWrapper) Transmit

type Pool

type Pool interface {
	services.Service
	// Checkout gets a wsrpc.Client for the given arguments
	// The same underlying client can be checked out multiple times, the pool
	// handles lifecycle management. The consumer can treat it as if it were
	// its own unique client.
	Checkout(ctx context.Context, clientPubKeyHex string, clientSigner crypto.Signer, serverPubKey []byte, serverURL string) (client Client, err error)
}

func NewPool

func NewPool(lggr logger.Logger, cacheCfg cache.Config) Pool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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