Documentation
¶
Index ¶
- type FailoverPool
- func (p *FailoverPool) BestMasterchainServer() *liteclient.Client
- func (p *FailoverPool) BestServerByAccountID(tongo.AccountID) (*liteclient.Client, error)
- func (p *FailoverPool) BestServerByBlockID(tongo.BlockID) (*liteclient.Client, error)
- func (p *FailoverPool) ConnectionsNumber() int
- func (p *FailoverPool) Run(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FailoverPool ¶
type FailoverPool struct {
// contains filtered or unexported fields
}
FailoverPool is a pool of connections to lite servers that implements a failover strategy and in case of failure it'll automatically switch to a working connection.
The failover strategy is as follows: given a list of connections, a pool uses the first connection from the list that is 1. working 2. not more than 1 block behind the head of masterchain.
func NewFailoverPool ¶
func NewFailoverPool(clients []*liteclient.Client) *FailoverPool
NewFailoverPool returns a new instance of a failover pool. The given list of clients is ordered by priority and starts with a connection with the highest priority.
func (*FailoverPool) BestMasterchainServer ¶
func (p *FailoverPool) BestMasterchainServer() *liteclient.Client
func (*FailoverPool) BestServerByAccountID ¶
func (p *FailoverPool) BestServerByAccountID(tongo.AccountID) (*liteclient.Client, error)
func (*FailoverPool) BestServerByBlockID ¶
func (p *FailoverPool) BestServerByBlockID(tongo.BlockID) (*liteclient.Client, error)
func (*FailoverPool) ConnectionsNumber ¶
func (p *FailoverPool) ConnectionsNumber() int
ConnectionsNumber returns a number of connections in this pool.
func (*FailoverPool) Run ¶
func (p *FailoverPool) Run(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.