scheduler

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 42 Imported by: 0

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               *sSync.DataSync
	SchedulerCfg           *config.SchedulerCfg
	SetSchedulerConfigFunc dtypes.SetSchedulerConfigFunc
	GetSchedulerConfigFunc dtypes.GetSchedulerConfigFunc
	WorkloadManager        *workload.Manager

	PrivateKey *rsa.PrivateKey
	Transport  *quic.Transport
}

Scheduler represents a scheduler node in a distributed system.

func (*Scheduler) AddAWSData added in v0.1.13

func (s *Scheduler) AddAWSData(ctx context.Context, list []types.AWSDataInfo) error

func (*Scheduler) AllocateStorage added in v0.1.10

func (s *Scheduler) AllocateStorage(ctx context.Context, userID string) (*types.UserInfo, error)

AllocateStorage allocates storage space.

func (*Scheduler) CandidateConnect

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

CandidateConnect candidate node login to the scheduler

func (*Scheduler) CheckIpUsage added in v0.1.14

func (s *Scheduler) CheckIpUsage(ctx context.Context, ip string) (bool, error)

func (*Scheduler) CreateAPIKey added in v0.1.10

func (s *Scheduler) CreateAPIKey(ctx context.Context, userID, keyName string, perms []types.UserAccessControl) (string, error)

CreateAPIKey creates a key for the client API.

func (*Scheduler) CreateAsset added in v0.1.10

func (s *Scheduler) CreateAsset(ctx context.Context, req *types.CreateAssetReq) (*types.CreateAssetRsp, error)

CreateAsset creates an asset with car CID, car name, and car size.

func (*Scheduler) CreateAssetGroup added in v0.1.11

func (s *Scheduler) CreateAssetGroup(ctx context.Context, userID, name string, parent int) (*types.AssetGroup, error)

CreateAssetGroup create file group

func (*Scheduler) DeactivateNode added in v0.1.11

func (s *Scheduler) DeactivateNode(ctx context.Context, nodeID string, hours int) error

DeactivateNode is used to deactivate a node in the titan server. It stops the node from serving any requests and marks it as inactive. - nodeID: The ID of the node to deactivate. - hours: The deactivation countdown time in hours. It specifies the duration before the deactivation is executed. If the deactivation is canceled within this period, the node will remain active.

func (*Scheduler) DeleteAPIKey added in v0.1.10

func (s *Scheduler) DeleteAPIKey(ctx context.Context, userID, name string) error

func (*Scheduler) DeleteAsset added in v0.1.10

func (s *Scheduler) DeleteAsset(ctx context.Context, userID, assetCID string) error

DeleteAsset deletes the assets of the user.

func (*Scheduler) DeleteAssetGroup added in v0.1.11

func (s *Scheduler) DeleteAssetGroup(ctx context.Context, userID string, gid int) error

DeleteAssetGroup delete asset group

func (*Scheduler) DownloadDataResult added in v0.1.13

func (s *Scheduler) DownloadDataResult(ctx context.Context, bucket, cid string, size int64) error

DownloadDataResult node download data result

func (*Scheduler) EdgeConnect

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

EdgeConnect edge node login to the scheduler

func (*Scheduler) ElectValidators added in v0.1.13

func (s *Scheduler) ElectValidators(ctx context.Context, nodeIDs []string) error

ElectValidators elect validators

func (*Scheduler) GetAPIKeys added in v0.1.10

func (s *Scheduler) GetAPIKeys(ctx context.Context, userID string) (map[string]types.UserAPIKeysInfo, error)

GetAPIKeys get all api key for user.

func (*Scheduler) GetAPPKeyPermissions added in v0.1.11

func (s *Scheduler) GetAPPKeyPermissions(ctx context.Context, userID string, keyName string) ([]string, error)

GetAPPKeyPermissions get the permission of user app key

func (*Scheduler) GetAssetCount added in v0.1.10

func (s *Scheduler) GetAssetCount(ctx context.Context) (int, error)

GetAssetCount retrieves a count of asset

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) GetAssetStatus added in v0.1.11

func (s *Scheduler) GetAssetStatus(ctx context.Context, userID, assetCID string) (*types.AssetStatus, error)

GetAssetStatus retrieves a asset status

func (*Scheduler) GetAssetView added in v0.1.14

func (s *Scheduler) GetAssetView(ctx context.Context, nodeID string, isFromNode bool) (*types.AssetView, error)

GetAssetViwe get the asset view of node

func (*Scheduler) GetAssetsForNode added in v0.1.10

func (s *Scheduler) GetAssetsForNode(ctx context.Context, nodeID string, limit, offset int) (*types.ListNodeAssetRsp, error)

