Documentation ¶
Index ¶
- Variables
- type CheckpointState
- type Client
- type Monitor
- func (m *Monitor) GetWorkerStatusByID(ctx context.Context, workerID string) workerx.Status
- func (m *Monitor) MonitorMockWorkerStatus(ctx context.Context, currentState CheckpointState, latestState uint64) error
- func (m *Monitor) MonitorWorkerStatus(ctx context.Context) error
- func (m *Monitor) Run(ctx context.Context) error
- func (m *Monitor) UpdateWorkerProgress(ctx context.Context, workerID string, state uint64) error
- func (m *Monitor) UpdateWorkerStatusByID(ctx context.Context, workerID string, status string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var NetworkTolerance = map[network.Network]uint64{ network.Arbitrum: 100, network.Arweave: 100, network.Avalanche: 100, network.Base: 100, network.BinanceSmartChain: 100, network.Crossbell: 100, network.Ethereum: 100, network.Farcaster: 3600000, network.Gnosis: 100, network.Linea: 100, network.Optimism: 100, network.Polygon: 100, network.SatoshiVM: 100, network.VSL: 100, }
Functions ¶
This section is empty.
Types ¶
type CheckpointState ¶
type Client ¶
type Client interface { // CurrentState returns the current block number (ethereum), height (arweave) or event id (farcaster) of the client from Checkpoints table in database. CurrentState(state CheckpointState) uint64 // LatestState returns the latest block number (ethereum), height (arweave) or event id (farcaster) of the client from network rpc/api. LatestState(ctx context.Context) (uint64, error) }
func NewArweaveClient ¶
NewArweaveClient returns a new arweave client.
func NewEthereumClient ¶
NewEthereumClient returns a new ethereum client.
func NewFarcasterClient ¶
NewFarcasterClient returns a new farcaster client.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
func NewMonitor ¶
func NewMonitor(_ context.Context, config *config.File, databaseClient database.Client, redisClient rueidis.Client) (*Monitor, error)
NewMonitor creates a new monitor instance.
func (*Monitor) GetWorkerStatusByID ¶ added in v0.4.24
GetWorkerStatusByID gets worker status from Redis cache by network and workerName.
func (*Monitor) MonitorMockWorkerStatus ¶
func (*Monitor) MonitorWorkerStatus ¶
MonitorWorkerStatus checks the worker status by comparing the current and latest block height/number. flags the worker as unhealthy if it's left behind the latest block height/number by more than the tolerance.
func (*Monitor) UpdateWorkerProgress ¶
UpdateWorkerProgress updates worker progress (state) in each monitoring cycle to Redis Cache.
Click to show internal directories.
Click to hide internal directories.