Documentation ¶
Index ¶
- type BitcoinNodeDatasource
- func (d *BitcoinNodeDatasource) Fetch(ctx context.Context, from, to int64) ([]*types.Block, error)
- func (d *BitcoinNodeDatasource) FetchAsync(ctx context.Context, from, to int64, ch chan<- []*types.Block) (*subscription.ClientSubscription[[]*types.Block], error)
- func (d *BitcoinNodeDatasource) GetBlockHeader(ctx context.Context, height int64) (types.BlockHeader, error)
- func (d *BitcoinNodeDatasource) GetTransactionByHash(ctx context.Context, txHash chainhash.Hash) (*types.Transaction, error)
- func (p BitcoinNodeDatasource) Name() string
- type Datasource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitcoinNodeDatasource ¶
type BitcoinNodeDatasource struct {
// contains filtered or unexported fields
}
BitcoinNodeDatasource fetch data from Bitcoin node for Bitcoin Indexer
func NewBitcoinNode ¶
func NewBitcoinNode(btcclient *rpcclient.Client) *BitcoinNodeDatasource
NewBitcoinNode create new BitcoinNodeDatasource with Bitcoin Core RPC Client
func (*BitcoinNodeDatasource) Fetch ¶
Fetch polling blocks from Bitcoin node
- from: block height to start fetching, if -1, it will start from genesis block
- to: block height to stop fetching, if -1, it will fetch until the latest block
func (*BitcoinNodeDatasource) FetchAsync ¶
func (d *BitcoinNodeDatasource) FetchAsync(ctx context.Context, from, to int64, ch chan<- []*types.Block) (*subscription.ClientSubscription[[]*types.Block], error)
FetchAsync polling blocks from Bitcoin node asynchronously (non-blocking)
- from: block height to start fetching, if -1, it will start from genesis block
- to: block height to stop fetching, if -1, it will fetch until the latest block
func (*BitcoinNodeDatasource) GetBlockHeader ¶
func (d *BitcoinNodeDatasource) GetBlockHeader(ctx context.Context, height int64) (types.BlockHeader, error)
GetBlockHeader fetch block header from Bitcoin node
func (*BitcoinNodeDatasource) GetTransactionByHash ¶
func (d *BitcoinNodeDatasource) GetTransactionByHash(ctx context.Context, txHash chainhash.Hash) (*types.Transaction, error)
GetTransaction fetch transaction from Bitcoin node
func (BitcoinNodeDatasource) Name ¶
func (p BitcoinNodeDatasource) Name() string
type Datasource ¶
type Datasource[T any] interface { Name() string Fetch(ctx context.Context, from, to int64) ([]T, error) FetchAsync(ctx context.Context, from, to int64, ch chan<- []T) (*subscription.ClientSubscription[[]T], error) GetBlockHeader(ctx context.Context, height int64) (types.BlockHeader, error) }
Datasource is an interface for indexer data sources.
Click to show internal directories.
Click to hide internal directories.