info

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "info"

Variables

View Source
var NetworkToWorkersMap = map[network.Network][]worker.Worker{
	network.Arbitrum: {
		decentralized.Aave,
		decentralized.Arbitrum,
		decentralized.Core,
		decentralized.Curve,
		decentralized.Highlight,
		decentralized.Rainbow,
		decentralized.Stargate,
		decentralized.Zerion,
	},
	network.Arweave: {
		decentralized.Mirror,
		decentralized.Momoka,
		decentralized.Paragraph,
	},
	network.Avalanche: {
		decentralized.Aave,
		decentralized.Core,
		decentralized.Curve,
		decentralized.Rainbow,
		decentralized.Stargate,
		decentralized.Zerion,
	},
	network.Base: {
		decentralized.Aave,
		decentralized.Base,
		decentralized.Core,
		decentralized.Rainbow,
		decentralized.Stargate,
		decentralized.Zerion,
	},
	network.BinanceSmartChain: {
		decentralized.Core,
		decentralized.Rainbow,
		decentralized.Stargate,
		decentralized.Zerion,
	},
	network.Crossbell: {
		decentralized.Core,
		decentralized.Crossbell,
	},
	network.Ethereum: {
		decentralized.Aave,
		decentralized.Arbitrum,
		decentralized.Base,
		decentralized.Core,
		decentralized.Cow,
		decentralized.Curve,
		decentralized.ENS,
		decentralized.Highlight,
		decentralized.Lido,
		decentralized.Linea,
		decentralized.Looksrare,
		decentralized.Nouns,
		decentralized.Oneinch,
		decentralized.OpenSea,
		decentralized.Optimism,
		decentralized.Paraswap,
		decentralized.Rainbow,
		decentralized.RSS3,
		decentralized.Stargate,
		decentralized.Uniswap,
		decentralized.VSL,
	},
	network.Farcaster: {
		decentralized.Core,
	},
	network.Gnosis: {
		decentralized.Core,
		decentralized.Curve,
		decentralized.Zerion,
	},
	network.Linea: {
		decentralized.Core,
		decentralized.Linea,
		decentralized.Rainbow,
		decentralized.Stargate,
		decentralized.Uniswap,
		decentralized.Zerion,
	},
	network.Mastodon: {
		federated.Core,
	},
	network.Near: {
		decentralized.Core,
		decentralized.LiNEAR,
		decentralized.NearSocial,
	},
	network.Optimism: {
		decentralized.Aave,
		decentralized.Core,
		decentralized.Curve,
		decentralized.Highlight,
		decentralized.KiwiStand,
		decentralized.Matters,
		decentralized.Optimism,
		decentralized.Rainbow,
		decentralized.Stargate,
		decentralized.Zerion,
	},
	network.Polygon: {
		decentralized.Aave,
		decentralized.Aavegotchi,
		decentralized.Core,
		decentralized.Curve,
		decentralized.Highlight,
		decentralized.IQWiki,
		decentralized.Lens,
		decentralized.Polymarket,
		decentralized.Rainbow,
		decentralized.Stargate,
		decentralized.Zerion,
	},
	network.RSSHub: {
		rss.Core,
	},
	network.SatoshiVM: {
		decentralized.Core,
		decentralized.SAVM,
		decentralized.Uniswap,
	},
	network.VSL: {
		decentralized.Core,
	},
	network.XLayer: {
		decentralized.Core,
		decentralized.Zerion,
	},
}

NetworkToWorkersMap is a map of Network-has-Workers.

