client

package
v0.0.0-...-87acc28 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = logging.MustGetLogger("pool")

Functions

This section is empty.

Types

type ClientPool

type ClientPool struct {
	HTTPClient http.Client
	// contains filtered or unexported fields
}

ClientPool is an implementation of the APIClient interface which will handle server failure, rotate servers, and retry API requests.

func NewClientPool

func NewClientPool(endpoints []string, proxyDialer proxy.Dialer) (*ClientPool, error)

NewClientPool instantiates a new ClientPool object with the given server APIs

func (*ClientPool) BlockNotify

func (p *ClientPool) BlockNotify() <-chan model.Block

BlockNofity proxies the active client's block channel

func (*ClientPool) Broadcast

func (p *ClientPool) Broadcast(tx []byte) (string, error)

Broadcast proxies the same request to the active client

func (*ClientPool) Clients

func (p *ClientPool) Clients() []*blockbook.BlockBookClient

func (*ClientPool) Close

func (p *ClientPool) Close()

Close proxies the same request to the active client

func (*ClientPool) EstimateFee

func (p *ClientPool) EstimateFee(nBlocks int) (int, error)

EstimateFee proxies the same request to the active client

func (*ClientPool) FailAndCloseCurrentClient

func (p *ClientPool) FailAndCloseCurrentClient()

FailAndCloseCurrentClient cleans up the active client's connections, and signals to the rotation manager that it is unhealthy. The internal runLoop will detect the client's closing and attempt to start the next available.

func (*ClientPool) GetBestBlock

func (p *ClientPool) GetBestBlock() (*model.Block, error)

GetBestBlock proxies the same request to the active client

func (*ClientPool) GetInfo

func (p *ClientPool) GetInfo() (*model.Info, error)

GetInfo proxies the same request to the active client

func (*ClientPool) GetRawTransaction

func (p *ClientPool) GetRawTransaction(txid string) ([]byte, error)

GetRawTransaction proxies the same request to the active client

func (*ClientPool) GetTransaction

func (p *ClientPool) GetTransaction(txid string) (*model.Transaction, error)

GetTransaction proxies the same request to the active client

func (*ClientPool) GetTransactions

func (p *ClientPool) GetTransactions(addrs []btcutil.Address) ([]model.Transaction, error)

GetTransactions proxies the same request to the active client

func (*ClientPool) GetUtxos

func (p *ClientPool) GetUtxos(addrs []btcutil.Address) ([]model.Utxo, error)

GetUtxos proxies the same request to the active client

func (*ClientPool) ListenAddresses

func (p *ClientPool) ListenAddresses(addrs ...btcutil.Address)

ListenAddresses proxies the same request to the active client

func (*ClientPool) PoolManager

func (p *ClientPool) PoolManager() *rotationManager

PoolManager returns the pool manager object

func (*ClientPool) Start

func (p *ClientPool) Start() error

Start will attempt to connect to the first available server. If it fails to connect it will rotate through the servers to try to find one that works.

func (*ClientPool) TransactionNotify

func (p *ClientPool) TransactionNotify() <-chan model.Transaction

TransactionNotify proxies the active client's tx channel

type RotationTarget

type RotationTarget string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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