moonstream/nodes/load_balancer/cmd/data.go

47 wiersze
733 B
Go

/*
Data structure.
*/
package cmd
import (
"net/http/httputil"
"net/url"
"sync"
)
type PingResponse struct {
Status string `json:"status"`
}
type NodeStatusResponse struct {
CurrentBlock uint64 `json:"current_block"`
}
// Node structure with
// StatusURL for status server at node endpoint
// GethURL for geth/bor/etc node http.server endpoint
type Node struct {
StatusURL *url.URL
GethURL *url.URL
Alive bool
CurrentBlock uint64
mux sync.RWMutex
StatusReverseProxy *httputil.ReverseProxy
GethReverseProxy *httputil.ReverseProxy
}
type NodePool struct {
Blockchain string
Nodes []*Node
// Counter to observe all nodes
Current uint64
}
type BlockchainPool struct {
Blockchains []*NodePool
}