Documentation ¶
Index ¶
- Variables
- type ClientPool
- func (p *ClientPool) BlockNotify() <-chan model.Block
- func (p *ClientPool) Broadcast(tx []byte) (string, error)
- func (p *ClientPool) Clients() []*blockbook.BlockBookClient
- func (p *ClientPool) Close()
- func (p *ClientPool) EstimateFee(nBlocks int) (int, error)
- func (p *ClientPool) FailAndCloseCurrentClient()
- func (p *ClientPool) GetBestBlock() (*model.Block, error)
- func (p *ClientPool) GetInfo() (*model.Info, error)
- func (p *ClientPool) GetRawTransaction(txid string) ([]byte, error)
- func (p *ClientPool) GetTransaction(txid string) (*model.Transaction, error)
- func (p *ClientPool) GetTransactions(addrs []btcutil.Address) ([]model.Transaction, error)
- func (p *ClientPool) GetUtxos(addrs []btcutil.Address) ([]model.Utxo, error)
- func (p *ClientPool) ListenAddresses(addrs ...btcutil.Address)
- func (p *ClientPool) PoolManager() *rotationManager
- func (p *ClientPool) Start() error
- func (p *ClientPool) TransactionNotify() <-chan model.Transaction
- type RotationTarget
Constants ¶
This section is empty.
Variables ¶
var Log = logging.MustGetLogger("pool")
Functions ¶
This section is empty.
Types ¶
type ClientPool ¶
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) 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