monitor

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterMainChainMetrics

func RegisterMainChainMetrics()

RegisterMainChainMetrics inits prometheus metrics for main chain. Panics if can't do it.

func RegisterSideChainMetrics

func RegisterSideChainMetrics()

RegisterSideChainMetrics inits prometheus metrics for side chain. Panics if can't do it.

Types

type AlphabetFetcher

type AlphabetFetcher interface {
	FetchAlphabet() (keys.PublicKeys, error)
}

type ContainerFetcher

type ContainerFetcher interface {
	Total() (int64, error)
}

type HeightData

type HeightData struct {
	Host  string
	Value uint32
}

type HeightFetcher

type HeightFetcher interface {
	FetchHeight() []HeightData
}

type InnerRingFetcher

type InnerRingFetcher interface {
	FetchInnerRingKeys() (keys.PublicKeys, error)
}

type Item

type Item struct {
	Symbol   string
	Hash     util.Uint160
	Accounts []util.Uint160
	Total    bool
}

Item describes task for Nep17tracker.

func ParseNep17Tasks

func ParseNep17Tasks(balanceFetcher Nep17BalanceFetcher, items []model.Nep17Balance, nns NNSResolver) ([]Item, error)

ParseNep17Tasks prepares tasks for Nep17tracker.

type Job

type Job interface {
	Process()
}

type MainJob

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

func NewMainJob

func NewMainJob(args MainJobArgs) *MainJob

func (*MainJob) Process

func (m *MainJob) Process()

type MainJobArgs

type MainJobArgs struct {
	AlphabetFetcher AlphabetFetcher
	BalanceFetcher  Nep17BalanceFetcher
	Neofs           *util.Uint160
	Logger          *zap.Logger
	Nep17tracker    *Nep17tracker
}

type Monitor

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

func New

func New(job Job, metricAddress string, sleep time.Duration, logger *zap.Logger) *Monitor

func (*Monitor) Job

func (m *Monitor) Job(ctx context.Context)

func (*Monitor) Logger

func (m *Monitor) Logger() *zap.Logger

func (*Monitor) Start

func (m *Monitor) Start(ctx context.Context)

func (*Monitor) Stop

func (m *Monitor) Stop()

type NNSResolver

type NNSResolver interface {
	ResolveFSContract(name string) (util.Uint160, error)
}

NNSResolver helps to resolve NNS contract name to address.

type Nep17BalanceFetcher

type Nep17BalanceFetcher interface {
	Fetch(tokenHash util.Uint160, account util.Uint160) (float64, error)
	FetchTotalSupply(tokenHash util.Uint160) (float64, error)
	Symbol(tokenHash util.Uint160) (string, error)
}

type Nep17Fetcher

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

Nep17Fetcher allows to fetch balances from passed contract and account.

func NewNep17BalanceFetcher

func NewNep17BalanceFetcher(cli nep17.Invoker) (*Nep17Fetcher, error)

NewNep17BalanceFetcher is a constructor for Nep17Fetcher.

func (*Nep17Fetcher) Fetch

func (b *Nep17Fetcher) Fetch(tokenHash util.Uint160, account util.Uint160) (float64, error)

Fetch returns the token balance of the given account.

func (*Nep17Fetcher) FetchTotalSupply

func (b *Nep17Fetcher) FetchTotalSupply(tokenHash util.Uint160) (float64, error)

FetchTotalSupply returns total token supply currently available.

func (*Nep17Fetcher) Symbol

func (b *Nep17Fetcher) Symbol(tokenHash util.Uint160) (string, error)

Symbol returns a short token identifier.

type Nep17tracker

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

Nep17tracker allows to get balances of accounts in corresponding contracts.

func NewNep17tracker

func NewNep17tracker(balanceFetcher Nep17BalanceFetcher, tasks []Item) (*Nep17tracker, error)

NewNep17tracker is a constructor for Nep17tracker.

func (*Nep17tracker) Process

func (n *Nep17tracker) Process(metric *prometheus.GaugeVec, metricTotal *prometheus.GaugeVec)

Process runs the tasks and updates metrics.

type NetmapCandidatesInfo

type NetmapCandidatesInfo struct {
	Nodes []*Node
}

type NetmapFetcher

type NetmapFetcher interface {
	FetchNetmap() (NetmapInfo, error)
	FetchCandidates() (NetmapCandidatesInfo, error)
}

type NetmapInfo

type NetmapInfo struct {
	Epoch uint64
	Nodes []*Node
}

type Node

type Node struct {
	ID         uint64
	Address    string
	PublicKey  *keys.PublicKey
	Attributes map[string]string
	Locode     string
}

type NotaryBalanceFetcher added in v0.11.0

type NotaryBalanceFetcher interface {
	FetchNotary(account util.Uint160) (float64, error)
}

type NotaryFetcher added in v0.11.0

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

NotaryFetcher allows to fetch notary balances from account.

func NewNotaryFetcher added in v0.11.0

func NewNotaryFetcher(cli nep17.Invoker) (*NotaryFetcher, error)

NewNotaryFetcher is a constructor for NotaryFetcher.

func (*NotaryFetcher) FetchNotary added in v0.11.0

func (b *NotaryFetcher) FetchNotary(account util.Uint160) (float64, error)

FetchNotary returns the notary balance of the given account.

type SideJob

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

func NewSideJob

func NewSideJob(args SideJobArgs) *SideJob

func (*SideJob) Process

func (m *SideJob) Process()

type SideJobArgs

type SideJobArgs struct {
	Logger               *zap.Logger
	Balance              util.Uint160
	Proxy                *util.Uint160
	AlphabetFetcher      AlphabetFetcher
	NmFetcher            NetmapFetcher
	IRFetcher            InnerRingFetcher
	BalanceFetcher       Nep17BalanceFetcher
	NotaryBalanceFetcher NotaryBalanceFetcher
	CnrFetcher           ContainerFetcher
	HeightFetcher        HeightFetcher
	StateFetcher         StateFetcher
	Nep17tracker         *Nep17tracker
}

type StateData

type StateData struct {
	Host  string
	Value string
}

type StateFetcher

type StateFetcher interface {
	FetchState(height uint32) []StateData
}

Jump to

Keyboard shortcuts

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