storage

package
v0.0.0-...-134943b Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeDisconnected string = "DISCONNECTED"
	NodeConnected    string = "CONNECTED"
)
View Source
const DefaultTimeout = 2 * time.Second
View Source
const ValidatorFile = "data/validator_rpcs.csv"

Variables

This section is empty.

Functions

func CreateDBClients

func CreateDBClients(config DBConfig) (*sql.DB, error)

func Monitor

func Monitor(config Config)

func MustMonitorFromViper

func MustMonitorFromViper()

func ParallelQueryRpc

func ParallelQueryRpc[T any](ctx context.Context, nodes []string, rpcFunc func(*node.ZgsClient, context.Context) (T, error), opt ...parallel.SerialOption) (map[string]*QueryRpcResult[T], error)

Types

type Config

type Config struct {
	Interval          time.Duration `default:"600s"`
	Nodes             map[string]string
	KvNodes           map[string]string
	StorageNodeReport health.TimedCounterConfig
	DbConfig          DBConfig
}

type DBConfig

type DBConfig struct {
	Host     string
	Port     string
	Username string
	Password string
	DbName   string
}

type KvNode

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

func MustNewKvNode

func MustNewKvNode(discordId, validatorAddress, ip string) *KvNode

func NewKvNode

func NewKvNode(discordId, validatorAddress, ip string) (*KvNode, error)

func (*KvNode) CheckStatus

func (kvNode *KvNode) CheckStatus(config health.TimedCounterConfig)

func (*KvNode) CheckStatusSilence

func (kvNode *KvNode) CheckStatusSilence(config health.TimedCounterConfig, db *sql.DB)

type QueryRpcResult

type QueryRpcResult[T any] struct {
	Data    T
	Err     error
	Latency time.Duration
}

type StorageNode

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

func MustNewStorageNode

func MustNewStorageNode(discordId, validatorAddress, ip string) *StorageNode

func NewStorageNode

func NewStorageNode(discordId, validatorAddress, ip string) (*StorageNode, error)

func (*StorageNode) CheckStatus

func (storageNode *StorageNode) CheckStatus(config health.TimedCounterConfig)

func (*StorageNode) CheckStatusSilence

func (storageNode *StorageNode) CheckStatusSilence(config health.TimedCounterConfig, db *sql.DB)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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