GetAssetsForNode retrieves a asset list of node

func (*Scheduler) GetAssetsInBucket added in v0.1.14

func (s *Scheduler) GetAssetsInBucket(ctx context.Context, nodeID string, bucketID int, isFromNode bool) ([]string, error)

GetAssetInBucket get the assets of the bucket

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) GetCandidateIPs added in v0.1.11

func (s *Scheduler) GetCandidateIPs(ctx context.Context) ([]*types.NodeIPInfo, error)

func (*Scheduler) GetCandidateNodeIP added in v0.1.11

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

GetCandidateNodeIP get candidate ip for locator

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) GetMinioConfigFromCandidate added in v0.1.11

func (s *Scheduler) GetMinioConfigFromCandidate(ctx context.Context, nodeID string) (*types.MinioConfig, error)

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) GetNodeOfIP added in v0.1.15

func (s *Scheduler) GetNodeOfIP(ctx context.Context, ip string) ([]string, error)

func (*Scheduler) GetNodeOnlineState added in v0.1.13

func (s *Scheduler) GetNodeOnlineState(ctx context.Context) (bool, error)

func (*Scheduler) GetNodePublicKey added in v0.1.11

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

GetNodePublicKey get node publicKey

func (*Scheduler) GetNodeToken added in v0.1.13

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

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) GetReplicaEvents added in v0.1.11

func (s *Scheduler) GetReplicaEvents(ctx context.Context, start, end time.Time, limit, offset int) (*types.ListReplicaEventRsp, error)

GetReplicaEvents retrieves a replica event list

func (*Scheduler) GetReplicaEventsForNode added in v0.1.10

func (s *Scheduler) GetReplicaEventsForNode(ctx context.Context, nodeID string, limit, offset int) (*types.ListReplicaEventRsp, error)

GetReplicaEventsForNode retrieves a replica event list of node

func (*Scheduler) GetReplicas added in v0.1.11

func (s *Scheduler) GetReplicas(ctx context.Context, cid string, limit, offset int) (*types.ListReplicaRsp, error)

GetReplicas list asset replicas by CID.

func (*Scheduler) GetReplicasForNode added in v0.1.16

func (s *Scheduler) GetReplicasForNode(ctx context.Context, nodeID string, limit, offset int, statuses []types.ReplicaStatus) (*types.ListNodeReplicaRsp, error)

GetReplicasForNode retrieves a asset list of node

func (*Scheduler) GetRetrieveEventRecords added in v0.1.11

func (s *Scheduler) GetRetrieveEventRecords(ctx context.Context, nodeID string, limit, offset int) (*types.ListRetrieveEventRsp, error)

GetRetrieveEventRecords retrieves a list of retrieve events

func (*Scheduler) GetSchedulerPublicKey

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

GetSchedulerPublicKey get server publicKey

func (*Scheduler) GetUserAccessToken added in v0.1.11

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

func (*Scheduler) GetUserInfo added in v0.1.11

func (s *Scheduler) GetUserInfo(ctx context.Context, userID string) (*types.UserInfo, error)

GetUserInfo get user info

func (*Scheduler) GetUserInfos added in v0.1.11

func (s *Scheduler) GetUserInfos(ctx context.Context, userIDs []string) (map[string]*types.UserInfo, error)

GetUserInfos get user infos

func (*Scheduler) GetUserStorageStats added in v0.1.11

func (s *Scheduler) GetUserStorageStats(ctx context.Context, userID string) (*types.StorageStats, error)

GetUserStorageStats get user storage info

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, nodeID string, limit, offset int) (*types.ListValidationResultRsp, error)

GetValidationResults retrieves a list of validation results.

func (*Scheduler) GetWorkloadRecord added in v0.1.10

func (s *Scheduler) GetWorkloadRecord(ctx context.Context, tokenID string) (*types.WorkloadRecord, error)

GetWorkloadRecord retrieves workload result.

func (*Scheduler) GetWorkloadRecords added in v0.1.10

func (s *Scheduler) GetWorkloadRecords(ctx context.Context, nodeID string, limit, offset int) (*types.ListWorkloadRecordRsp, error)

GetWorkloadRecords retrieves a list of workload results.

func (*Scheduler) ListAssetGroup added in v0.1.11

func (s *Scheduler) ListAssetGroup(ctx context.Context, userID string, parent, limit int, offset int) (*types.ListAssetGroupRsp, error)

ListAssetGroup list file group

func (*Scheduler) ListAssetSummary added in v0.1.11

func (s *Scheduler) ListAssetSummary(ctx context.Context, userID string, parent, limit, offset int) (*types.ListAssetSummaryRsp, error)

