scheduler

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 32 Imported by: 1

Documentation

Index

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

func (s *Scheduler) CandidateConnect(ctx context.Context, opts *types.ConnectOptions) error

CandidateConnect candidate node login to the scheduler

func (*Scheduler) EdgeConnect

func (s *Scheduler) EdgeConnect(ctx context.Context, opts *types.ConnectOptions) error

EdgeConnect edge node login to the scheduler

func (*Scheduler) GetAssetListForBucket

func (s *Scheduler) GetAssetListForBucket(ctx context.Context, bucketID uint32) ([]string, error)

GetAssetListForBucket retrieves a list of asset hashes for the specified node's bucket.

func (*Scheduler) GetAssetRecord

func (s *Scheduler) GetAssetRecord(ctx context.Context, cid string) (*types.AssetRecord, error)

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

func (s *Scheduler) GetAssetStatistics(ctx context.Context) (*types.AssetStatistics, error)

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 (s *Scheduler) GetCandidateURLsForDetectNat(ctx context.Context) ([]string, error)

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

func (s *Scheduler) GetExternalAddress(ctx context.Context) (string, error)

GetExternalAddress retrieves the external address of the caller.

func (*Scheduler) GetNodeInfo

func (s *Scheduler) GetNodeInfo(ctx context.Context, nodeID string) (types.NodeInfo, error)

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

func (s *Scheduler) GetOnlineNodeCount(ctx context.Context, nodeType types.NodeType) (int, error)

GetOnlineNodeCount returns the count of online nodes for a given node type

func (*Scheduler) GetSchedulerPublicKey

func (s *Scheduler) GetSchedulerPublicKey(ctx context.Context) (string, error)

GetSchedulerPublicKey get server publicKey

func (*Scheduler) GetValidationInfo

func (s *Scheduler) GetValidationInfo(ctx context.Context) (*types.ValidationInfo, error)

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) NatPunch

func (s *Scheduler) NatPunch(ctx context.Context, target *types.NatPunchReq) error

NatPunch performs NAT traversal

func (*Scheduler) NodeExists

func (s *Scheduler) NodeExists(ctx context.Context, nodeID string) error

NodeExists checks if the node with the specified ID exists.

func (*Scheduler) NodeKeepalive

func (s *Scheduler) NodeKeepalive(ctx context.Context) (uuid.UUID, error)

NodeKeepalive candidate and edge keepalive

func (*Scheduler) NodeLogin

func (s *Scheduler) NodeLogin(ctx context.Context, nodeID, sign string) (string, error)

NodeLogin creates a new JWT token for a node.

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) PullAsset

func (s *Scheduler) PullAsset(ctx context.Context, info *types.PullAssetReq) error

PullAsset pull an asset based on the provided PullAssetReq structure.

func (*Scheduler) RePullFailedAssets

func (s *Scheduler) RePullFailedAssets(ctx context.Context, hashes []types.AssetHash) error

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

func (s *Scheduler) RemoveAssetRecord(ctx context.Context, cid string) error

RemoveAssetRecord removes an asset record from the system by its CID.

func (*Scheduler) RemoveAssetReplica

func (s *Scheduler) RemoveAssetReplica(ctx context.Context, cid, nodeID string) error

RemoveAssetReplica removes an asset replica from the system by its CID and nodeID.

func (*Scheduler) SubmitNodeWorkloadReport

func (s *Scheduler) SubmitNodeWorkloadReport(ctx context.Context, r io.Reader) error

SubmitNodeWorkloadReport submits report of workload for node Asset Download

func (*Scheduler) SubmitUserWorkloadReport

func (s *Scheduler) SubmitUserWorkloadReport(ctx context.Context, r io.Reader) error

SubmitUserWorkloadReport submits report of workload for User Asset Download

func (*Scheduler) TriggerElection

func (s *Scheduler) TriggerElection(ctx context.Context) error

TriggerElection triggers a single election for validators.

func (*Scheduler) UnregisterNode

func (s *Scheduler) UnregisterNode(ctx context.Context, nodeID string) error

UnregisterNode removes a node from the scheduler with the specified node ID

func (*Scheduler) UpdateAssetExpiration

func (s *Scheduler) UpdateAssetExpiration(ctx context.Context, cid string, t time.Time) error

UpdateAssetExpiration resets the expiration time of an asset record based on the provided CID and new expiration time.

func (*Scheduler) UpdateNodePort

func (s *Scheduler) UpdateNodePort(ctx context.Context, nodeID, port string) error

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.

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL