feat(indexer): ensure impl

Co-authored-by: Gaze <dev@gaze.network>
This commit is contained in:
Gaze
2024-04-11 20:21:27 +07:00
parent 8092287609
commit 2003b1c81d
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package datasources
import (
"context"
"github.com/gaze-network/indexer-network/core/indexers"
"github.com/gaze-network/indexer-network/core/types"
)
// Make sure to implement the BitcoinDatasource interface
var _ indexers.BitcoinDatasource = (*BitcoinNodeDatasource)(nil)
type BitcoinNodeDatasource struct{}
func (d *BitcoinNodeDatasource) Fetch(ctx context.Context, from, to int64) ([]*types.Block, error) {
return nil, nil
}
func (d *BitcoinNodeDatasource) FetchAsync(ctx context.Context, from, to int64) (chan<- []*types.Block, func(), error) {
ctx, cancel := context.WithCancel(ctx)
return nil, cancel, nil
}

View File

@@ -9,6 +9,7 @@ import (
"github.com/btcsuite/btcd/rpcclient"
"github.com/cockroachdb/errors"
"github.com/gaze-network/indexer-network/common/errs"
"github.com/gaze-network/indexer-network/core"
"github.com/gaze-network/indexer-network/core/types"
"github.com/gaze-network/indexer-network/pkg/logger"
)
@@ -18,6 +19,9 @@ type (
BitcoinDatasource Datasource[*types.Block]
)
// Make sure to implement the IndexerWorker interface
var _ core.IndexerWorker = (*BitcoinIndexer)(nil)
// BitcoinIndexer is the indexer for sync Bitcoin data to the database.
type BitcoinIndexer struct {
Processor BitcoinProcessor