Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorIsIn(err error, errorTypes []error) bool
- func GetInternalStructs(in interface{}) []interface{}
- func HasPerm(ctx context.Context, defaultPerm auth.Permission, perms auth.Permission) bool
- func PermissionedProxy(validPerms []auth.Permission, defaultPerms auth.Permission, in interface{}, ...)
- func WithPerm(ctx context.Context, perms []auth.Permission) context.Context
- type APIVersion
- type AccessPoint
- type Asset
- type AssetAPI
- type AssetAPIStruct
- func (s *AssetAPIStruct) CreateAsset(p0 context.Context, p1 *types.CreateAssetReq) (*types.CreateAssetRsp, error)
- func (s *AssetAPIStruct) CreateUserAsset(p0 context.Context, p1 string, p2 string, p3 int64) (*types.CreateAssetRsp, error)
- func (s *AssetAPIStruct) DeleteAsset(p0 context.Context, p1 string, p2 string) error
- func (s *AssetAPIStruct) DeleteUserAsset(p0 context.Context, p1 string) error
- func (s *AssetAPIStruct) GetAssetCount(p0 context.Context) (int, error)
- func (s *AssetAPIStruct) GetAssetListForBucket(p0 context.Context, p1 uint32) ([]string, error)
- func (s *AssetAPIStruct) GetAssetRecord(p0 context.Context, p1 string) (*types.AssetRecord, error)
- func (s *AssetAPIStruct) GetAssetRecords(p0 context.Context, p1 int, p2 int, p3 []string, p4 dtypes.ServerID) ([]*types.AssetRecord, error)
- func (s *AssetAPIStruct) GetAssetsForNode(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListNodeAssetRsp, error)
- func (s *AssetAPIStruct) GetReplicaEventsForNode(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListReplicaEventRsp, error)
- func (s *AssetAPIStruct) ListAssets(p0 context.Context, p1 string, p2 int, p3 int) ([]*types.AssetRecord, error)
- func (s *AssetAPIStruct) ListUserAssets(p0 context.Context, p1 int, p2 int) ([]*types.AssetRecord, error)
- func (s *AssetAPIStruct) NodeRemoveAssetResult(p0 context.Context, p1 types.RemoveAssetResult) error
- func (s *AssetAPIStruct) PullAsset(p0 context.Context, p1 *types.PullAssetReq) error
- func (s *AssetAPIStruct) RePullFailedAssets(p0 context.Context, p1 []types.AssetHash) error
- func (s *AssetAPIStruct) RemoveAssetRecord(p0 context.Context, p1 string) error
- func (s *AssetAPIStruct) RemoveAssetReplica(p0 context.Context, p1 string, p2 string) error
- func (s *AssetAPIStruct) ShareAssets(p0 context.Context, p1 string, p2 []string) (map[string]string, error)
- func (s *AssetAPIStruct) ShareUserAssets(p0 context.Context, p1 []string) (map[string]string, error)
- func (s *AssetAPIStruct) UpdateAssetExpiration(p0 context.Context, p1 string, p2 time.Time) error
- type AssetAPIStub
- func (s *AssetAPIStub) CreateAsset(p0 context.Context, p1 *types.CreateAssetReq) (*types.CreateAssetRsp, error)
- func (s *AssetAPIStub) CreateUserAsset(p0 context.Context, p1 string, p2 string, p3 int64) (*types.CreateAssetRsp, error)
- func (s *AssetAPIStub) DeleteAsset(p0 context.Context, p1 string, p2 string) error
- func (s *AssetAPIStub) DeleteUserAsset(p0 context.Context, p1 string) error
- func (s *AssetAPIStub) GetAssetCount(p0 context.Context) (int, error)
- func (s *AssetAPIStub) GetAssetListForBucket(p0 context.Context, p1 uint32) ([]string, error)
- func (s *AssetAPIStub) GetAssetRecord(p0 context.Context, p1 string) (*types.AssetRecord, error)
- func (s *AssetAPIStub) GetAssetRecords(p0 context.Context, p1 int, p2 int, p3 []string, p4 dtypes.ServerID) ([]*types.AssetRecord, error)
- func (s *AssetAPIStub) GetAssetsForNode(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListNodeAssetRsp, error)
- func (s *AssetAPIStub) GetReplicaEventsForNode(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListReplicaEventRsp, error)
- func (s *AssetAPIStub) ListAssets(p0 context.Context, p1 string, p2 int, p3 int) ([]*types.AssetRecord, error)
- func (s *AssetAPIStub) ListUserAssets(p0 context.Context, p1 int, p2 int) ([]*types.AssetRecord, error)
- func (s *AssetAPIStub) NodeRemoveAssetResult(p0 context.Context, p1 types.RemoveAssetResult) error
- func (s *AssetAPIStub) PullAsset(p0 context.Context, p1 *types.PullAssetReq) error
- func (s *AssetAPIStub) RePullFailedAssets(p0 context.Context, p1 []types.AssetHash) error
- func (s *AssetAPIStub) RemoveAssetRecord(p0 context.Context, p1 string) error
- func (s *AssetAPIStub) RemoveAssetReplica(p0 context.Context, p1 string, p2 string) error
- func (s *AssetAPIStub) ShareAssets(p0 context.Context, p1 string, p2 []string) (map[string]string, error)
- func (s *AssetAPIStub) ShareUserAssets(p0 context.Context, p1 []string) (map[string]string, error)
- func (s *AssetAPIStub) UpdateAssetExpiration(p0 context.Context, p1 string, p2 time.Time) error
- type AssetStruct
- func (s *AssetStruct) CreateAsset(p0 context.Context, p1 *types.AuthUserUploadAsset) (string, error)
- func (s *AssetStruct) DeleteAsset(p0 context.Context, p1 string) error
- func (s *AssetStruct) GetAssetProgresses(p0 context.Context, p1 []string) (*types.PullResult, error)
- func (s *AssetStruct) GetAssetStats(p0 context.Context) (*types.AssetStats, error)
- func (s *AssetStruct) GetPullingAssetInfo(p0 context.Context) (*types.InProgressAsset, error)
- func (s *AssetStruct) PullAsset(p0 context.Context, p1 string, p2 []*types.CandidateDownloadInfo) error
- type AssetStub
- func (s *AssetStub) CreateAsset(p0 context.Context, p1 *types.AuthUserUploadAsset) (string, error)
- func (s *AssetStub) DeleteAsset(p0 context.Context, p1 string) error
- func (s *AssetStub) GetAssetProgresses(p0 context.Context, p1 []string) (*types.PullResult, error)
- func (s *AssetStub) GetAssetStats(p0 context.Context) (*types.AssetStats, error)
- func (s *AssetStub) GetPullingAssetInfo(p0 context.Context) (*types.InProgressAsset, error)
- func (s *AssetStub) PullAsset(p0 context.Context, p1 string, p2 []*types.CandidateDownloadInfo) error
- type Candidate
- type CandidateStruct
- func (s *CandidateStruct) CheckNetworkConnectivity(p0 context.Context, p1 string, p2 string) error
- func (s *CandidateStruct) GetBlocksWithAssetCID(p0 context.Context, p1 string, p2 int64, p3 int) ([]string, error)
- func (s *CandidateStruct) GetExternalAddress(p0 context.Context) (string, error)
- func (s *CandidateStruct) WaitQuiet(p0 context.Context) error
- type CandidateStub
- func (s *CandidateStub) CheckNetworkConnectivity(p0 context.Context, p1 string, p2 string) error
- func (s *CandidateStub) GetBlocksWithAssetCID(p0 context.Context, p1 string, p2 int64, p3 int) ([]string, error)
- func (s *CandidateStub) GetExternalAddress(p0 context.Context) (string, error)
- func (s *CandidateStub) WaitQuiet(p0 context.Context) error
- type Common
- type CommonStruct
- func (s *CommonStruct) AuthNew(p0 context.Context, p1 *types.JWTPayload) (string, error)
- func (s *CommonStruct) AuthVerify(p0 context.Context, p1 string) (*types.JWTPayload, error)
- func (s *CommonStruct) Closing(p0 context.Context) (<-chan struct{}, error)
- func (s *CommonStruct) Discover(p0 context.Context) (types.OpenRPCDocument, error)
- func (s *CommonStruct) LogAlerts(p0 context.Context) ([]alerting.Alert, error)
- func (s *CommonStruct) LogList(p0 context.Context) ([]string, error)
- func (s *CommonStruct) LogSetLevel(p0 context.Context, p1 string, p2 string) error
- func (s *CommonStruct) Session(p0 context.Context) (uuid.UUID, error)
- func (s *CommonStruct) Shutdown(p0 context.Context) error
- func (s *CommonStruct) Version(p0 context.Context) (APIVersion, error)
- type CommonStub
- func (s *CommonStub) AuthNew(p0 context.Context, p1 *types.JWTPayload) (string, error)
- func (s *CommonStub) AuthVerify(p0 context.Context, p1 string) (*types.JWTPayload, error)
- func (s *CommonStub) Closing(p0 context.Context) (<-chan struct{}, error)
- func (s *CommonStub) Discover(p0 context.Context) (types.OpenRPCDocument, error)
- func (s *CommonStub) LogAlerts(p0 context.Context) ([]alerting.Alert, error)
- func (s *CommonStub) LogList(p0 context.Context) ([]string, error)
- func (s *CommonStub) LogSetLevel(p0 context.Context, p1 string, p2 string) error
- func (s *CommonStub) Session(p0 context.Context) (uuid.UUID, error)
- func (s *CommonStub) Shutdown(p0 context.Context) error
- func (s *CommonStub) Version(p0 context.Context) (APIVersion, error)
- type DataSync
- type DataSyncStruct
- type DataSyncStub
- type Device
- type DeviceStruct
- type DeviceStub
- type Edge
- type EdgeStruct
- type EdgeStub
- type EdgeUpdateConfig
- type ErrUnknown
- type Locator
- type LocatorStruct
- func (s *LocatorStruct) CandidateDownloadInfos(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error)
- func (s *LocatorStruct) EdgeDownloadInfos(p0 context.Context, p1 string) ([]*types.EdgeDownloadInfoList, error)
- func (s *LocatorStruct) GetAccessPoints(p0 context.Context, p1 string, p2 string) ([]string, error)
- func (s *LocatorStruct) GetUserAccessPoint(p0 context.Context, p1 string) (*AccessPoint, error)
- type LocatorStub
- func (s *LocatorStub) CandidateDownloadInfos(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error)
- func (s *LocatorStub) EdgeDownloadInfos(p0 context.Context, p1 string) ([]*types.EdgeDownloadInfoList, error)
- func (s *LocatorStub) GetAccessPoints(p0 context.Context, p1 string, p2 string) ([]string, error)
- func (s *LocatorStub) GetUserAccessPoint(p0 context.Context, p1 string) (*AccessPoint, error)
- type LogFile
- type NodeAPI
- type NodeAPIStruct
- func (s *NodeAPIStruct) CandidateConnect(p0 context.Context, p1 *types.ConnectOptions) error
- func (s *NodeAPIStruct) EdgeConnect(p0 context.Context, p1 *types.ConnectOptions) error
- func (s *NodeAPIStruct) GetCandidateDownloadInfos(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error)
- func (s *NodeAPIStruct) GetCandidateURLsForDetectNat(p0 context.Context) ([]string, error)
- func (s *NodeAPIStruct) GetEdgeDownloadInfos(p0 context.Context, p1 string) (*types.EdgeDownloadInfoList, error)
- func (s *NodeAPIStruct) GetEdgeExternalServiceAddress(p0 context.Context, p1 string, p2 string) (string, error)
- func (s *NodeAPIStruct) GetExternalAddress(p0 context.Context) (string, error)
- func (s *NodeAPIStruct) GetNodeInfo(p0 context.Context, p1 string) (types.NodeInfo, error)
- func (s *NodeAPIStruct) GetNodeList(p0 context.Context, p1 int, p2 int) (*types.ListNodesRsp, error)
- func (s *NodeAPIStruct) GetOnlineNodeCount(p0 context.Context, p1 types.NodeType) (int, error)
- func (s *NodeAPIStruct) NatPunch(p0 context.Context, p1 *types.NatPunchReq) error
- func (s *NodeAPIStruct) NodeExists(p0 context.Context, p1 string) error
- func (s *NodeAPIStruct) NodeKeepalive(p0 context.Context) (uuid.UUID, error)
- func (s *NodeAPIStruct) NodeLogin(p0 context.Context, p1 string, p2 string) (string, error)
- func (s *NodeAPIStruct) RegisterNode(p0 context.Context, p1 string, p2 string, p3 string) error
- func (s *NodeAPIStruct) RequestActivationCodes(p0 context.Context, p1 types.NodeType, p2 int) ([]*types.NodeActivation, error)
- func (s *NodeAPIStruct) UnregisterNode(p0 context.Context, p1 string) error
- func (s *NodeAPIStruct) UpdateNodePort(p0 context.Context, p1 string, p2 string) error
- type NodeAPIStub
- func (s *NodeAPIStub) CandidateConnect(p0 context.Context, p1 *types.ConnectOptions) error
- func (s *NodeAPIStub) EdgeConnect(p0 context.Context, p1 *types.ConnectOptions) error
- func (s *NodeAPIStub) GetCandidateDownloadInfos(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error)
- func (s *NodeAPIStub) GetCandidateURLsForDetectNat(p0 context.Context) ([]string, error)
- func (s *NodeAPIStub) GetEdgeDownloadInfos(p0 context.Context, p1 string) (*types.EdgeDownloadInfoList, error)
- func (s *NodeAPIStub) GetEdgeExternalServiceAddress(p0 context.Context, p1 string, p2 string) (string, error)
- func (s *NodeAPIStub) GetExternalAddress(p0 context.Context) (string, error)
- func (s *NodeAPIStub) GetNodeInfo(p0 context.Context, p1 string) (types.NodeInfo, error)
- func (s *NodeAPIStub) GetNodeList(p0 context.Context, p1 int, p2 int) (*types.ListNodesRsp, error)
- func (s *NodeAPIStub) GetOnlineNodeCount(p0 context.Context, p1 types.NodeType) (int, error)
- func (s *NodeAPIStub) NatPunch(p0 context.Context, p1 *types.NatPunchReq) error
- func (s *NodeAPIStub) NodeExists(p0 context.Context, p1 string) error
- func (s *NodeAPIStub) NodeKeepalive(p0 context.Context) (uuid.UUID, error)
- func (s *NodeAPIStub) NodeLogin(p0 context.Context, p1 string, p2 string) (string, error)
- func (s *NodeAPIStub) RegisterNode(p0 context.Context, p1 string, p2 string, p3 string) error
- func (s *NodeAPIStub) RequestActivationCodes(p0 context.Context, p1 types.NodeType, p2 int) ([]*types.NodeActivation, error)
- func (s *NodeAPIStub) UnregisterNode(p0 context.Context, p1 string) error
- func (s *NodeAPIStub) UpdateNodePort(p0 context.Context, p1 string, p2 string) error
- type Scheduler
- type SchedulerStruct
- func (s *SchedulerStruct) DeleteEdgeUpdateConfig(p0 context.Context, p1 int) error
- func (s *SchedulerStruct) GetEdgeUpdateConfigs(p0 context.Context) (map[int]*EdgeUpdateConfig, error)
- func (s *SchedulerStruct) GetSchedulerPublicKey(p0 context.Context) (string, error)
- func (s *SchedulerStruct) GetValidationInfo(p0 context.Context) (*types.ValidationInfo, error)
- func (s *SchedulerStruct) GetValidationResults(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListValidationResultRsp, error)
- func (s *SchedulerStruct) GetWorkloadRecord(p0 context.Context, p1 string) (*types.WorkloadRecord, error)
- func (s *SchedulerStruct) GetWorkloadRecords(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListWorkloadRecordRsp, error)
- func (s *SchedulerStruct) NodeValidationResult(p0 context.Context, p1 io.Reader, p2 string) error
- func (s *SchedulerStruct) SetEdgeUpdateConfig(p0 context.Context, p1 *EdgeUpdateConfig) error
- func (s *SchedulerStruct) SubmitNodeWorkloadReport(p0 context.Context, p1 io.Reader) error
- func (s *SchedulerStruct) SubmitUserWorkloadReport(p0 context.Context, p1 io.Reader) error
- func (s *SchedulerStruct) TriggerElection(p0 context.Context) error
- type SchedulerStub
- func (s *SchedulerStub) DeleteEdgeUpdateConfig(p0 context.Context, p1 int) error
- func (s *SchedulerStub) GetEdgeUpdateConfigs(p0 context.Context) (map[int]*EdgeUpdateConfig, error)
- func (s *SchedulerStub) GetSchedulerPublicKey(p0 context.Context) (string, error)
- func (s *SchedulerStub) GetValidationInfo(p0 context.Context) (*types.ValidationInfo, error)
- func (s *SchedulerStub) GetValidationResults(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListValidationResultRsp, error)
- func (s *SchedulerStub) GetWorkloadRecord(p0 context.Context, p1 string) (*types.WorkloadRecord, error)
- func (s *SchedulerStub) GetWorkloadRecords(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListWorkloadRecordRsp, error)
- func (s *SchedulerStub) NodeValidationResult(p0 context.Context, p1 io.Reader, p2 string) error
- func (s *SchedulerStub) SetEdgeUpdateConfig(p0 context.Context, p1 *EdgeUpdateConfig) error
- func (s *SchedulerStub) SubmitNodeWorkloadReport(p0 context.Context, p1 io.Reader) error
- func (s *SchedulerStub) SubmitUserWorkloadReport(p0 context.Context, p1 io.Reader) error
- func (s *SchedulerStub) TriggerElection(p0 context.Context) error
- type TCPMsgType
- type UserAPI
- type UserAPIStruct
- func (s *UserAPIStruct) AllocateStorage(p0 context.Context, p1 string) (*types.StorageSize, error)
- func (s *UserAPIStruct) CreateAPIKey(p0 context.Context, p1 string, p2 string) (string, error)
- func (s *UserAPIStruct) DeleteAPIKey(p0 context.Context, p1 string, p2 string) error
- func (s *UserAPIStruct) GetAPIKeys(p0 context.Context, p1 string) (map[string]string, error)
- func (s *UserAPIStruct) GetStorageSize(p0 context.Context, p1 string) (*types.StorageSize, error)
- func (s *UserAPIStruct) UserAPIKeysExists(p0 context.Context, p1 string) error
- type UserAPIStub
- func (s *UserAPIStub) AllocateStorage(p0 context.Context, p1 string) (*types.StorageSize, error)
- func (s *UserAPIStub) CreateAPIKey(p0 context.Context, p1 string, p2 string) (string, error)
- func (s *UserAPIStub) DeleteAPIKey(p0 context.Context, p1 string, p2 string) error
- func (s *UserAPIStub) GetAPIKeys(p0 context.Context, p1 string) (map[string]string, error)
- func (s *UserAPIStub) GetStorageSize(p0 context.Context, p1 string) (*types.StorageSize, error)
- func (s *UserAPIStub) UserAPIKeysExists(p0 context.Context, p1 string) error
- type ValidateReq
- type Validation
- type ValidationResult
- type ValidationStruct
- type ValidationStub
- type Version
Constants ¶
const ( RoleWeb auth.Permission = "web" RoleCandidate auth.Permission = "candidate" RoleEdge auth.Permission = "edge" RoleLocator auth.Permission = "locator" RoleAdmin auth.Permission = "admin" // Manage permissions RoleDefault auth.Permission = "default" RoleUser auth.Permission = "user" )
const (
EUnknown = iota + jsonrpc.FirstUserCode
)
Variables ¶
var ( SchedulerAPIVersion0 = newVer(1, 0, 0) CandidateAPIVersion0 = newVer(1, 0, 0) EdgeAPIVersion0 = newVer(1, 0, 0) LocationAPIVersion0 = newVer(1, 0, 0) )
semver versions of the rpc api exposed
var AllPermissions = []auth.Permission{RoleWeb, RoleCandidate, RoleEdge, RoleLocator, RoleAdmin, RoleDefault, RoleUser}
var ErrNotSupported = xerrors.New("method not supported")
var RPCErrors = jsonrpc.NewErrors()
Functions ¶
func GetInternalStructs ¶
func GetInternalStructs(in interface{}) []interface{}
GetInternalStructs extracts all pointers to 'Internal' sub-structs from the provided pointer to a proxy struct
func HasPerm ¶
func HasPerm(ctx context.Context, defaultPerm auth.Permission, perms auth.Permission) bool
func PermissionedProxy ¶
func PermissionedProxy(validPerms []auth.Permission, defaultPerms auth.Permission, in interface{}, out interface{})
Types ¶
type APIVersion ¶
type APIVersion struct { Version string // APIVersion is a binary encoded semver version of the remote implementing // this api // // See APIVersion in build/version.go APIVersion Version // Seconds BlockDelay uint64 }
APIVersion provides various build-time information
func (APIVersion) String ¶
func (v APIVersion) String() string
type AccessPoint ¶
AccessPoint represents an access point within an area, containing scheduler information.
type Asset ¶
type Asset interface { // PullAsset pull the asset with given assetCID from specified sources PullAsset(ctx context.Context, assetCID string, sources []*types.CandidateDownloadInfo) error //perm:admin // DeleteAsset deletes the asset with given assetCID DeleteAsset(ctx context.Context, assetCID string) error //perm:admin // GetAssetStats retrieves the statistics of assets GetAssetStats(ctx context.Context) (*types.AssetStats, error) //perm:admin // GetCachingAssetInfo retrieves the information of assets that are currently being pulled GetPullingAssetInfo(ctx context.Context) (*types.InProgressAsset, error) //perm:admin // GetAssetProgresses retrieves the progress of assets with specified assetCIDs GetAssetProgresses(ctx context.Context, assetCIDs []string) (*types.PullResult, error) //perm:admin // CreateAsset notify candidate that user upload asset, return auth token of candidate CreateAsset(ctx context.Context, tokenPayload *types.AuthUserUploadAsset) (string, error) //perm:admin }
Asset is an interface for asset manager
type AssetAPI ¶ added in v0.1.10
type AssetAPI interface { // Asset-related methods // PullAsset Pull an asset based on the provided PullAssetReq structure. PullAsset(ctx context.Context, info *types.PullAssetReq) error //perm:admin // RemoveAssetRecord removes the asset record with the specified CID from the scheduler RemoveAssetRecord(ctx context.Context, cid string) error //perm:admin // RemoveAssetReplica deletes an asset replica with the specified CID and node from the scheduler RemoveAssetReplica(ctx context.Context, cid, nodeID string) error //perm:admin // GetAssetRecord retrieves the asset record with the specified CID GetAssetRecord(ctx context.Context, cid string) (*types.AssetRecord, error) //perm:web,admin // GetAssetRecords retrieves a list of asset records with pagination using the specified limit, offset, and states GetAssetRecords(ctx context.Context, limit, offset int, states []string, serverID dtypes.ServerID) ([]*types.AssetRecord, error) //perm:web,admin // RePullFailedAssets retries the pull process for a list of failed assets RePullFailedAssets(ctx context.Context, hashes []types.AssetHash) error //perm:admin // UpdateAssetExpiration updates the expiration time for an asset with the specified CID UpdateAssetExpiration(ctx context.Context, cid string, time time.Time) error //perm:admin // NodeRemoveAssetResult the result of an asset removal operation NodeRemoveAssetResult(ctx context.Context, resultInfo types.RemoveAssetResult) error //perm:edge,candidate // GetAssetListForBucket retrieves a list of asset hashes for a bucket associated with the specified bucket ID (bucketID is hash code) GetAssetListForBucket(ctx context.Context, bucketID uint32) ([]string, error) //perm:edge,candidate // GetAssetCount retrieves a count of asset GetAssetCount(ctx context.Context) (int, error) //perm:web,admin // GetAssetsForNode retrieves a asset list of node GetAssetsForNode(ctx context.Context, nodeID string, limit, offset int) (*types.ListNodeAssetRsp, error) //perm:web,admin // GetReplicaEventsForNode retrieves a replica event list of node GetReplicaEventsForNode(ctx context.Context, nodeID string, limit, offset int) (*types.ListReplicaEventRsp, error) //perm:web,admin // CreateUserAsset creates an asset with car CID, car name, and car size. CreateUserAsset(ctx context.Context, assetCID, assetName string, assetSize int64) (*types.CreateAssetRsp, error) //perm:user // ListUserAssets lists the assets of the user. ListUserAssets(ctx context.Context, limit, offset int) ([]*types.AssetRecord, error) //perm:user // DeleteUserAsset deletes the asset of the user. DeleteUserAsset(ctx context.Context, assetCID string) error //perm:user ShareUserAssets(ctx context.Context, assetCID []string) (map[string]string, error) //perm:user // CreateAsset creates an asset with car CID, car name, and car size. CreateAsset(ctx context.Context, req *types.CreateAssetReq) (*types.CreateAssetRsp, error) //perm:web // ListAssets lists the assets of the user. ListAssets(ctx context.Context, userID string, limit, offset int) ([]*types.AssetRecord, error) //perm:web // DeleteAsset deletes the asset of the user. DeleteAsset(ctx context.Context, userID, assetCID string) error //perm:web ShareAssets(ctx context.Context, userID string, assetCID []string) (map[string]string, error) //perm:web }
AssetAPI is an interface for asset
type AssetAPIStruct ¶ added in v0.1.10
type AssetAPIStruct struct { Internal struct { CreateAsset func(p0 context.Context, p1 *types.CreateAssetReq) (*types.CreateAssetRsp, error) `perm:"web"` CreateUserAsset func(p0 context.Context, p1 string, p2 string, p3 int64) (*types.CreateAssetRsp, error) `perm:"user"` DeleteAsset func(p0 context.Context, p1 string, p2 string) error `perm:"web"` DeleteUserAsset func(p0 context.Context, p1 string) error `perm:"user"` GetAssetCount func(p0 context.Context) (int, error) `perm:"web,admin"` GetAssetListForBucket func(p0 context.Context, p1 uint32) ([]string, error) `perm:"edge,candidate"` GetAssetRecord func(p0 context.Context, p1 string) (*types.AssetRecord, error) `perm:"web,admin"` GetAssetRecords func(p0 context.Context, p1 int, p2 int, p3 []string, p4 dtypes.ServerID) ([]*types.AssetRecord, error) `perm:"web,admin"` GetAssetsForNode func(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListNodeAssetRsp, error) `perm:"web,admin"` GetReplicaEventsForNode func(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListReplicaEventRsp, error) `perm:"web,admin"` ListAssets func(p0 context.Context, p1 string, p2 int, p3 int) ([]*types.AssetRecord, error) `perm:"web"` ListUserAssets func(p0 context.Context, p1 int, p2 int) ([]*types.AssetRecord, error) `perm:"user"` NodeRemoveAssetResult func(p0 context.Context, p1 types.RemoveAssetResult) error `perm:"edge,candidate"` PullAsset func(p0 context.Context, p1 *types.PullAssetReq) error `perm:"admin"` RePullFailedAssets func(p0 context.Context, p1 []types.AssetHash) error `perm:"admin"` RemoveAssetRecord func(p0 context.Context, p1 string) error `perm:"admin"` RemoveAssetReplica func(p0 context.Context, p1 string, p2 string) error `perm:"admin"` ShareAssets func(p0 context.Context, p1 string, p2 []string) (map[string]string, error) `perm:"web"` ShareUserAssets func(p0 context.Context, p1 []string) (map[string]string, error) `perm:"user"` UpdateAssetExpiration func(p0 context.Context, p1 string, p2 time.Time) error `perm:"admin"` } }
func (*AssetAPIStruct) CreateAsset ¶ added in v0.1.10
func (s *AssetAPIStruct) CreateAsset(p0 context.Context, p1 *types.CreateAssetReq) (*types.CreateAssetRsp, error)
func (*AssetAPIStruct) CreateUserAsset ¶ added in v0.1.10
func (s *AssetAPIStruct) CreateUserAsset(p0 context.Context, p1 string, p2 string, p3 int64) (*types.CreateAssetRsp, error)
func (*AssetAPIStruct) DeleteAsset ¶ added in v0.1.10
func (*AssetAPIStruct) DeleteUserAsset ¶ added in v0.1.10
func (s *AssetAPIStruct) DeleteUserAsset(p0 context.Context, p1 string) error
func (*AssetAPIStruct) GetAssetCount ¶ added in v0.1.10
func (s *AssetAPIStruct) GetAssetCount(p0 context.Context) (int, error)
func (*AssetAPIStruct) GetAssetListForBucket ¶ added in v0.1.10
func (*AssetAPIStruct) GetAssetRecord ¶ added in v0.1.10
func (s *AssetAPIStruct) GetAssetRecord(p0 context.Context, p1 string) (*types.AssetRecord, error)
func (*AssetAPIStruct) GetAssetRecords ¶ added in v0.1.10
func (*AssetAPIStruct) GetAssetsForNode ¶ added in v0.1.10
func (s *AssetAPIStruct) GetAssetsForNode(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListNodeAssetRsp, error)
func (*AssetAPIStruct) GetReplicaEventsForNode ¶ added in v0.1.10
func (s *AssetAPIStruct) GetReplicaEventsForNode(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListReplicaEventRsp, error)
func (*AssetAPIStruct) ListAssets ¶ added in v0.1.10
func (s *AssetAPIStruct) ListAssets(p0 context.Context, p1 string, p2 int, p3 int) ([]*types.AssetRecord, error)
func (*AssetAPIStruct) ListUserAssets ¶ added in v0.1.10
func (s *AssetAPIStruct) ListUserAssets(p0 context.Context, p1 int, p2 int) ([]*types.AssetRecord, error)
func (*AssetAPIStruct) NodeRemoveAssetResult ¶ added in v0.1.10
func (s *AssetAPIStruct) NodeRemoveAssetResult(p0 context.Context, p1 types.RemoveAssetResult) error
func (*AssetAPIStruct) PullAsset ¶ added in v0.1.10
func (s *AssetAPIStruct) PullAsset(p0 context.Context, p1 *types.PullAssetReq) error
func (*AssetAPIStruct) RePullFailedAssets ¶ added in v0.1.10
func (*AssetAPIStruct) RemoveAssetRecord ¶ added in v0.1.10
func (s *AssetAPIStruct) RemoveAssetRecord(p0 context.Context, p1 string) error
func (*AssetAPIStruct) RemoveAssetReplica ¶ added in v0.1.10
func (*AssetAPIStruct) ShareAssets ¶ added in v0.1.10
func (*AssetAPIStruct) ShareUserAssets ¶ added in v0.1.10
func (*AssetAPIStruct) UpdateAssetExpiration ¶ added in v0.1.10
type AssetAPIStub ¶ added in v0.1.10
type AssetAPIStub struct { }
func (*AssetAPIStub) CreateAsset ¶ added in v0.1.10
func (s *AssetAPIStub) CreateAsset(p0 context.Context, p1 *types.CreateAssetReq) (*types.CreateAssetRsp, error)
func (*AssetAPIStub) CreateUserAsset ¶ added in v0.1.10
func (s *AssetAPIStub) CreateUserAsset(p0 context.Context, p1 string, p2 string, p3 int64) (*types.CreateAssetRsp, error)
func (*AssetAPIStub) DeleteAsset ¶ added in v0.1.10
func (*AssetAPIStub) DeleteUserAsset ¶ added in v0.1.10
func (s *AssetAPIStub) DeleteUserAsset(p0 context.Context, p1 string) error
func (*AssetAPIStub) GetAssetCount ¶ added in v0.1.10
func (s *AssetAPIStub) GetAssetCount(p0 context.Context) (int, error)
func (*AssetAPIStub) GetAssetListForBucket ¶ added in v0.1.10
func (*AssetAPIStub) GetAssetRecord ¶ added in v0.1.10
func (s *AssetAPIStub) GetAssetRecord(p0 context.Context, p1 string) (*types.AssetRecord, error)
func (*AssetAPIStub) GetAssetRecords ¶ added in v0.1.10
func (*AssetAPIStub) GetAssetsForNode ¶ added in v0.1.10
func (s *AssetAPIStub) GetAssetsForNode(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListNodeAssetRsp, error)
func (*AssetAPIStub) GetReplicaEventsForNode ¶ added in v0.1.10
func (s *AssetAPIStub) GetReplicaEventsForNode(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListReplicaEventRsp, error)
func (*AssetAPIStub) ListAssets ¶ added in v0.1.10
func (s *AssetAPIStub) ListAssets(p0 context.Context, p1 string, p2 int, p3 int) ([]*types.AssetRecord, error)
func (*AssetAPIStub) ListUserAssets ¶ added in v0.1.10
func (s *AssetAPIStub) ListUserAssets(p0 context.Context, p1 int, p2 int) ([]*types.AssetRecord, error)
func (*AssetAPIStub) NodeRemoveAssetResult ¶ added in v0.1.10
func (s *AssetAPIStub) NodeRemoveAssetResult(p0 context.Context, p1 types.RemoveAssetResult) error
func (*AssetAPIStub) PullAsset ¶ added in v0.1.10
func (s *AssetAPIStub) PullAsset(p0 context.Context, p1 *types.PullAssetReq) error
func (*AssetAPIStub) RePullFailedAssets ¶ added in v0.1.10
func (*AssetAPIStub) RemoveAssetRecord ¶ added in v0.1.10
func (s *AssetAPIStub) RemoveAssetRecord(p0 context.Context, p1 string) error
func (*AssetAPIStub) RemoveAssetReplica ¶ added in v0.1.10
func (*AssetAPIStub) ShareAssets ¶ added in v0.1.10
func (*AssetAPIStub) ShareUserAssets ¶ added in v0.1.10
func (*AssetAPIStub) UpdateAssetExpiration ¶ added in v0.1.10
type AssetStruct ¶
type AssetStruct struct { Internal struct { CreateAsset func(p0 context.Context, p1 *types.AuthUserUploadAsset) (string, error) `perm:"admin"` DeleteAsset func(p0 context.Context, p1 string) error `perm:"admin"` GetAssetProgresses func(p0 context.Context, p1 []string) (*types.PullResult, error) `perm:"admin"` GetAssetStats func(p0 context.Context) (*types.AssetStats, error) `perm:"admin"` GetPullingAssetInfo func(p0 context.Context) (*types.InProgressAsset, error) `perm:"admin"` PullAsset func(p0 context.Context, p1 string, p2 []*types.CandidateDownloadInfo) error `perm:"admin"` } }
func (*AssetStruct) CreateAsset ¶ added in v0.1.10
func (s *AssetStruct) CreateAsset(p0 context.Context, p1 *types.AuthUserUploadAsset) (string, error)
func (*AssetStruct) DeleteAsset ¶
func (s *AssetStruct) DeleteAsset(p0 context.Context, p1 string) error
func (*AssetStruct) GetAssetProgresses ¶
func (s *AssetStruct) GetAssetProgresses(p0 context.Context, p1 []string) (*types.PullResult, error)
func (*AssetStruct) GetAssetStats ¶
func (s *AssetStruct) GetAssetStats(p0 context.Context) (*types.AssetStats, error)
func (*AssetStruct) GetPullingAssetInfo ¶
func (s *AssetStruct) GetPullingAssetInfo(p0 context.Context) (*types.InProgressAsset, error)
func (*AssetStruct) PullAsset ¶
func (s *AssetStruct) PullAsset(p0 context.Context, p1 string, p2 []*types.CandidateDownloadInfo) error
type AssetStub ¶
type AssetStub struct { }
func (*AssetStub) CreateAsset ¶ added in v0.1.10
func (*AssetStub) DeleteAsset ¶
func (*AssetStub) GetAssetProgresses ¶
func (*AssetStub) GetAssetStats ¶
func (*AssetStub) GetPullingAssetInfo ¶
type Candidate ¶
type Candidate interface { Common Device Validation DataSync Asset WaitQuiet(ctx context.Context) error //perm:admin GetBlocksWithAssetCID(ctx context.Context, assetCID string, randomSeed int64, randomCount int) ([]string, error) //perm:admin // GetExternalAddress retrieves the external address of the caller. GetExternalAddress(ctx context.Context) (string, error) //perm:default CheckNetworkConnectivity(ctx context.Context, network, targetURL string) error //perm:default }
Candidate is an interface for candidate node
type CandidateStruct ¶
type CandidateStruct struct { CommonStruct DeviceStruct ValidationStruct DataSyncStruct AssetStruct Internal struct { CheckNetworkConnectivity func(p0 context.Context, p1 string, p2 string) error `perm:"default"` GetBlocksWithAssetCID func(p0 context.Context, p1 string, p2 int64, p3 int) ([]string, error) `perm:"admin"` GetExternalAddress func(p0 context.Context) (string, error) `perm:"default"` WaitQuiet func(p0 context.Context) error `perm:"admin"` } }
func (*CandidateStruct) CheckNetworkConnectivity ¶
func (*CandidateStruct) GetBlocksWithAssetCID ¶
func (*CandidateStruct) GetExternalAddress ¶
func (s *CandidateStruct) GetExternalAddress(p0 context.Context) (string, error)
type CandidateStub ¶
type CandidateStub struct { CommonStub DeviceStub ValidationStub DataSyncStub AssetStub }
func (*CandidateStub) CheckNetworkConnectivity ¶
func (*CandidateStub) GetBlocksWithAssetCID ¶
func (*CandidateStub) GetExternalAddress ¶
func (s *CandidateStub) GetExternalAddress(p0 context.Context) (string, error)
type Common ¶
type Common interface { // AuthVerify checks whether the specified token is valid and returns the list of permissions associated with it. AuthVerify(ctx context.Context, token string) (*types.JWTPayload, error) //perm:default // AuthNew creates a new token with the specified list of permissions. AuthNew(ctx context.Context, payload *types.JWTPayload) (string, error) //perm:admin // LogList returns a list of all logs in the system. LogList(context.Context) ([]string, error) //perm:admin // LogSetLevel sets the log level of the specified logger. LogSetLevel(context.Context, string, string) error //perm:admin // LogAlerts returns list of all, active and inactive alerts tracked by the LogAlerts(ctx context.Context) ([]alerting.Alert, error) //perm:admin // Version provides information about API provider Version(context.Context) (APIVersion, error) //perm:default // Discover returns an OpenRPC document describing an RPC API. Discover(ctx context.Context) (types.OpenRPCDocument, error) //perm:admin // Shutdown trigger graceful shutdown Shutdown(context.Context) error //perm:admin // Session returns a UUID of api provider session Session(ctx context.Context) (uuid.UUID, error) //perm:edge,candidate // Closing jsonrpc closing Closing(context.Context) (<-chan struct{}, error) //perm:admin }
Common is an interface for titan network
type CommonStruct ¶
type CommonStruct struct { Internal struct { AuthNew func(p0 context.Context, p1 *types.JWTPayload) (string, error) `perm:"admin"` AuthVerify func(p0 context.Context, p1 string) (*types.JWTPayload, error) `perm:"default"` Closing func(p0 context.Context) (<-chan struct{}, error) `perm:"admin"` Discover func(p0 context.Context) (types.OpenRPCDocument, error) `perm:"admin"` LogAlerts func(p0 context.Context) ([]alerting.Alert, error) `perm:"admin"` LogList func(p0 context.Context) ([]string, error) `perm:"admin"` LogSetLevel func(p0 context.Context, p1 string, p2 string) error `perm:"admin"` Session func(p0 context.Context) (uuid.UUID, error) `perm:"edge,candidate"` Shutdown func(p0 context.Context) error `perm:"admin"` Version func(p0 context.Context) (APIVersion, error) `perm:"default"` } }
func (*CommonStruct) AuthNew ¶
func (s *CommonStruct) AuthNew(p0 context.Context, p1 *types.JWTPayload) (string, error)
func (*CommonStruct) AuthVerify ¶
func (s *CommonStruct) AuthVerify(p0 context.Context, p1 string) (*types.JWTPayload, error)
func (*CommonStruct) Closing ¶
func (s *CommonStruct) Closing(p0 context.Context) (<-chan struct{}, error)
func (*CommonStruct) Discover ¶
func (s *CommonStruct) Discover(p0 context.Context) (types.OpenRPCDocument, error)
func (*CommonStruct) LogSetLevel ¶
func (*CommonStruct) Version ¶
func (s *CommonStruct) Version(p0 context.Context) (APIVersion, error)
type CommonStub ¶
type CommonStub struct { }
func (*CommonStub) AuthNew ¶
func (s *CommonStub) AuthNew(p0 context.Context, p1 *types.JWTPayload) (string, error)
func (*CommonStub) AuthVerify ¶
func (s *CommonStub) AuthVerify(p0 context.Context, p1 string) (*types.JWTPayload, error)
func (*CommonStub) Closing ¶
func (s *CommonStub) Closing(p0 context.Context) (<-chan struct{}, error)
func (*CommonStub) Discover ¶
func (s *CommonStub) Discover(p0 context.Context) (types.OpenRPCDocument, error)
func (*CommonStub) LogSetLevel ¶
func (*CommonStub) Version ¶
func (s *CommonStub) Version(p0 context.Context) (APIVersion, error)
type DataSync ¶
type DataSync interface { // CompareTopHash check asset if same as scheduler. // topHash is hash of all buckets CompareTopHash(ctx context.Context, topHash string) (bool, error) //perm:admin // CompareBucketHashes group asset in bucket, and compare single bucket hash // hashes are map of bucket, key is number of bucket, value is hash // return mismatch bucket number CompareBucketHashes(ctx context.Context, hashes map[uint32]string) ([]uint32, error) //perm:admin }
DataSync sync scheduler asset to node
type DataSyncStruct ¶
type DataSyncStruct struct { Internal struct { CompareBucketHashes func(p0 context.Context, p1 map[uint32]string) ([]uint32, error) `perm:"admin"` CompareTopHash func(p0 context.Context, p1 string) (bool, error) `perm:"admin"` } }
func (*DataSyncStruct) CompareBucketHashes ¶
func (*DataSyncStruct) CompareTopHash ¶
type DataSyncStub ¶
type DataSyncStub struct { }
func (*DataSyncStub) CompareBucketHashes ¶
func (*DataSyncStub) CompareTopHash ¶
type Device ¶
type Device interface { GetNodeInfo(ctx context.Context) (types.NodeInfo, error) //perm:admin GetNodeID(ctx context.Context) (string, error) //perm:admin }
Device is an interface for node
type DeviceStruct ¶
type DeviceStruct struct { Internal struct { GetNodeID func(p0 context.Context) (string, error) `perm:"admin"` GetNodeInfo func(p0 context.Context) (types.NodeInfo, error) `perm:"admin"` } }
func (*DeviceStruct) GetNodeID ¶
func (s *DeviceStruct) GetNodeID(p0 context.Context) (string, error)
func (*DeviceStruct) GetNodeInfo ¶
type Edge ¶
type Edge interface { Common Device Validation DataSync Asset WaitQuiet(ctx context.Context) error //perm:admin // ExternalServiceAddress check service address with different candidate // if behind nat, service address maybe different ExternalServiceAddress(ctx context.Context, candidateURL string) (string, error) //perm:admin // UserNATTravel build connection for user UserNATPunch(ctx context.Context, userServiceAddress string, req *types.NatPunchReq) error //perm:admin }
Edge is an interface for edge node
func PermissionedEdgeAPI ¶
type EdgeStruct ¶
type EdgeStruct struct { CommonStruct DeviceStruct ValidationStruct DataSyncStruct AssetStruct Internal struct { ExternalServiceAddress func(p0 context.Context, p1 string) (string, error) `perm:"admin"` UserNATPunch func(p0 context.Context, p1 string, p2 *types.NatPunchReq) error `perm:"admin"` WaitQuiet func(p0 context.Context) error `perm:"admin"` } }
func (*EdgeStruct) ExternalServiceAddress ¶
func (*EdgeStruct) UserNATPunch ¶
func (s *EdgeStruct) UserNATPunch(p0 context.Context, p1 string, p2 *types.NatPunchReq) error
type EdgeStub ¶
type EdgeStub struct { CommonStub DeviceStub ValidationStub DataSyncStub AssetStub }
func (*EdgeStub) ExternalServiceAddress ¶
func (*EdgeStub) UserNATPunch ¶
type EdgeUpdateConfig ¶
type EdgeUpdateConfig struct { NodeType int `db:"node_type"` AppName string `db:"app_name"` Version Version `db:"version"` DownloadURL string `db:"download_url"` Hash string `db:"hash"` UpdateTime time.Time `db:"update_time"` }
EdgeUpdateInfo just update edge node NodeType include edge-updater and titan-edge
type ErrUnknown ¶
type ErrUnknown struct{}
func (*ErrUnknown) Error ¶
func (e *ErrUnknown) Error() string
type Locator ¶
type Locator interface { Common // GetAccessPoints retrieves all access points associated with a node. GetAccessPoints(ctx context.Context, nodeID, areaID string) ([]string, error) //perm:default // user api // EdgeDownloadInfos retrieves download information for a content identifier (CID). EdgeDownloadInfos(ctx context.Context, cid string) ([]*types.EdgeDownloadInfoList, error) //perm:default // GetUserAccessPoint retrieves an access point for a user with a specified IP address. GetUserAccessPoint(ctx context.Context, userIP string) (*AccessPoint, error) //perm:default CandidateDownloadInfos(ctx context.Context, cid string) ([]*types.CandidateDownloadInfo, error) //perm:default }
Locator is an interface for locator services
func PermissionedLocationAPI ¶
type LocatorStruct ¶
type LocatorStruct struct { CommonStruct Internal struct { CandidateDownloadInfos func(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error) `perm:"default"` EdgeDownloadInfos func(p0 context.Context, p1 string) ([]*types.EdgeDownloadInfoList, error) `perm:"default"` GetAccessPoints func(p0 context.Context, p1 string, p2 string) ([]string, error) `perm:"default"` GetUserAccessPoint func(p0 context.Context, p1 string) (*AccessPoint, error) `perm:"default"` } }
func (*LocatorStruct) CandidateDownloadInfos ¶ added in v0.1.10
func (s *LocatorStruct) CandidateDownloadInfos(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error)
func (*LocatorStruct) EdgeDownloadInfos ¶
func (s *LocatorStruct) EdgeDownloadInfos(p0 context.Context, p1 string) ([]*types.EdgeDownloadInfoList, error)
func (*LocatorStruct) GetAccessPoints ¶
func (*LocatorStruct) GetUserAccessPoint ¶
func (s *LocatorStruct) GetUserAccessPoint(p0 context.Context, p1 string) (*AccessPoint, error)
type LocatorStub ¶
type LocatorStub struct {
CommonStub
}
func (*LocatorStub) CandidateDownloadInfos ¶ added in v0.1.10
func (s *LocatorStub) CandidateDownloadInfos(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error)
func (*LocatorStub) EdgeDownloadInfos ¶
func (s *LocatorStub) EdgeDownloadInfos(p0 context.Context, p1 string) ([]*types.EdgeDownloadInfoList, error)
func (*LocatorStub) GetAccessPoints ¶
func (*LocatorStub) GetUserAccessPoint ¶
func (s *LocatorStub) GetUserAccessPoint(p0 context.Context, p1 string) (*AccessPoint, error)
type NodeAPI ¶ added in v0.1.10
type NodeAPI interface { // Node-related methods // GetOnlineNodeCount returns the count of online nodes for a given node type GetOnlineNodeCount(ctx context.Context, nodeType types.NodeType) (int, error) //perm:web,admin // RegisterNode adds new node to the scheduler RegisterNode(ctx context.Context, nodeID, publicKey, key string) error //perm:default // UnregisterNode removes a node from the scheduler with the specified node ID UnregisterNode(ctx context.Context, nodeID string) error //perm:web,admin // UpdateNodePort updates the port for the node with the specified node UpdateNodePort(ctx context.Context, nodeID, port string) error //perm:web,admin // EdgeConnect edge node login to the scheduler EdgeConnect(ctx context.Context, opts *types.ConnectOptions) error //perm:edge // CandidateConnect candidate node login to the scheduler CandidateConnect(ctx context.Context, opts *types.ConnectOptions) error //perm:candidate // GetExternalAddress retrieves the external address of the caller. GetExternalAddress(ctx context.Context) (string, error) //perm:default // NodeLogin generates an authentication token for a node with the specified node ID and signature NodeLogin(ctx context.Context, nodeID, sign string) (string, error) //perm:default // GetNodeInfo get information for node GetNodeInfo(ctx context.Context, nodeID string) (types.NodeInfo, error) //perm:web,admin // GetNodeList retrieves a list of nodes with pagination using the specified cursor and count GetNodeList(ctx context.Context, cursor int, count int) (*types.ListNodesRsp, error) //perm:web,admin // GetCandidateURLsForDetectNat Get the rpc url of the specified number of candidate nodes GetCandidateURLsForDetectNat(ctx context.Context) ([]string, error) //perm:default // GetEdgeExternalServiceAddress nat travel, get edge external addr with different candidate GetEdgeExternalServiceAddress(ctx context.Context, nodeID, candidateURL string) (string, error) //perm:admin // NatPunch nat punch between user and node NatPunch(ctx context.Context, target *types.NatPunchReq) error //perm:default // GetEdgeDownloadInfos retrieves download information for the edge with the asset with the specified CID. GetEdgeDownloadInfos(ctx context.Context, cid string) (*types.EdgeDownloadInfoList, error) //perm:default // GetCandidateDownloadInfos retrieves download information for the candidate with the asset with the specified CID. GetCandidateDownloadInfos(ctx context.Context, cid string) ([]*types.CandidateDownloadInfo, error) //perm:edge,candidate,web,locator // NodeExists checks if the node with the specified ID exists. NodeExists(ctx context.Context, nodeID string) error //perm:web // NodeKeepalive NodeKeepalive(ctx context.Context) (uuid.UUID, error) //perm:edge,candidate // RequestActivationCodes Get the device's encrypted activation code RequestActivationCodes(ctx context.Context, nodeType types.NodeType, count int) ([]*types.NodeActivation, error) //perm:web,admin }
NodeAPI is an interface for node
type NodeAPIStruct ¶ added in v0.1.10
type NodeAPIStruct struct { Internal struct { CandidateConnect func(p0 context.Context, p1 *types.ConnectOptions) error `perm:"candidate"` EdgeConnect func(p0 context.Context, p1 *types.ConnectOptions) error `perm:"edge"` GetCandidateDownloadInfos func(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error) `perm:"edge,candidate,web,locator"` GetCandidateURLsForDetectNat func(p0 context.Context) ([]string, error) `perm:"default"` GetEdgeDownloadInfos func(p0 context.Context, p1 string) (*types.EdgeDownloadInfoList, error) `perm:"default"` GetEdgeExternalServiceAddress func(p0 context.Context, p1 string, p2 string) (string, error) `perm:"admin"` GetExternalAddress func(p0 context.Context) (string, error) `perm:"default"` GetNodeInfo func(p0 context.Context, p1 string) (types.NodeInfo, error) `perm:"web,admin"` GetNodeList func(p0 context.Context, p1 int, p2 int) (*types.ListNodesRsp, error) `perm:"web,admin"` GetOnlineNodeCount func(p0 context.Context, p1 types.NodeType) (int, error) `perm:"web,admin"` NatPunch func(p0 context.Context, p1 *types.NatPunchReq) error `perm:"default"` NodeExists func(p0 context.Context, p1 string) error `perm:"web"` NodeKeepalive func(p0 context.Context) (uuid.UUID, error) `perm:"edge,candidate"` NodeLogin func(p0 context.Context, p1 string, p2 string) (string, error) `perm:"default"` RegisterNode func(p0 context.Context, p1 string, p2 string, p3 string) error `perm:"default"` RequestActivationCodes func(p0 context.Context, p1 types.NodeType, p2 int) ([]*types.NodeActivation, error) `perm:"web,admin"` UnregisterNode func(p0 context.Context, p1 string) error `perm:"web,admin"` UpdateNodePort func(p0 context.Context, p1 string, p2 string) error `perm:"web,admin"` } }
func (*NodeAPIStruct) CandidateConnect ¶ added in v0.1.10
func (s *NodeAPIStruct) CandidateConnect(p0 context.Context, p1 *types.ConnectOptions) error
func (*NodeAPIStruct) EdgeConnect ¶ added in v0.1.10
func (s *NodeAPIStruct) EdgeConnect(p0 context.Context, p1 *types.ConnectOptions) error
func (*NodeAPIStruct) GetCandidateDownloadInfos ¶ added in v0.1.10
func (s *NodeAPIStruct) GetCandidateDownloadInfos(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error)
func (*NodeAPIStruct) GetCandidateURLsForDetectNat ¶ added in v0.1.10
func (s *NodeAPIStruct) GetCandidateURLsForDetectNat(p0 context.Context) ([]string, error)
func (*NodeAPIStruct) GetEdgeDownloadInfos ¶ added in v0.1.10
func (s *NodeAPIStruct) GetEdgeDownloadInfos(p0 context.Context, p1 string) (*types.EdgeDownloadInfoList, error)
func (*NodeAPIStruct) GetEdgeExternalServiceAddress ¶ added in v0.1.10
func (*NodeAPIStruct) GetExternalAddress ¶ added in v0.1.10
func (s *NodeAPIStruct) GetExternalAddress(p0 context.Context) (string, error)
func (*NodeAPIStruct) GetNodeInfo ¶ added in v0.1.10
func (*NodeAPIStruct) GetNodeList ¶ added in v0.1.10
func (s *NodeAPIStruct) GetNodeList(p0 context.Context, p1 int, p2 int) (*types.ListNodesRsp, error)
func (*NodeAPIStruct) GetOnlineNodeCount ¶ added in v0.1.10
func (*NodeAPIStruct) NatPunch ¶ added in v0.1.10
func (s *NodeAPIStruct) NatPunch(p0 context.Context, p1 *types.NatPunchReq) error
func (*NodeAPIStruct) NodeExists ¶ added in v0.1.10
func (s *NodeAPIStruct) NodeExists(p0 context.Context, p1 string) error
func (*NodeAPIStruct) NodeKeepalive ¶ added in v0.1.10
func (*NodeAPIStruct) RegisterNode ¶ added in v0.1.10
func (*NodeAPIStruct) RequestActivationCodes ¶ added in v0.1.10
func (s *NodeAPIStruct) RequestActivationCodes(p0 context.Context, p1 types.NodeType, p2 int) ([]*types.NodeActivation, error)
func (*NodeAPIStruct) UnregisterNode ¶ added in v0.1.10
func (s *NodeAPIStruct) UnregisterNode(p0 context.Context, p1 string) error
func (*NodeAPIStruct) UpdateNodePort ¶ added in v0.1.10
type NodeAPIStub ¶ added in v0.1.10
type NodeAPIStub struct { }
func (*NodeAPIStub) CandidateConnect ¶ added in v0.1.10
func (s *NodeAPIStub) CandidateConnect(p0 context.Context, p1 *types.ConnectOptions) error
func (*NodeAPIStub) EdgeConnect ¶ added in v0.1.10
func (s *NodeAPIStub) EdgeConnect(p0 context.Context, p1 *types.ConnectOptions) error
func (*NodeAPIStub) GetCandidateDownloadInfos ¶ added in v0.1.10
func (s *NodeAPIStub) GetCandidateDownloadInfos(p0 context.Context, p1 string) ([]*types.CandidateDownloadInfo, error)
func (*NodeAPIStub) GetCandidateURLsForDetectNat ¶ added in v0.1.10
func (s *NodeAPIStub) GetCandidateURLsForDetectNat(p0 context.Context) ([]string, error)
func (*NodeAPIStub) GetEdgeDownloadInfos ¶ added in v0.1.10
func (s *NodeAPIStub) GetEdgeDownloadInfos(p0 context.Context, p1 string) (*types.EdgeDownloadInfoList, error)
func (*NodeAPIStub) GetEdgeExternalServiceAddress ¶ added in v0.1.10
func (*NodeAPIStub) GetExternalAddress ¶ added in v0.1.10
func (s *NodeAPIStub) GetExternalAddress(p0 context.Context) (string, error)
func (*NodeAPIStub) GetNodeInfo ¶ added in v0.1.10
func (*NodeAPIStub) GetNodeList ¶ added in v0.1.10
func (s *NodeAPIStub) GetNodeList(p0 context.Context, p1 int, p2 int) (*types.ListNodesRsp, error)
func (*NodeAPIStub) GetOnlineNodeCount ¶ added in v0.1.10
func (*NodeAPIStub) NatPunch ¶ added in v0.1.10
func (s *NodeAPIStub) NatPunch(p0 context.Context, p1 *types.NatPunchReq) error
func (*NodeAPIStub) NodeExists ¶ added in v0.1.10
func (s *NodeAPIStub) NodeExists(p0 context.Context, p1 string) error
func (*NodeAPIStub) NodeKeepalive ¶ added in v0.1.10
func (*NodeAPIStub) RegisterNode ¶ added in v0.1.10
func (*NodeAPIStub) RequestActivationCodes ¶ added in v0.1.10
func (s *NodeAPIStub) RequestActivationCodes(p0 context.Context, p1 types.NodeType, p2 int) ([]*types.NodeActivation, error)
func (*NodeAPIStub) UnregisterNode ¶ added in v0.1.10
func (s *NodeAPIStub) UnregisterNode(p0 context.Context, p1 string) error
func (*NodeAPIStub) UpdateNodePort ¶ added in v0.1.10
type Scheduler ¶
type Scheduler interface { Common AssetAPI NodeAPI UserAPI // NodeValidationResult processes the validation result for a node NodeValidationResult(ctx context.Context, r io.Reader, sign string) error //perm:candidate // GetValidationResults retrieves a list of validation results with pagination using the specified node, page number, and page size GetValidationResults(ctx context.Context, nodeID string, limit, offset int) (*types.ListValidationResultRsp, error) //perm:web,admin // SubmitUserWorkloadReport submits report of workload for User Download asset // r is buffer of []*types.WorkloadReport encode by gob SubmitUserWorkloadReport(ctx context.Context, r io.Reader) error //perm:default // SubmitNodeWorkloadReport submits report of workload for node provide Asset Download // r is buffer of types.NodeWorkloadReport encode by gob SubmitNodeWorkloadReport(ctx context.Context, r io.Reader) error //perm:edge,candidate // GetWorkloadRecords retrieves a list of workload results with pagination using the specified limit, offset, and node GetWorkloadRecords(ctx context.Context, nodeID string, limit, offset int) (*types.ListWorkloadRecordRsp, error) //perm:web,admin // GetWorkloadRecord retrieves result with tokenID GetWorkloadRecord(ctx context.Context, tokenID string) (*types.WorkloadRecord, error) //perm:web,admin // Server-related methods // GetSchedulerPublicKey retrieves the scheduler's public key in PEM format GetSchedulerPublicKey(ctx context.Context) (string, error) //perm:edge,candidate // TriggerElection starts a new election process TriggerElection(ctx context.Context) error //perm:admin // GetEdgeUpdateConfigs retrieves edge update configurations for different node types GetEdgeUpdateConfigs(ctx context.Context) (map[int]*EdgeUpdateConfig, error) //perm:edge // SetEdgeUpdateConfig updates the edge update configuration for a specific node type with the provided information SetEdgeUpdateConfig(ctx context.Context, info *EdgeUpdateConfig) error //perm:admin // DeleteEdgeUpdateConfig deletes the edge update configuration for the specified node type DeleteEdgeUpdateConfig(ctx context.Context, nodeType int) error //perm:admin // GetValidationInfo get information related to validation and election GetValidationInfo(ctx context.Context) (*types.ValidationInfo, error) //perm:web,admin }
Scheduler is an interface for scheduler
type SchedulerStruct ¶
type SchedulerStruct struct { CommonStruct AssetAPIStruct NodeAPIStruct UserAPIStruct Internal struct { DeleteEdgeUpdateConfig func(p0 context.Context, p1 int) error `perm:"admin"` GetEdgeUpdateConfigs func(p0 context.Context) (map[int]*EdgeUpdateConfig, error) `perm:"edge"` GetSchedulerPublicKey func(p0 context.Context) (string, error) `perm:"edge,candidate"` GetValidationInfo func(p0 context.Context) (*types.ValidationInfo, error) `perm:"web,admin"` GetValidationResults func(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListValidationResultRsp, error) `perm:"web,admin"` GetWorkloadRecord func(p0 context.Context, p1 string) (*types.WorkloadRecord, error) `perm:"web,admin"` GetWorkloadRecords func(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListWorkloadRecordRsp, error) `perm:"web,admin"` NodeValidationResult func(p0 context.Context, p1 io.Reader, p2 string) error `perm:"candidate"` SetEdgeUpdateConfig func(p0 context.Context, p1 *EdgeUpdateConfig) error `perm:"admin"` SubmitNodeWorkloadReport func(p0 context.Context, p1 io.Reader) error `perm:"edge,candidate"` SubmitUserWorkloadReport func(p0 context.Context, p1 io.Reader) error `perm:"default"` TriggerElection func(p0 context.Context) error `perm:"admin"` } }
func (*SchedulerStruct) DeleteEdgeUpdateConfig ¶
func (s *SchedulerStruct) DeleteEdgeUpdateConfig(p0 context.Context, p1 int) error
func (*SchedulerStruct) GetEdgeUpdateConfigs ¶
func (s *SchedulerStruct) GetEdgeUpdateConfigs(p0 context.Context) (map[int]*EdgeUpdateConfig, error)
func (*SchedulerStruct) GetSchedulerPublicKey ¶
func (s *SchedulerStruct) GetSchedulerPublicKey(p0 context.Context) (string, error)
func (*SchedulerStruct) GetValidationInfo ¶
func (s *SchedulerStruct) GetValidationInfo(p0 context.Context) (*types.ValidationInfo, error)
func (*SchedulerStruct) GetValidationResults ¶
func (s *SchedulerStruct) GetValidationResults(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListValidationResultRsp, error)
func (*SchedulerStruct) GetWorkloadRecord ¶ added in v0.1.10
func (s *SchedulerStruct) GetWorkloadRecord(p0 context.Context, p1 string) (*types.WorkloadRecord, error)
func (*SchedulerStruct) GetWorkloadRecords ¶ added in v0.1.10
func (s *SchedulerStruct) GetWorkloadRecords(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListWorkloadRecordRsp, error)
func (*SchedulerStruct) NodeValidationResult ¶
func (*SchedulerStruct) SetEdgeUpdateConfig ¶
func (s *SchedulerStruct) SetEdgeUpdateConfig(p0 context.Context, p1 *EdgeUpdateConfig) error
func (*SchedulerStruct) SubmitNodeWorkloadReport ¶
func (*SchedulerStruct) SubmitUserWorkloadReport ¶
func (*SchedulerStruct) TriggerElection ¶
func (s *SchedulerStruct) TriggerElection(p0 context.Context) error
type SchedulerStub ¶
type SchedulerStub struct { CommonStub AssetAPIStub NodeAPIStub UserAPIStub }
func (*SchedulerStub) DeleteEdgeUpdateConfig ¶
func (s *SchedulerStub) DeleteEdgeUpdateConfig(p0 context.Context, p1 int) error
func (*SchedulerStub) GetEdgeUpdateConfigs ¶
func (s *SchedulerStub) GetEdgeUpdateConfigs(p0 context.Context) (map[int]*EdgeUpdateConfig, error)
func (*SchedulerStub) GetSchedulerPublicKey ¶
func (s *SchedulerStub) GetSchedulerPublicKey(p0 context.Context) (string, error)
func (*SchedulerStub) GetValidationInfo ¶
func (s *SchedulerStub) GetValidationInfo(p0 context.Context) (*types.ValidationInfo, error)
func (*SchedulerStub) GetValidationResults ¶
func (s *SchedulerStub) GetValidationResults(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListValidationResultRsp, error)
func (*SchedulerStub) GetWorkloadRecord ¶ added in v0.1.10
func (s *SchedulerStub) GetWorkloadRecord(p0 context.Context, p1 string) (*types.WorkloadRecord, error)
func (*SchedulerStub) GetWorkloadRecords ¶ added in v0.1.10
func (s *SchedulerStub) GetWorkloadRecords(p0 context.Context, p1 string, p2 int, p3 int) (*types.ListWorkloadRecordRsp, error)
func (*SchedulerStub) NodeValidationResult ¶
func (*SchedulerStub) SetEdgeUpdateConfig ¶
func (s *SchedulerStub) SetEdgeUpdateConfig(p0 context.Context, p1 *EdgeUpdateConfig) error
func (*SchedulerStub) SubmitNodeWorkloadReport ¶
func (*SchedulerStub) SubmitUserWorkloadReport ¶
func (*SchedulerStub) TriggerElection ¶
func (s *SchedulerStub) TriggerElection(p0 context.Context) error
type TCPMsgType ¶
type TCPMsgType int
TODO: new tcp package, add these to tcp package candidate use tcp server to validate edge
const ( TCPMsgTypeNodeID TCPMsgType = iota + 1 TCPMsgTypeBlock TCPMsgTypeCancel )
type UserAPI ¶ added in v0.1.10
type UserAPI interface { // UserAPIKeysExists checks if the user api key exists. UserAPIKeysExists(ctx context.Context, userID string) error //perm:web // User-related methods // AllocateStorage allocates storage space. AllocateStorage(ctx context.Context, userID string) (*types.StorageSize, error) //perm:web // GetStorageSize get size of user storage GetStorageSize(ctx context.Context, userID string) (*types.StorageSize, error) // perm:web // CreateAPIKey creates a key for the client API. CreateAPIKey(ctx context.Context, userID, keyName string) (string, error) //perm:web // GetAPIKeys get all api key for user. GetAPIKeys(ctx context.Context, userID string) (map[string]string, error) //perm:web // DeleteAPIKey delete a api key for user DeleteAPIKey(ctx context.Context, userID, name string) error //perm:web }
UserAPI is an interface for user
type UserAPIStruct ¶ added in v0.1.10
type UserAPIStruct struct { Internal struct { AllocateStorage func(p0 context.Context, p1 string) (*types.StorageSize, error) `perm:"web"` CreateAPIKey func(p0 context.Context, p1 string, p2 string) (string, error) `perm:"web"` DeleteAPIKey func(p0 context.Context, p1 string, p2 string) error `perm:"web"` GetAPIKeys func(p0 context.Context, p1 string) (map[string]string, error) `perm:"web"` GetStorageSize func(p0 context.Context, p1 string) (*types.StorageSize, error) `perm:"web"` UserAPIKeysExists func(p0 context.Context, p1 string) error `perm:"web"` } }
func (*UserAPIStruct) AllocateStorage ¶ added in v0.1.10
func (s *UserAPIStruct) AllocateStorage(p0 context.Context, p1 string) (*types.StorageSize, error)
func (*UserAPIStruct) CreateAPIKey ¶ added in v0.1.10
func (*UserAPIStruct) DeleteAPIKey ¶ added in v0.1.10
func (*UserAPIStruct) GetAPIKeys ¶ added in v0.1.10
func (*UserAPIStruct) GetStorageSize ¶ added in v0.1.10
func (s *UserAPIStruct) GetStorageSize(p0 context.Context, p1 string) (*types.StorageSize, error)
func (*UserAPIStruct) UserAPIKeysExists ¶ added in v0.1.10
func (s *UserAPIStruct) UserAPIKeysExists(p0 context.Context, p1 string) error
type UserAPIStub ¶ added in v0.1.10
type UserAPIStub struct { }
func (*UserAPIStub) AllocateStorage ¶ added in v0.1.10
func (s *UserAPIStub) AllocateStorage(p0 context.Context, p1 string) (*types.StorageSize, error)
func (*UserAPIStub) CreateAPIKey ¶ added in v0.1.10
func (*UserAPIStub) DeleteAPIKey ¶ added in v0.1.10
func (*UserAPIStub) GetAPIKeys ¶ added in v0.1.10
func (*UserAPIStub) GetStorageSize ¶ added in v0.1.10
func (s *UserAPIStub) GetStorageSize(p0 context.Context, p1 string) (*types.StorageSize, error)
func (*UserAPIStub) UserAPIKeysExists ¶ added in v0.1.10
func (s *UserAPIStub) UserAPIKeysExists(p0 context.Context, p1 string) error
type ValidateReq ¶
type ValidateReq struct { // TCPSrvAddr Candidate tcp server address TCPSrvAddr string RandomSeed int64 Duration int }
ValidateReq represents the request parameters for validation
type Validation ¶
type Validation interface { // ExecuteValidation check node asset and bandwidth ExecuteValidation(ctx context.Context, req *ValidateReq) error //perm:admin }
Validation is an interface for validate-related operations
type ValidationResult ¶
type ValidationResult struct { Validator string CID string // verification canceled due to download IsCancel bool NodeID string Bandwidth float64 // seconds duration CostTime int64 IsTimeout bool // Msg string // if IsCancel is true, Token is valid // use for verify edge providing download Token string // key is random index // values is cid Cids []string // The number of random for validator RandomCount int }
ValidationResult node Validation result
type ValidationStruct ¶
type ValidationStruct struct { Internal struct { ExecuteValidation func(p0 context.Context, p1 *ValidateReq) error `perm:"admin"` } }
func (*ValidationStruct) ExecuteValidation ¶
func (s *ValidationStruct) ExecuteValidation(p0 context.Context, p1 *ValidateReq) error
type ValidationStub ¶
type ValidationStub struct { }
func (*ValidationStub) ExecuteValidation ¶
func (s *ValidationStub) ExecuteValidation(p0 context.Context, p1 *ValidateReq) error