View Source
var WorkerToConfigMap = map[network.Protocol]map[worker.Worker]workerConfig{
	network.ActivityPubProtocol: {
		federated.Core: customWorkerConfig(federated.Core, network.ActivityPubProtocol, &Parameters{
			KafkaTopic: &ConfigDetail{
				IsRequired:  true,
				Type:        StringType,
				Value:       "activitypub_events",
				Description: activityPubKafkaTopicDescription,
				Title:       "Kafka Topic",
				Key:         "parameters.kafka_topic",
			},
		}, mastodonInstanceDescription),
	},
	network.ArweaveProtocol: {
		decentralized.Mirror:    customWorkerConfigWithoutEndpoint(decentralized.Mirror, network.ArweaveProtocol, nil, true),
		decentralized.Momoka:    customWorkerConfigWithIPFS(decentralized.Momoka, network.ArweaveProtocol, "A Polygon RPC is required for Momoka"),
		decentralized.Paragraph: customWorkerConfigWithoutEndpoint(decentralized.Paragraph, network.ArweaveProtocol, nil, false),
	},
	network.EthereumProtocol: {
		decentralized.Aave:       defaultWorkerConfig(decentralized.Aave, network.EthereumProtocol, nil),
		decentralized.Aavegotchi: defaultWorkerConfig(decentralized.Aavegotchi, network.EthereumProtocol, nil),
		decentralized.Arbitrum:   defaultWorkerConfig(decentralized.Arbitrum, network.EthereumProtocol, nil),
		decentralized.BendDAO:    defaultWorkerConfig(decentralized.BendDAO, network.EthereumProtocol, nil),
		decentralized.Base:       defaultWorkerConfig(decentralized.Base, network.EthereumProtocol, nil),
		decentralized.Core:       defaultWorkerConfig(decentralized.Core, network.EthereumProtocol, nil),
		decentralized.Cow:        defaultWorkerConfig(decentralized.Cow, network.EthereumProtocol, nil),
		decentralized.Crossbell:  customWorkerConfigWithIPFS(decentralized.Crossbell, network.EthereumProtocol, ""),
		decentralized.Curve:      defaultWorkerConfig(decentralized.Curve, network.EthereumProtocol, nil),
		decentralized.ENS:        defaultWorkerConfig(decentralized.ENS, network.EthereumProtocol, nil),
		decentralized.Highlight:  defaultWorkerConfig(decentralized.Highlight, network.EthereumProtocol, nil),
		decentralized.IQWiki:     customWorkerConfigWithIPFS(decentralized.IQWiki, network.EthereumProtocol, ""),
		decentralized.KiwiStand:  defaultWorkerConfig(decentralized.KiwiStand, network.EthereumProtocol, nil),
		decentralized.Lens:       customWorkerConfigWithIPFS(decentralized.Lens, network.EthereumProtocol, ""),
		decentralized.Lido:       defaultWorkerConfig(decentralized.Lido, network.EthereumProtocol, nil),
		decentralized.Linea:      defaultWorkerConfig(decentralized.Linea, network.EthereumProtocol, nil),
		decentralized.Looksrare:  defaultWorkerConfig(decentralized.Looksrare, network.EthereumProtocol, nil),
		decentralized.Matters:    customWorkerConfigWithIPFS(decentralized.Matters, network.EthereumProtocol, ""),
		decentralized.Nouns:      defaultWorkerConfig(decentralized.Nouns, network.EthereumProtocol, nil),
		decentralized.Oneinch:    defaultWorkerConfig(decentralized.Oneinch, network.EthereumProtocol, nil),
		decentralized.OpenSea:    defaultWorkerConfig(decentralized.OpenSea, network.EthereumProtocol, nil),
		decentralized.Optimism:   defaultWorkerConfig(decentralized.Optimism, network.EthereumProtocol, nil),
		decentralized.Paraswap:   defaultWorkerConfig(decentralized.Paraswap, network.EthereumProtocol, nil),
		decentralized.Polymarket: defaultWorkerConfig(decentralized.Polymarket, network.EthereumProtocol, nil),
		decentralized.Rainbow:    defaultWorkerConfig(decentralized.Rainbow, network.EthereumProtocol, nil),
		decentralized.RSS3:       defaultWorkerConfig(decentralized.RSS3, network.EthereumProtocol, nil),
		decentralized.SAVM:       defaultWorkerConfig(decentralized.SAVM, network.EthereumProtocol, nil),
		decentralized.Stargate:   defaultWorkerConfig(decentralized.Stargate, network.EthereumProtocol, nil),
		decentralized.Uniswap:    defaultWorkerConfig(decentralized.Uniswap, network.EthereumProtocol, nil),
		decentralized.VSL:        defaultWorkerConfig(decentralized.VSL, network.EthereumProtocol, nil),
		decentralized.Zerion:     defaultWorkerConfig(decentralized.Zerion, network.EthereumProtocol, nil),
	},
	network.FarcasterProtocol: {
		decentralized.Core: customWorkerConfig(decentralized.Core, network.FarcasterProtocol, &Parameters{
			APIKey: &ConfigDetail{
				IsRequired:  false,
				Type:        StringType,
				Description: "API key to access your Farcaster Hubble on Neynar",
				Title:       "API Key",
				Key:         "parameters.api_key",
			},
		}, "A Farcaster Hubble is required"),
	},
	network.NearProtocol: {
		decentralized.Core:       defaultWorkerConfig(decentralized.Core, network.NearProtocol, nil),
		decentralized.LiNEAR:     defaultWorkerConfig(decentralized.LiNEAR, network.NearProtocol, nil),
		decentralized.NearSocial: defaultWorkerConfig(decentralized.NearSocial, network.NearProtocol, nil),
	},
	network.RSSProtocol: {
		rss.Core: customWorkerConfig(rss.Core, network.RSSProtocol, &Parameters{
			Authentication: &Authentication{
				AccessKey: &ConfigDetail{
					IsRequired:  false,
					Type:        StringType,
					Description: "Access key to access your RSSHub",
					Title:       "Access Key",
					Key:         "parameters.authentication.access_key",
				},
			},
		}, "Your RSSHub instance URL"),
	},
}