ListAssetSummary list file group

func (*Scheduler) ListAssets added in v0.1.10

func (s *Scheduler) ListAssets(ctx context.Context, userID string, limit, offset, groupID int) (*types.ListAssetRecordRsp, error)

ListAssets lists the assets of the user.

func (*Scheduler) ListUserStorageStats added in v0.1.11

func (s *Scheduler) ListUserStorageStats(ctx context.Context, limit, offset int) (*types.ListStorageStatsRsp, error)

ListUserStorageStats list storage info

func (*Scheduler) LoadAWSData added in v0.1.14

func (s *Scheduler) LoadAWSData(ctx context.Context, limit, offset int, isDistribute bool) ([]*types.AWSDataInfo, error)

func (*Scheduler) MinioUploadFileEvent added in v0.1.11

func (s *Scheduler) MinioUploadFileEvent(ctx context.Context, event *types.MinioUploadFileEvent) error

func (*Scheduler) MoveAssetGroup added in v0.1.11

func (s *Scheduler) MoveAssetGroup(ctx context.Context, userID string, groupID, targetGroupID int) error

MoveAssetGroup move a asset group

func (*Scheduler) MoveAssetToGroup added in v0.1.11

func (s *Scheduler) MoveAssetToGroup(ctx context.Context, userID, cid string, groupID int) error

MoveAssetToGroup move a file to group

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) NodeKeepaliveV2 added in v0.1.11

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

NodeKeepaliveV2 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, r io.Reader, 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) RegisterEdgeNode added in v0.1.11

func (s *Scheduler) RegisterEdgeNode(ctx context.Context, nodeID, publicKey string) (*types.ActivationDetail, error)

RegisterEdgeNode register edge node, return key

func (*Scheduler) RegisterNode

func (s *Scheduler) RegisterNode(ctx context.Context, nodeID, publicKey string, nodeType types.NodeType) (*types.ActivationDetail, error)

RegisterNode register node

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) RemoveNodeFailedReplica added in v0.1.16

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

func (*Scheduler) RenameAssetGroup added in v0.1.11

func (s *Scheduler) RenameAssetGroup(ctx context.Context, userID, newName string, groupID int) error

RenameAssetGroup rename group

func (*Scheduler) RequestActivationCodes added in v0.1.10

func (s *Scheduler) RequestActivationCodes(ctx context.Context, nodeType types.NodeType, count int) ([]*types.NodeActivation, error)

RequestActivationCodes request node activation codes

func (*Scheduler) SetUserVIP added in v0.1.11

func (s *Scheduler) SetUserVIP(ctx context.Context, userID string, enableVIP bool) error

func (*Scheduler) ShareAssets added in v0.1.10

func (s *Scheduler) ShareAssets(ctx context.Context, userID string, assetCIDs []string) (map[string]string, error)

ShareAssets shares the assets of the user.

func (*Scheduler) StopAssetRecord added in v0.1.14

func (s *Scheduler) StopAssetRecord(ctx context.Context, cids []string) error

StopAssetRecord stop an asset record from the system by its CID.

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) SwitchFillDiskTimer added in v0.1.13

func (s *Scheduler) SwitchFillDiskTimer(ctx context.Context, open bool) error

func (*Scheduler) TriggerElection

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

TriggerElection triggers a single election for validators.

func (*Scheduler) UndoNodeDeactivation added in v0.1.11

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

UndoNodeDeactivation is used to undo the deactivation of a node in the titan server. It allows the previously deactivated node to start serving requests again.

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) UpdateBandwidths added in v0.1.11

func (s *Scheduler) UpdateBandwidths(ctx context.Context, bandwidthDown, bandwidthUp int64) error

UpdateBandwidths update bandwidths

func (*Scheduler) UpdateNodePort

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

UpdateNodePort sets the port for the specified node.

func (*Scheduler) UpdateShareStatus added in v0.1.11

func (s *Scheduler) UpdateShareStatus(ctx context.Context, userID, assetCID string) error

func (*Scheduler) UserAPIKeysExists added in v0.1.10

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

UserAPIKeysExists checks if the user exists.

func (*Scheduler) UserAssetDownloadResult added in v0.1.11

func (s *Scheduler) UserAssetDownloadResult(ctx context.Context, userID, cid string, totalTraffic, peakBandwidth int64) error

UserAssetDownloadResult download result

func (*Scheduler) VerifyTokenWithLimitCount added in v0.1.11

func (s *Scheduler) VerifyTokenWithLimitCount(ctx context.Context, token string) (*types.JWTPayload, error)

VerifyTokenWithLimitCount verify token in limit count

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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