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) AllocateStorage(ctx context.Context, userID string) (*types.StorageSize, error)
- func (s *Scheduler) CandidateConnect(ctx context.Context, opts *types.ConnectOptions) error
- func (s *Scheduler) CreateAPIKey(ctx context.Context, userID, keyName string) (string, error)
- func (s *Scheduler) CreateAsset(ctx context.Context, req *types.CreateAssetReq) (*types.CreateAssetRsp, error)
- func (s *Scheduler) CreateUserAsset(ctx context.Context, assetCID, assetName string, assetSize int64) (*types.CreateAssetRsp, error)
- func (s *Scheduler) DeleteAPIKey(ctx context.Context, userID, name string) error
- func (s *Scheduler) DeleteAsset(ctx context.Context, userID, assetCID string) error
- func (s *Scheduler) DeleteUserAsset(ctx context.Context, assetCID string) error
- func (s *Scheduler) EdgeConnect(ctx context.Context, opts *types.ConnectOptions) error
- func (s *Scheduler) GetAPIKeys(ctx context.Context, userID string) (map[string]string, error)
- func (s *Scheduler) GetAssetCount(ctx context.Context) (int, 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) GetAssetsForNode(ctx context.Context, nodeID string, limit, offset int) (*types.ListNodeAssetRsp, 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) GetReplicaEventsForNode(ctx context.Context, nodeID string, limit, offset int) (*types.ListReplicaEventRsp, error)
- func (s *Scheduler) GetSchedulerPublicKey(ctx context.Context) (string, error)
- func (s *Scheduler) GetStorageSize(ctx context.Context, userID string) (*types.StorageSize, error)
- func (s *Scheduler) GetValidationInfo(ctx context.Context) (*types.ValidationInfo, error)
- func (s *Scheduler) GetValidationResults(ctx context.Context, nodeID string, limit, offset int) (*types.ListValidationResultRsp, error)
- func (s *Scheduler) GetWorkloadRecord(ctx context.Context, tokenID string) (*types.WorkloadRecord, error)
- func (s *Scheduler) GetWorkloadRecords(ctx context.Context, nodeID string, limit, offset int) (*types.ListWorkloadRecordRsp, error)
- func (s *Scheduler) ListAssets(ctx context.Context, userID string, limit, offset int) ([]*types.AssetRecord, error)
- func (s *Scheduler) ListUserAssets(ctx context.Context, limit, offset int) ([]*types.AssetRecord, 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, r io.Reader, 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, nodeID, publicKey, key string) 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) RequestActivationCodes(ctx context.Context, nodeType types.NodeType, count int) ([]*types.NodeActivation, error)
- func (s *Scheduler) ShareAssets(ctx context.Context, userID string, assetCIDs []string) (map[string]string, error)
- func (s *Scheduler) ShareUserAssets(ctx context.Context, assetCID []string) (map[string]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) UserAPIKeysExists(ctx context.Context, userID string) 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
WorkloadManager *workload.Manager
PrivateKey *rsa.PrivateKey
}
Scheduler represents a scheduler node in a distributed system.
func (*Scheduler) AllocateStorage ¶ added in v0.1.10
AllocateStorage allocates storage space.
func (*Scheduler) CandidateConnect ¶
CandidateConnect candidate node login to the scheduler
func (*Scheduler) CreateAPIKey ¶ added in v0.1.10
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) CreateUserAsset ¶ added in v0.1.10
func (s *Scheduler) CreateUserAsset(ctx context.Context, assetCID, assetName string, assetSize int64) (*types.CreateAssetRsp, error)
CreateUserAsset creates an user asset with car CID, car name, and car size.
func (*Scheduler) DeleteAPIKey ¶ added in v0.1.10
func (*Scheduler) DeleteAsset ¶ added in v0.1.10
DeleteAsset deletes the assets of the user.
func (*Scheduler) DeleteUserAsset ¶ added in v0.1.10
DeleteUserAsset deletes the asset of the user.
func (*Scheduler) EdgeConnect ¶
EdgeConnect edge node login to the scheduler
func (*Scheduler) GetAPIKeys ¶ added in v0.1.10
GetAPIKeys get all api key for user.
func (*Scheduler) GetAssetCount ¶ added in v0.1.10
GetAssetCount retrieves a count of asset
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) 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) 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) 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) GetSchedulerPublicKey ¶
GetSchedulerPublicKey get server publicKey
func (*Scheduler) GetStorageSize ¶ added in v0.1.10
GetStorageSize get size of user storage
func (*Scheduler) GetValidationInfo ¶
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) ListAssets ¶ added in v0.1.10
func (s *Scheduler) ListAssets(ctx context.Context, userID string, limit, offset int) ([]*types.AssetRecord, error)
ListAssets lists the assets of the user.
func (*Scheduler) ListUserAssets ¶ added in v0.1.10
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 ¶
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 ¶
RegisterNode register node
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) 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) 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) ShareUserAssets ¶ added in v0.1.10
func (s *Scheduler) ShareUserAssets(ctx context.Context, assetCID []string) (map[string]string, error)
ShareUserAssets shares the assets of the user.
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.