WorkerToConfigMap is a map of worker to config.

Functions

func GetFirstStartTime added in v0.5.26

func GetFirstStartTime(ctx context.Context, redisClient rueidis.Client) (int64, error)

GetFirstStartTime Get the first start time from redis cache

func NewComponent

func NewComponent(_ context.Context, apiServer *echo.Echo, config *config.File, databaseClient database.Client, redisClient rueidis.Client, networkParamsCaller *vsl.NetworkParamsCaller) component.Component

func UpdateFirstStartTime added in v0.5.26

func UpdateFirstStartTime(ctx context.Context, redisClient rueidis.Client, timestamp int64) error

UpdateFirstStartTime updates the first start time in redis cache

Types

type Authentication added in v0.5.16

type Authentication struct {
	AccessKey *ConfigDetail `json:"access_key"`
}

type Component

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

func (*Component) CollectMetric

func (c *Component) CollectMetric(ctx context.Context, path, value string)

func (*Component) CollectTrace added in v0.5.19

func (c *Component) CollectTrace(ctx context.Context, path, value string)

func (*Component) GetActivityCount added in v0.5.1

func (c *Component) GetActivityCount(ctx echo.Context) error

GetActivityCount returns the total number of activities indexed by this Node.

func (*Component) GetNetworkConfig added in v1.1.0

func (c *Component) GetNetworkConfig(ctx echo.Context) error

GetNetworkConfig GetNetworksConfig returns the configuration for all supported networks.

func (*Component) GetNodeInfo

func (c *Component) GetNodeInfo(ctx echo.Context) error

GetNodeInfo returns the node information.

func (*Component) GetNodeOperator added in v0.5.1

func (c *Component) GetNodeOperator(ctx echo.Context) error

GetNodeOperator returns the node information.

func (*Component) GetVersion added in v0.5.8

func (c *Component) GetVersion(ctx echo.Context) error

GetVersion returns the version of the network component.

func (*Component) GetWorkersStatus added in v0.5.1

func (c *Component) GetWorkersStatus(ctx echo.Context) error

GetWorkersStatus returns the status of all workers.

func (*Component) InitMeter

func (c *Component) InitMeter() (err error)

func (*Component) Name

func (c *Component) Name() string

type ComponentInfo added in v0.5.16

type ComponentInfo struct {
	Decentralized []*WorkerInfo `json:"decentralized"`
	RSS           *WorkerInfo   `json:"rss"`
	Federated     []*WorkerInfo `json:"federated"`
}

type ConfigDetail added in v0.5.16

type ConfigDetail struct {
	IsRequired  bool                  `json:"is_required"`
	Type        ConfigDetailValueType `json:"type"`
	Value       interface{}           `json:"value"`
	Description string                `json:"description"`
	Title       string                `json:"title"`
	Key         string                `json:"key"`
}

type ConfigDetailValueType added in v0.5.16

type ConfigDetailValueType string
const (
	BooleanType   ConfigDetailValueType = "bool"
	StringType    ConfigDetailValueType = "string"
	StringMapType ConfigDetailValueType = "map[string]string"
	UintType      ConfigDetailValueType = "uint"
	URLType       ConfigDetailValueType = "url"
	URLArrayType  ConfigDetailValueType = "[]url"
)

type Endpoint added in v0.5.16

type Endpoint struct {
	URL           *ConfigDetail `json:"url"`
	HTTPHeaders   *ConfigDetail `json:"http_headers"`
	HTTP2Disabled *ConfigDetail `json:"http2_disabled"`
}

type GINodeInfoResponse added in v0.5.26

type GINodeInfoResponse struct {
	Data struct {
		LastHeartbeat int64           `json:"last_heartbeat"`
		SlashedTokens decimal.Decimal `json:"slashed_tokens"`
	} `json:"data"`
}

type GIRewardsResponse added in v0.5.26

type GIRewardsResponse struct {
	Data []struct {
		ID            uint64 `json:"id"`
		Distributions []struct {
			ID            uint64 `json:"id"`
			RewardedNodes []struct {
				EpochID          uint64          `json:"epoch_id"`
				OperationRewards decimal.Decimal `json:"operation_rewards"`
				StakingRewards   decimal.Decimal `json:"staking_rewards"`
				RequestCount     decimal.Decimal `json:"request_count"`
			} `json:"rewarded_nodes"`
		} `json:"distributions"`
	} `json:"data"`
}

