mirror of
https://github.com/alexgo-io/gaze-indexer.git
synced 2026-04-30 04:35:13 +08:00
* refactor(indexer): init generic indexer * refactor(btc): updatet datasource * refactor: remove old indexers pkg * doc: update comment --------- Co-authored-by: Gaze <gazenw@users.noreply.github.com> Co-authored-by: Planxnx <thanee@cleverse.com>
17 lines
518 B
Go
17 lines
518 B
Go
package datasources
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gaze-network/indexer-network/core/types"
|
|
"github.com/gaze-network/indexer-network/internal/subscription"
|
|
)
|
|
|
|
// Datasource is an interface for indexer data sources.
|
|
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)
|
|
}
|