Documentation
¶
Index ¶
Constants ¶
const FallbackNodeProvider = "Unknown"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// SeedURL is the URL to fetch for server updates.
SeedURL string
// SeedRefreshInterval sets how frequently to fetch SeedURL for updates.
SeedRefreshInterval time.Duration
// ChainID is the ID of the chain.
ChainID string
// EnableRemote enables/disables remote seed fetching
EnableRemote bool
// AdditionalNodes contains additional configured nodes
AdditionalNodes struct {
RPC []string
REST []string
GRPC []string
}
}
Config specifies the required configuration to configure a Seeder.
type Node ¶
type Node struct {
Address string `json:"address"`
Provider string `json:"provider"`
Status Status
}
func (Node) WithStatus ¶
type Probe ¶
Probe is the interface that wraps the Probe method.
Probe probes the given node for health. A healthy node must return a healthy status. Health is subject to the caller's interpretation of the returned Status.
type ProbeFunc ¶
ProbeFunc type is an adapter to allow the use of ordinary functions as probes. If a given function f is a function with the appropriate signature, ProbeFunc(f) is a Probe that calls f.
type Seeder ¶
type Seeder struct {
// contains filtered or unexported fields
}
Seeder represents a seeder process responsible for updating Seed listeners on new changes to the node Seed.
type Status ¶
type Status struct {
// Reachable is whether a node was able to be reached or not.
Reachable bool
// CatchingUp whether a node is still trying to keep up with the network.
CatchingUp bool
// IsLatestBlock is true when the status of the node is caught up to the latest block.
// This together with the block.BlockManager can be leveraged to confirm that the nodes are up-to-date on the latest block.
// Because the seeding process takes time, the latest block on the start of the seeding process can be a different one from
// the end of the seeding process so an absolute value of the latest block is not a good measurement of the node.
// Instead, the singleton block.BlockManager must be used and set to the latest block height and if there is a
// block.ErrBlockTooLow when setting the height, it means the node that we queried after was actually not on the latest block yet
// and is removed from the seed temporarily.
IsLatestBlock bool
// Latency ...
Latency time.Duration
}
Status represents the latest status of a node.
func GRPCProbe ¶
GRPCProbe probes a gRPC Node. It checks if the node is catching up, queries the Node status through gRPC and tries to set the latest block height globally.