type MinimumResource added in v0.5.16

type MinimumResource struct {
	CPUCore       float32 `json:"cpu_core"`
	MemoryInGb    float32 `json:"memory_in_gb"`
	DiskSpaceInGb uint    `json:"disk_space_in_gb"`
	Title         string  `json:"title"`
	Key           string  `json:"key"`
}

func (MinimumResource) Mul added in v0.5.16

func (r MinimumResource) Mul(multiplier float32) MinimumResource

Mul multiplies the resource by a given multiplier

type NetworkConfig added in v1.1.0

type NetworkConfig struct {
	RSS           NetworkConfigDetailForRSS `json:"rss,omitempty"`
	Decentralized []NetworkConfigDetail     `json:"decentralized,omitempty"`
	Federated     []NetworkConfigDetail     `json:"federated,omitempty"`
}

type NetworkConfigDetail added in v1.1.0

type NetworkConfigDetail struct {
	ID             string         `json:"id,omitempty"`
	EndpointConfig *Endpoint      `json:"endpoint_configs,omitempty"`
	WorkerConfig   []workerConfig `json:"worker_configs,omitempty"`
}

type NetworkConfigDetailForRSS added in v1.1.0

type NetworkConfigDetailForRSS struct {
	ID             string       `json:"id,omitempty"`
	EndpointConfig *Endpoint    `json:"endpoint_configs,omitempty"`
	WorkerConfig   workerConfig `json:"worker_configs,omitempty"`
}

type NetworkConfigResponse added in v1.1.0

type NetworkConfigResponse struct {
	Data NetworkConfig `json:"data"`
}

type NodeInfo added in v0.5.26

type NodeInfo struct {
	Operator   common.Address `json:"operator"`
	Version    Version        `json:"version"`
	Uptime     int64          `json:"uptime"`
	Parameters string         `json:"parameters"`
	Coverage   []string       `json:"coverage"`
	Records    Record         `json:"records"`
}

type NodeInfoResponse added in v0.5.26

type NodeInfoResponse struct {
	Data NodeInfo `json:"data"`
}

type Parameters added in v0.5.16

type Parameters struct {
	BlockStart              *ConfigDetail   `json:"block_start,omitempty"`
	BlockTarget             *ConfigDetail   `json:"block_target,omitempty"`
	ConcurrentBlockRequests *ConfigDetail   `json:"concurrent_block_requests,omitempty"`
	BlockBatchSize          *ConfigDetail   `json:"block_batch_size,omitempty"`
	ReceiptsBatchSize       *ConfigDetail   `json:"receipts_batch_size,omitempty"`
	BlockReceiptBatchSize   *ConfigDetail   `json:"block_receipts_batch_size,omitempty"`
	APIKey                  *ConfigDetail   `json:"api_key,omitempty"`
	Authentication          *Authentication `json:"authentication,omitempty"`
	TimestampStart          *ConfigDetail   `json:"timestamp_start,omitempty"`
	KafkaTopic              *ConfigDetail   `json:"kafka_topic,omitempty"`
}

type Record added in v0.5.26

type Record struct {
	LastHeartbeat  int64           `json:"last_heartbeat"`
	RecentRequests []string        `json:"recent_requests"`
	RecentRewards  []Reward        `json:"recent_rewards"`
	SlashedTokens  decimal.Decimal `json:"slashed_tokens"`
}

type Reward added in v0.5.26

type Reward struct {
	Epoch            uint64          `json:"epoch"`
	OperationRewards decimal.Decimal `json:"operation_rewards"`
	StakingRewards   decimal.Decimal `json:"staking_rewards"`
	RequestCounts    decimal.Decimal `json:"request_counts"`
}

type StatisticResponse added in v0.5.1

type StatisticResponse struct {
	Count      int64      `json:"count"`
	LastUpdate *time.Time `json:"last_update,omitempty"`
}

type Version added in v0.5.8

type Version struct {
	Tag    string `json:"tag"`
	Commit string `json:"commit"`
}

type VersionResponse added in v0.5.8

type VersionResponse struct {
	Data Version `json:"data"`
}

type WorkerInfo added in v0.5.1

type WorkerInfo struct {
	WorkerID string          `json:"worker_id"`
	Worker   worker.Worker   `json:"worker"`
	Network  network.Network `json:"network"`
	Tags     []tag.Tag       `json:"tags"`
	Platform string          `json:"platform"`
	Status   worker.Status   `json:"status"`
	monitor.WorkerProgress
}

type WorkerResponse added in v0.5.1

type WorkerResponse struct {
	Data ComponentInfo `json:"data"`
}

Jump to

Keyboard shortcuts

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