pool

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BestPingStrategy       = "best-ping"
	FirstWorkingConnection = "first-working"
)

Variables

View Source
var (
	ErrNoConnections = fmt.Errorf("no connections available")
)

Functions

This section is empty.

Types

type ConnPool added in v1.6.6

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

ConnPool is a pool of connections to lite servers that implements two different strategy:

  1. BestPingStrategy - it'll switch to a connection with the best ping.
  2. FirstWorkingConnection - it'll switch to the first working connection.

For both strategies, a connection has to be not more than 1 block behind the head of masterchain to be considered as working.

func New added in v1.6.6

func New(strategy Strategy) *ConnPool

New returns a new instance of a connections pool.

func (*ConnPool) BestArchiveClient added in v1.6.6

func (p *ConnPool) BestArchiveClient(ctx context.Context) (*liteclient.Client, ton.BlockIDExt, error)

func (*ConnPool) BestClientByAccountID added in v1.6.6

func (p *ConnPool) BestClientByAccountID(ctx context.Context, accountID ton.AccountID, archiveRequired bool) (*liteclient.Client, ton.BlockIDExt, error)

BestClientByAccountID returns a liteclient and its known masterchain head.

func (*ConnPool) BestClientByBlockID added in v1.6.6

func (p *ConnPool) BestClientByBlockID(ctx context.Context, blockID ton.BlockID) (*liteclient.Client, error)

BestClientByBlockID returns a liteclient and its known masterchain head.

func (*ConnPool) BestMasterchainClient added in v1.6.6

func (p *ConnPool) BestMasterchainClient(ctx context.Context) (*liteclient.Client, ton.BlockIDExt, error)

BestMasterchainClient returns a liteclient and its known masterchain head.

func (*ConnPool) BestMasterchainInfoClient added in v1.6.6

func (p *ConnPool) BestMasterchainInfoClient() *MasterchainInfoClient

func (*ConnPool) ConnectionsNumber added in v1.6.6

func (p *ConnPool) ConnectionsNumber() int

ConnectionsNumber returns a number of connections in this pool.

func (*ConnPool) InitializeConnections added in v1.6.6

func (p *ConnPool) InitializeConnections(ctx context.Context, timeout time.Duration, maxConnections int, detectArchiveNodes bool, servers []config.LiteServer) chan error

func (*ConnPool) Run added in v1.6.6

func (p *ConnPool) Run(ctx context.Context)

func (*ConnPool) WaitMasterchainSeqno added in v1.6.6

func (p *ConnPool) WaitMasterchainSeqno(ctx context.Context, seqno uint32, timeout time.Duration) error

type MasterchainInfoClient added in v1.2.1

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

func (*MasterchainInfoClient) LiteServerGetMasterchainInfo added in v1.2.1

func (s *MasterchainInfoClient) LiteServerGetMasterchainInfo(ctx context.Context) (liteclient.LiteServerMasterchainInfoC, error)

func (*MasterchainInfoClient) LiteServerGetMasterchainInfoExt added in v1.2.1

type Strategy added in v1.6.6

type Strategy string

Jump to

Keyboard shortcuts

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