Documentation ¶
Index ¶
- type EdgeUpdateManager
- func (eu *EdgeUpdateManager) DeleteEdgeUpdateConfig(ctx context.Context, nodeType int) error
- func (eu *EdgeUpdateManager) GetEdgeUpdateConfigs(ctx context.Context) (map[int]*api.EdgeUpdateConfig, error)
- func (eu *EdgeUpdateManager) SetEdgeUpdateConfig(ctx context.Context, info *api.EdgeUpdateConfig) error
- type Scheduler
- func (s *Scheduler) CandidateConnect(ctx context.Context, opts *types.ConnectOptions) error
- func (s *Scheduler) EdgeConnect(ctx context.Context, opts *types.ConnectOptions) error
- func (s *Scheduler) GetAssetListForBucket(ctx context.Context, bucketID uint32) ([]string, error)
- func (s *Scheduler) GetAssetRecord(ctx context.Context, cid string) (*types.AssetRecord, error)
- func (s *Scheduler) GetAssetRecords(ctx context.Context, limit, offset int, statuses []string, ...) ([]*types.AssetRecord, error)
- func (s *Scheduler) GetAssetReplicaInfos(ctx context.Context, req types.ListReplicaInfosReq) (*types.ListReplicaInfosRsp, error)
- func (s *Scheduler) GetAssetStatistics(ctx context.Context) (*types.AssetStatistics, error)
- func (s *Scheduler) GetCandidateDownloadInfos(ctx context.Context, cid string) ([]*types.CandidateDownloadInfo, error)
- func (s *Scheduler) GetCandidateURLsForDetectNat(ctx context.Context) ([]string, error)
- func (s *Scheduler) GetEdgeDownloadInfos(ctx context.Context, cid string) (*types.EdgeDownloadInfoList, error)
- func (s *Scheduler) GetEdgeExternalServiceAddress(ctx context.Context, nodeID, candidateURL string) (string, error)
- func (s *Scheduler) GetExternalAddress(ctx context.Context) (string, error)
- func (s *Scheduler) GetNodeInfo(ctx context.Context, nodeID string) (types.NodeInfo, error)
- func (s *Scheduler) GetNodeList(ctx context.Context, offset int, limit int) (*types.ListNodesRsp, error)
- func (s *Scheduler) GetOnlineNodeCount(ctx context.Context, nodeType types.NodeType) (int, error)
- func (s *Scheduler) GetSchedulerPublicKey(ctx context.Context) (string, error)
- func (s *Scheduler) GetValidationInfo(ctx context.Context) (*types.ValidationInfo, error)
- func (s *Scheduler) GetValidationResults(ctx context.Context, startTime, endTime time.Time, pageNumber, pageSize int) (*types.ListValidationResultRsp, error)
- func (s *Scheduler) NatPunch(ctx context.Context, target *types.NatPunchReq) error
- func (s *Scheduler) NodeExists(ctx context.Context, nodeID string) error
- func (s *Scheduler) NodeKeepalive(ctx context.Context) (uuid.UUID, error)
- func (s *Scheduler) NodeLogin(ctx context.Context, nodeID, sign string) (string, error)
- func (s *Scheduler) NodeRemoveAssetResult(ctx context.Context, resultInfo types.RemoveAssetResult) error
- func (s *Scheduler) NodeValidationResult(ctx context.Context, result api.ValidationResult, sign string) error
- func (s *Scheduler) PullAsset(ctx context.Context, info *types.PullAssetReq) error
- func (s *Scheduler) RePullFailedAssets(ctx context.Context, hashes []types.AssetHash) error
- func (s *Scheduler) RegisterNode(ctx context.Context, pKey string, nodeType types.NodeType) (nodeID string, err error)
- func (s *Scheduler) RemoveAssetRecord(ctx context.Context, cid string) error
- func (s *Scheduler) RemoveAssetReplica(ctx context.Context, cid, nodeID string) error
- func (s *Scheduler) SubmitNodeWorkloadReport(ctx context.Context, r io.Reader) error
- func (s *Scheduler) SubmitUserWorkloadReport(ctx context.Context, r io.Reader) error
- func (s *Scheduler) TriggerElection(ctx context.Context) error
- func (s *Scheduler) UnregisterNode(ctx context.Context, nodeID string) error
- func (s *Scheduler) UpdateAssetExpiration(ctx context.Context, cid string, t time.Time) error
- func (s *Scheduler) UpdateNodePort(ctx context.Context, nodeID, port string) error
- func (s *Scheduler) VerifyNodeAuthToken(ctx context.Context, token string) ([]auth.Permission, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EdgeUpdateManager ¶
type EdgeUpdateManager struct {
// contains filtered or unexported fields
}
EdgeUpdateManager manages information about edge node updates.
func NewEdgeUpdateManager ¶
func NewEdgeUpdateManager(db *db.SQLDB) (*EdgeUpdateManager, error)
NewEdgeUpdateManager creates a new EdgeUpdateManager with the given SQL database connection.
func (*EdgeUpdateManager) DeleteEdgeUpdateConfig ¶
func (eu *EdgeUpdateManager) DeleteEdgeUpdateConfig(ctx context.Context, nodeType int) error
DeleteEdgeUpdateConfig deletes the EdgeUpdateConfig for the given node type.
func (*EdgeUpdateManager) GetEdgeUpdateConfigs ¶
func (eu *EdgeUpdateManager) GetEdgeUpdateConfigs(ctx context.Context) (map[int]*api.EdgeUpdateConfig, error)
GetEdgeUpdateConfigs returns the map of edge node update information.
func (*EdgeUpdateManager) SetEdgeUpdateConfig ¶
func (eu *EdgeUpdateManager) SetEdgeUpdateConfig(ctx context.Context, info *api.EdgeUpdateConfig) error
SetEdgeUpdateConfig sets the EdgeUpdateConfig for the given node type.
type Scheduler ¶
type Scheduler struct { fx.In *common.CommonAPI *EdgeUpdateManager dtypes.ServerID NodeManager *node.Manager ValidationMgr *validation.Manager AssetManager *assets.Manager NatManager *nat.Manager DataSync *sync.DataSync SchedulerCfg *config.SchedulerCfg SetSchedulerConfigFunc dtypes.SetSchedulerConfigFunc GetSchedulerConfigFunc dtypes.GetSchedulerConfigFunc PrivateKey *rsa.PrivateKey }
Scheduler represents a scheduler node in a distributed system.
func (*Scheduler) CandidateConnect ¶
CandidateConnect candidate node login to the scheduler
func (*Scheduler) EdgeConnect ¶
EdgeConnect edge node login to the scheduler
func (*Scheduler) GetAssetListForBucket ¶
GetAssetListForBucket retrieves a list of asset hashes for the specified node's bucket.
func (*Scheduler) GetAssetRecord ¶
GetAssetRecord retrieves an asset record by its CID.
func (*Scheduler) GetAssetRecords ¶
func (s *Scheduler) GetAssetRecords(ctx context.Context, limit, offset int, statuses []string, serverID dtypes.ServerID) ([]*types.AssetRecord, error)
GetAssetRecords lists asset records with optional filtering by status, limit, and offset.
func (*Scheduler) GetAssetReplicaInfos ¶
func (s *Scheduler) GetAssetReplicaInfos(ctx context.Context, req types.ListReplicaInfosReq) (*types.ListReplicaInfosRsp, error)
GetAssetReplicaInfos lists asset replicas based on a given request with startTime, endTime, cursor, and count parameters.
func (*Scheduler) GetAssetStatistics ¶
GetAssetStatistics get asset related statistics information
func (*Scheduler) GetCandidateDownloadInfos ¶
func (s *Scheduler) GetCandidateDownloadInfos(ctx context.Context, cid string) ([]*types.CandidateDownloadInfo, error)
GetCandidateDownloadInfos finds candidate download info for the given CID.
func (*Scheduler) GetCandidateURLsForDetectNat ¶
func (*Scheduler) GetEdgeDownloadInfos ¶
func (s *Scheduler) GetEdgeDownloadInfos(ctx context.Context, cid string) (*types.EdgeDownloadInfoList, error)
GetEdgeDownloadInfos finds edge download information for a given CID
func (*Scheduler) GetEdgeExternalServiceAddress ¶
func (s *Scheduler) GetEdgeExternalServiceAddress(ctx context.Context, nodeID, candidateURL string) (string, error)
GetEdgeExternalServiceAddress returns the external service address of an edge node
func (*Scheduler) GetExternalAddress ¶
GetExternalAddress retrieves the external address of the caller.
func (*Scheduler) GetNodeInfo ¶
GetNodeInfo returns information about the specified node.
func (*Scheduler) GetNodeList ¶
func (s *Scheduler) GetNodeList(ctx context.Context, offset int, limit int) (*types.ListNodesRsp, error)
GetNodeList retrieves a list of nodes with pagination.
func (*Scheduler) GetOnlineNodeCount ¶
GetOnlineNodeCount returns the count of online nodes for a given node type
func (*Scheduler) GetSchedulerPublicKey ¶
GetSchedulerPublicKey get server publicKey
func (*Scheduler) GetValidationInfo ¶
GetValidationInfo get information related to validation and election
func (*Scheduler) GetValidationResults ¶
func (s *Scheduler) GetValidationResults(ctx context.Context, startTime, endTime time.Time, pageNumber, pageSize int) (*types.ListValidationResultRsp, error)
GetValidationResults retrieves a list of validation results.
func (*Scheduler) NodeExists ¶
NodeExists checks if the node with the specified ID exists.
func (*Scheduler) NodeKeepalive ¶
NodeKeepalive candidate and edge keepalive
func (*Scheduler) NodeRemoveAssetResult ¶
func (s *Scheduler) NodeRemoveAssetResult(ctx context.Context, resultInfo types.RemoveAssetResult) error
NodeRemoveAssetResult updates a node's disk usage and block count based on the resultInfo.
func (*Scheduler) NodeValidationResult ¶
func (s *Scheduler) NodeValidationResult(ctx context.Context, result api.ValidationResult, sign string) error
NodeValidationResult processes the validation result for a node
func (*Scheduler) RePullFailedAssets ¶
RePullFailedAssets retries the pull process for a list of failed assets
func (*Scheduler) RegisterNode ¶
func (s *Scheduler) RegisterNode(ctx context.Context, pKey string, nodeType types.NodeType) (nodeID string, err error)
RegisterNode adds a new node to the scheduler with the specified node ID, public key, and node type
func (*Scheduler) RemoveAssetRecord ¶
RemoveAssetRecord removes an asset record from the system by its CID.
func (*Scheduler) RemoveAssetReplica ¶
RemoveAssetReplica removes an asset replica from the system by its CID and nodeID.
func (*Scheduler) SubmitNodeWorkloadReport ¶
SubmitNodeWorkloadReport submits report of workload for node Asset Download
func (*Scheduler) SubmitUserWorkloadReport ¶
SubmitUserWorkloadReport submits report of workload for User Asset Download
func (*Scheduler) TriggerElection ¶
TriggerElection triggers a single election for validators.
func (*Scheduler) UnregisterNode ¶
UnregisterNode removes a node from the scheduler with the specified node ID
func (*Scheduler) UpdateAssetExpiration ¶
UpdateAssetExpiration resets the expiration time of an asset record based on the provided CID and new expiration time.
func (*Scheduler) UpdateNodePort ¶
UpdateNodePort sets the port for the specified node.
func (*Scheduler) VerifyNodeAuthToken ¶
func (s *Scheduler) VerifyNodeAuthToken(ctx context.Context, token string) ([]auth.Permission, error)
VerifyNodeAuthToken verifies the JWT token for a node.