Documentation ¶
Index ¶
- type API
- type Manager
- func (m *Manager) CheckIPExist(ip string) bool
- func (m *Manager) DistributeNodeWeight(node *Node)
- func (m *Manager) GetAllCandidateNodes() ([]string, []*Node)
- func (m *Manager) GetAllEdgeNode() []*Node
- func (m *Manager) GetAllNodes() []*Node
- func (m *Manager) GetCandidateNode(nodeID string) *Node
- func (m *Manager) GetCandidateNodes(num int, filterValidators bool) []*Node
- func (m *Manager) GetEdgeNode(nodeID string) *Node
- func (m *Manager) GetNode(nodeID string) *Node
- func (m *Manager) GetNodeBePullProfitDetails(node *Node, size float64, note string) *types.ProfitDetails
- func (m *Manager) GetNodeOfIP(ip string) []string
- func (m *Manager) GetNodePullProfitDetails(node *Node, size float64, note string) *types.ProfitDetails
- func (m *Manager) GetNodeValidatableProfitDetails(node *Node, size float64) *types.ProfitDetails
- func (m *Manager) GetNodeValidatorProfitDetails(node *Node, size float64) *types.ProfitDetails
- func (m *Manager) GetOnlineNodeCount(nodeType types.NodeType) int
- func (m *Manager) GetRandomCandidates(count int) map[string]int
- func (m *Manager) GetRandomEdges(count int) map[string]int
- func (m *Manager) NodeCalculateMCx() float64
- func (m *Manager) NodeOnline(node *Node, info *types.NodeInfo) error
- func (m *Manager) RemoveNodeIP(nodeID, ip string)
- func (m *Manager) RepayNodeWeight(node *Node)
- func (m *Manager) StoreNodeIP(nodeID, ip string) bool
- func (m *Manager) UpdateNodeBandwidths(nodeID string, bandwidthDown, bandwidthUp int64)
- func (m *Manager) UpdateNodeDiskUsage(nodeID string, diskUsage float64)
- type Node
- func (n *Node) ConnectRPC(transport *quic.Transport, addr string, nodeType types.NodeType) error
- func (n *Node) DiskEnough(size float64) bool
- func (n *Node) DownloadAddr() string
- func (n *Node) GetNumberOfIPChanges() (int64, time.Time)
- func (n *Node) GetToken() string
- func (n *Node) IsAbnormal() bool
- func (n *Node) LastRequestTime() time.Time
- func (n *Node) RPCURL() string
- func (n *Node) SelectWeights() []int
- func (n *Node) SetLastRequestTime(t time.Time)
- func (n *Node) SetNumberOfIPChanges(count int64)
- func (n *Node) SetToken(t string)
- func (n *Node) TCPAddr() string
- func (n *Node) Token(cid, clientID string, titanRsa *titanrsa.Rsa, privateKey *rsa.PrivateKey) (*types.Token, *types.TokenPayload, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { // common api api.Common api.Device api.Validation api.DataSync api.Asset WaitQuiet func(ctx context.Context) error // edge api ExternalServiceAddress func(ctx context.Context, candidateURL string) (string, error) UserNATPunch func(ctx context.Context, sourceURL string, req *types.NatPunchReq) error // candidate api GetBlocksOfAsset func(ctx context.Context, assetCID string, randomSeed int64, randomCount int) ([]string, error) CheckNetworkConnectable func(ctx context.Context, network, targetURL string) (bool, error) GetMinioConfig func(ctx context.Context) (*types.MinioConfig, error) }
API represents the node API
func APIFromCandidate ¶
APIFromCandidate creates a new API from a Candidate API
func APIFromEdge ¶
APIFromEdge creates a new API from an Edge API
type Manager ¶
type Manager struct { Edges int // online edge node count Candidates int // online candidate node count *db.SQLDB *rsa.PrivateKey // scheduler privateKey dtypes.ServerID // scheduler server id TotalNetworkEdges int // Number of edge nodes in the entire network (including those on other schedulers) // contains filtered or unexported fields }
Manager is the node manager responsible for managing the online nodes
func NewManager ¶
func NewManager(sdb *db.SQLDB, serverID dtypes.ServerID, pk *rsa.PrivateKey, pb *pubsub.PubSub, config dtypes.GetSchedulerConfigFunc, ec *etcdcli.Client) *Manager
NewManager creates a new instance of the node manager
func (*Manager) CheckIPExist ¶ added in v0.1.14
func (*Manager) DistributeNodeWeight ¶ added in v0.1.11
DistributeNodeWeight Distribute Node Weight
func (*Manager) GetAllCandidateNodes ¶
GetAllCandidateNodes Get all valid candidate nodes
func (*Manager) GetAllEdgeNode ¶ added in v0.1.10
GetAllEdgeNode load all edge node
func (*Manager) GetAllNodes ¶ added in v0.1.18
GetAllNodes Get all valid candidate and edge nodes
func (*Manager) GetCandidateNode ¶
GetCandidateNode retrieves a candidate node with the given node ID
func (*Manager) GetCandidateNodes ¶
GetCandidateNodes return n candidate node
func (*Manager) GetEdgeNode ¶
GetEdgeNode retrieves an edge node with the given node ID
func (*Manager) GetNodeBePullProfitDetails ¶ added in v0.1.18
func (*Manager) GetNodeOfIP ¶ added in v0.1.15
func (*Manager) GetNodePullProfitDetails ¶ added in v0.1.18
func (*Manager) GetNodeValidatableProfitDetails ¶ added in v0.1.18
func (m *Manager) GetNodeValidatableProfitDetails(node *Node, size float64) *types.ProfitDetails
func (*Manager) GetNodeValidatorProfitDetails ¶ added in v0.1.18
func (m *Manager) GetNodeValidatorProfitDetails(node *Node, size float64) *types.ProfitDetails
func (*Manager) GetOnlineNodeCount ¶
GetOnlineNodeCount returns online node count of the given type
func (*Manager) GetRandomCandidates ¶ added in v0.1.18
GetRandomCandidates returns a random candidate node
func (*Manager) GetRandomEdges ¶ added in v0.1.18
GetRandomEdges returns a random edge node
func (*Manager) NodeCalculateMCx ¶ added in v0.1.18
NodeCalculateMCx
func (*Manager) NodeOnline ¶
NodeOnline registers a node as online
func (*Manager) RemoveNodeIP ¶ added in v0.1.13
func (*Manager) RepayNodeWeight ¶ added in v0.1.11
RepayNodeWeight Repay Node Weight
func (*Manager) StoreNodeIP ¶ added in v0.1.18
func (*Manager) UpdateNodeBandwidths ¶ added in v0.1.11
UpdateNodeBandwidths update node bandwidthDown and bandwidthUp
func (*Manager) UpdateNodeDiskUsage ¶ added in v0.1.13
type Node ¶
type Node struct { NodeID string *API jsonrpc.ClientCloser // node info PublicKey *rsa.PublicKey RemoteAddr string TCPPort int ExternalURL string NATType types.NatType CPUUsage float64 MemoryUsage float64 DiskUsage float64 TitanDiskUsage float64 Type types.NodeType PortMapping string BandwidthDown int64 BandwidthUp int64 DeactivateTime int64 IsPrivateMinioOnly bool IsStorageOnly bool ExternalIP string IncomeIncr float64 DiskSpace float64 AvailableDiskSpace float64 IsNewVersion bool // contains filtered or unexported fields }
Node represents an Edge or Candidate node
func (*Node) ConnectRPC ¶
ConnectRPC connects to the node RPC
func (*Node) DiskEnough ¶ added in v0.1.14
func (*Node) DownloadAddr ¶
DownloadAddr returns the download address of the node
func (*Node) GetNumberOfIPChanges ¶ added in v0.1.18
func (*Node) IsAbnormal ¶ added in v0.1.11
IsAbnormal is node abnormal
func (*Node) LastRequestTime ¶
LastRequestTime returns the last request time of the node
func (*Node) SelectWeights ¶ added in v0.1.10
SelectWeights get node select weights
func (*Node) SetLastRequestTime ¶
SetLastRequestTime sets the last request time of the node