Documentation ¶
Index ¶
Constants ¶
View Source
const ( // CRC16("github.com/privatix/dappctrl/bc") = 0xD8D2 ErrFailedToFetchLogs errors.Error = 0xD8D2<<8 + iota ErrFailedToGetActiveAccounts ErrFailedToScanRows ErrFailedToTraverseAddresses ErrFailedToGetHeaderByNumber ErrFailedToParseABI ErrFailedToUnpack ErrWrongNumberOfEventArgs ErrWrongBlockArgumentType ErrUnsupportedTopic ErrInternal )
Errors.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) }
Client defines typed wrappers for the Ethereum RPC API.
type Config ¶
type Config struct { EthCallTimeout uint // In milliseconds. InitialBlocks uint64 // In Ethereum blocks. QueryPause uint // In milliseconds. RateAfter uint // Number of ethereum channel close events to initiate rating calculation after. }
Config is a monitor configuration.
type Monitor ¶
type Monitor struct { // RequestTimeout is a timeout for requeting anything using Client. RequestTimeout time.Duration // Queue is a job queue. Queue Queue // NextRound returns queries to get ethereum logs at the next round of monitoring. NextRound func(latestBlock uint64) ([]ethereum.FilterQuery, func(*reform.TX) error, error) // JobsForLog return jobs to create for given ethereum log. JobsForLog func(*data.JobEthLog) ([]data.Job, error) // RoundsInterval is an interval at which monitoring rounds are run. RoundsInterval time.Duration // contains filtered or unexported fields }
Monitor continuously scans blockchain for new ethereum logs and creates jobs for them.
Each round of monitoring consists of adding jobs for ethereum logs filtered by filter queries. Each round start by NextRound and DoneRound.
Click to show internal directories.
Click to hide internal directories.