forked from cosmos/relayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chain_processor.go
26 lines (20 loc) · 1.31 KB
/
chain_processor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package processor
import (
"context"
"github.com/cosmos/relayer/v2/relayer/provider"
)
// The ChainProcessor interface is responsible for polling blocks and emitting IBC message events to the PathProcessors.
// It is also responsible for tracking open channels and not sending messages to the PathProcessors for closed channels.
type ChainProcessor interface {
// Run starts the query loop for the chain which will gather applicable ibc messages and push events out to the relevant PathProcessors.
// The initialBlockHistory parameter determines how many historical blocks should be fetched and processed before continuing with current blocks.
// ChainProcessors should obey the context and return upon context cancellation.
Run(ctx context.Context, initialBlockHistory uint64, stuckPacket *StuckPacket) error
// Provider returns the ChainProvider, which provides the methods for querying, assembling IBC messages, and sending transactions.
Provider() provider.ChainProvider
// Set the PathProcessors that this ChainProcessor should publish relevant IBC events to.
// ChainProcessors need reference to their PathProcessors and vice-versa, handled by EventProcessorBuilder.Build().
SetPathProcessors(pathProcessors PathProcessors)
}
// ChainProcessors is a slice of ChainProcessor instances.
type ChainProcessors []ChainProcessor