info

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "info"

Variables

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

NetworkToWorkersMap is a map of Network-has-Workers.

View Source
var WorkerToConfigMap = map[network.Source]map[worker.Worker]workerConfig{
	network.EthereumSource: {
		decentralized.Aave:       defaultWorkerConfig(decentralized.Aave, network.EthereumSource, nil),
		decentralized.Aavegotchi: defaultWorkerConfig(decentralized.Aavegotchi, network.EthereumSource, nil),
		decentralized.Core:       defaultWorkerConfig(decentralized.Core, network.EthereumSource, nil),
		decentralized.Crossbell:  customWorkerConfigWithIPFS(decentralized.Crossbell, network.EthereumSource, ""),
		decentralized.Curve:      defaultWorkerConfig(decentralized.Curve, network.EthereumSource, nil),
		decentralized.ENS:        defaultWorkerConfig(decentralized.ENS, network.EthereumSource, nil),
		decentralized.Highlight:  defaultWorkerConfig(decentralized.Highlight, network.EthereumSource, nil),
		decentralized.IQWiki:     customWorkerConfigWithIPFS(decentralized.IQWiki, network.EthereumSource, ""),
		decentralized.KiwiStand:  defaultWorkerConfig(decentralized.KiwiStand, network.EthereumSource, nil),
		decentralized.Lens:       customWorkerConfigWithIPFS(decentralized.Lens, network.EthereumSource, ""),
		decentralized.Lido:       defaultWorkerConfig(decentralized.Lido, network.EthereumSource, nil),
		decentralized.Looksrare:  defaultWorkerConfig(decentralized.Looksrare, network.EthereumSource, nil),
		decentralized.Matters:    customWorkerConfigWithIPFS(decentralized.Matters, network.EthereumSource, ""),
		decentralized.OpenSea:    defaultWorkerConfig(decentralized.OpenSea, network.EthereumSource, nil),
		decentralized.Optimism:   defaultWorkerConfig(decentralized.Optimism, network.EthereumSource, nil),
		decentralized.RSS3:       defaultWorkerConfig(decentralized.RSS3, network.EthereumSource, nil),
		decentralized.SAVM:       defaultWorkerConfig(decentralized.SAVM, network.EthereumSource, nil),
		decentralized.Stargate:   defaultWorkerConfig(decentralized.Stargate, network.EthereumSource, nil),
		decentralized.Uniswap:    defaultWorkerConfig(decentralized.Uniswap, network.EthereumSource, nil),
		decentralized.VSL:        defaultWorkerConfig(decentralized.VSL, network.EthereumSource, nil),
	},
	network.ArweaveSource: {
		decentralized.Mirror:    customWorkerConfigWithoutEndpoint(decentralized.Mirror, network.ArweaveSource, nil, true),
		decentralized.Momoka:    customWorkerConfigWithIPFS(decentralized.Momoka, network.ArweaveSource, "A Polygon RPC is required for Momoka"),
		decentralized.Paragraph: customWorkerConfigWithoutEndpoint(decentralized.Paragraph, network.ArweaveSource, nil, false),
	},
	network.FarcasterSource: {
		decentralized.Core: customWorkerConfig(decentralized.Core, network.FarcasterSource, &Parameters{
			APIKey: &ConfigDetail{
				IsRequired:  false,
				Type:        StringType,
				Description: "API key to access your Farcaster Hubble on Neynar",
			},
		}, "A Farcaster Hubble is required"),
	},
	network.RSSSource: {
		rss.RSSHub: customWorkerConfig(rss.RSSHub, network.RSSSource, &Parameters{
			Authentication: &Authentication{
				AccessKey: &ConfigDetail{
					IsRequired:  false,
					Type:        StringType,
					Description: "A key to access the RSS Feed",
				},
			},
		}, ""),
	},
}

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) GetEndpointConfig added in v0.5.16

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

GetEndpointConfig returns possible configurations for an endpoint

func (*Component) GetNetworksHandler added in v0.5.16

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

GetNetworksHandler returns the list of all networks that the node can support.

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) GetWorkerConfig added in v0.5.16

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

GetWorkerConfig returns the recommended configuration for the specified worker.

func (*Component) GetWorkersByNetwork added in v0.5.16

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

GetWorkersByNetwork returns list of all workers for the specified network.

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"`
}

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 EndpointConfigResponse added in v0.5.16

type EndpointConfigResponse struct {
	Data Endpoint `json:"data"`
}

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 ListWorkerResponse added in v0.5.16

type ListWorkerResponse struct {
	Data []worker.Worker `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"`
}

func (MinimumResource) Mul added in v0.5.16

func (r MinimumResource) Mul(multiplier float32) MinimumResource

Mul multiplies the resource by a given multiplier

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"`
}

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 Request added in v0.5.16

type Request struct {
	Network string `param:"network" validate:"required"`
}

type Response added in v0.5.16

type Response struct {
	Data []string `json:"data"`
}

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 WorkerConfigResponse added in v0.5.16

type WorkerConfigResponse struct {
	Data workerConfig `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 decentralized.Platform `json:"platform"`
	Status   worker.Status          `json:"status"`
	monitor.WorkerProgress
}

type WorkerRequest added in v0.5.16

type WorkerRequest struct {
	Network string `param:"network" validate:"required"`
	Worker  string `param:"worker" validate:"required"`
}

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