worker

package
v0.0.0-...-7b2af25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Database database.Database
}

Context represents the context that is shared with worker

func NewWorkerContext

func NewWorkerContext(
	db database.Database,
) *Context

NewWorkerContext builds new Context instance

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker defines a job consumer that is responsible for getting latest IBC token price data and exporting it to a database.

func NewWorker

func NewWorker(ctx *Context) Worker

NewWorker allows to create a new Worker implementation.

func (*Worker) GetIBCTokensList

func (w *Worker) GetIBCTokensList() ([]types.ChainRegistryAsset, error)

GetIBCTokensList queries the latest IBC chain list and latest IBC token details from the given endpoint

func (*Worker) QueryAndSaveLatestIBCTokensInfo

func (w *Worker) QueryAndSaveLatestIBCTokensInfo() error

QueryAndSaveLatestIBCTokensInfo queries the latest IBC token details from the given endpoint and stores them inside the database

func (*Worker) QueryCoinGeckoForIBCTokensDetails

func (w *Worker) QueryCoinGeckoForIBCTokensDetails(ids []types.ChainRegistryAsset) error

QueryCoinGeckoForIBCTokensDetails queries the remote APIs to get the latest IBC tokens details and stores updated values in database

func (Worker) StartFetchingLatestIBCTokensInfo

func (w Worker) StartFetchingLatestIBCTokensInfo() error

StartFetchingLatestIBCTokensInfo starts the cron job that fetches and storees latest IBC tokens info inside the database once a day

func (Worker) StartFetchingPrices

func (w Worker) StartFetchingPrices() error

StartFetchingPrices starts the cron job that fetches and storees tokens prices every 5 minutes

func (Worker) StartWorker

func (w Worker) StartWorker()

StartWorker starts a worker that triggers periodic operations to update the IBC tokens info and price stored in database in given interval. It returns an error if any export process fails.

func (Worker) UpdateTokenPrices

func (w Worker) UpdateTokenPrices() error

UpdateTokenPrices queries latest IBC token prices and stores updated values in database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL