models

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIL_C2_CPU512 = 1
	FIL_C2_CPU32G = 2
	FIL_C2_GPU512 = 3
	FIL_C2_GPU32G = 4
)
View Source
const (
	TASK_RECEIVED_STATUS = iota + 1
	TASK_RUNNING_STATUS
	TASK_SUCCESS_STATUS
	TASK_FAILED_STATUS
)
View Source
const (
	SOURCE_TYPE_CPU = 0
	SOURCE_TYPE_GPU = 1
)
View Source
const (
	REWARD_UNCLAIMED = iota
	REWARD_CHALLENGED
	REWARD_SLASHED
	REWARD_CLAIMED
)
View Source
const (
	DEPLOY_RECEIVE_JOB = iota + 1
	DEPLOY_DOWNLOAD_SOURCE
	DEPLOY_UPLOAD_RESULT
	DEPLOY_BUILD_IMAGE
	DEPLOY_PUSH_IMAGE
	DEPLOY_PULL_IMAGE
	DEPLOY_TO_K8S
)
View Source
const (
	Task_TYPE_FIL_C2_512 = iota + 1
	Task_TYPE_ALEO
	Task_TYPE_AI
	Task_TYPE_FIL_C2_32
)
View Source
const (
	ActiveStatus string = "Active"
)

Variables

This section is empty.

Functions

func GetDeployStatusStr added in v0.5.0

func GetDeployStatusStr(deployStatus int) string

func GetSourceTypeStr added in v0.5.0

func GetSourceTypeStr(resourceType int) string

func TaskStatusStr added in v0.5.0

func TaskStatusStr(status int) string

func TaskTypeStr added in v0.5.0

func TaskTypeStr(taskType int) string

func UbiTaskTypeStr added in v0.5.0

func UbiTaskTypeStr(typeInt int) string

Types

type Account

type Account struct {
	OwnerAddress   string
	NodeId         string
	MultiAddresses []string
	TaskTypes      []uint8 // 1:Fil-C2-512M, 2:Aleo, 3: AI, 4:Fil-C2-32G
	Beneficiary    string
	WorkerAddress  string
	Version        string
	Contract       string
}

type CacheSpaceDetail

type CacheSpaceDetail struct {
	WalletAddress string
	SpaceName     string
	SpaceUuid     string
	ExpireTime    int64
	JobUuid       string
	TaskType      string
	DeployName    string
	Hardware      string
	Url           string
	TaskUuid      string
	SpaceType     string
}

type CacheUbiTaskDetail

type CacheUbiTaskDetail struct {
	TaskId     string `json:"task_id"`
	TaskType   string `json:"task_type"`
	ZkType     string `json:"zk_type"`
	Tx         string `json:"tx"`
	Status     string `json:"status"`
	Reward     string `json:"reward"`
	CreateTime string `json:"create_time"`
	Contract   string `json:"contract"`
}

type ClusterResource

type ClusterResource struct {
	NodeId           string          `json:"node_id,omitempty"`
	CpAccountAddress string          `json:"cpAccount_address"`
	Region           string          `json:"region,omitempty"`
	ClusterInfo      []*NodeResource `json:"cluster_info"`
	NodeName         string          `json:"node_name,omitempty"`
}

type CollectNodeInfo

type CollectNodeInfo struct {
	Gpu     Gpu    `json:"gpu"`
	CpuName string `json:"cpu_name"`
}

type Commit1Task

type Commit1Task struct {
	SectorNum  int64      `json:"SectorNum"`
	Phase1Out  string     `json:"Phase1Out"`
	SectorSize uint64     `json:"SectorSize"`
	Sid        SectorRef  `json:"Sid"`
	Ticket     string     `json:"Ticket"`
	Cids       SectorCids `json:"Cids"`
	Seed       Seed       `json:"seed"`
}

type Commit2Proof

type Commit2Proof struct {
	TaskUuid  string `json:"task_uuid"`
	CpAddress string `json:"cp_address"`
	NodeId    string `json:"node_id"`
	TaskId    string `json:"task_id"`
	TaskType  string `json:"task_type"`
	Proof     string `json:"proof"`
}

type Common

type Common struct {
	Total        string `json:"total"`
	Used         string `json:"used"`
	Free         string `json:"free"`
	RemainderNum int64  `json:"-"`
}

type ComputingProvider

type ComputingProvider struct {
	Name          string `json:"name"`
	NodeId        string `json:"node_id"`
	MultiAddress  string `json:"multi_address"`
	Autobid       int    `json:"autobid"`
	Status        string `json:"status"`
	PublicAddress string `json:"public_address"`
}

type CpInfoEntity added in v0.5.0

type CpInfoEntity struct {
	Id                 int64    `json:"id" gorm:"primaryKey;autoIncrement"`
	NodeId             string   `json:"node_id" gorm:"node_id"`
	OwnerAddress       string   `json:"owner_address" gorm:"owner_address"`
	Beneficiary        string   `json:"beneficiary" gorm:"beneficiary"`
	WorkerAddress      string   `json:"worker_address" gorm:"worker_address"`
	Version            string   `json:"version" gorm:"version"`
	ContractAddress    string   `json:"contract_address" gorm:"contract_address"`
	MultiAddressesJSON string   `gorm:"multi_addresses_json;type:text" json:"-"`
	TaskTypesJSON      string   `gorm:"task_types_json; type:text" json:"-"`
	CreateAt           string   `json:"create_at" gorm:"create_at"`
	UpdateAt           string   `json:"update_at" gorm:"update_at"`
	MultiAddresses     []string `json:"multi_addresses" gorm:"-"`
	TaskTypes          []uint8  `json:"task_types" gorm:"-"` // 1:Fil-C2-512M, 2:Aleo, 3: AI, 4:Fil-C2-32G

}

func (*CpInfoEntity) AfterFind added in v0.5.0

func (c *CpInfoEntity) AfterFind(tx *gorm.DB) (err error)

func (*CpInfoEntity) BeforeSave added in v0.5.0

func (c *CpInfoEntity) BeforeSave(tx *gorm.DB) (err error)

func (*CpInfoEntity) TableName added in v0.5.0

func (*CpInfoEntity) TableName() string

type CpuQuota

type CpuQuota struct {
	Quota int64 `json:"quota"`
}

type DeleteJobReq

type DeleteJobReq struct {
	CreatorWallet string `json:"creator_wallet"`
	SpaceName     string `json:"space_name"`
}

type EcpCollateralInfo added in v0.5.0

type EcpCollateralInfo struct {
	CpAddress         string
	CollateralBalance string
	FrozenBalance     string
	Status            string
}

type FcpCollateralInfo added in v0.5.0

type FcpCollateralInfo struct {
	CpAddress        string
	AvailableBalance string
	LockedCollateral string
	Status           string
}

type Gpu

type Gpu struct {
	DriverVersion string      `json:"driver_version"`
	CudaVersion   string      `json:"cuda_version"`
	AttachedGpus  int         `json:"attached_gpus"`
	Details       []GpuDetail `json:"details"`
}

type GpuDetail

type GpuDetail struct {
	ProductName     string    `json:"product_name"`
	Status          GpuStatus `json:"status"`
	FbMemoryUsage   Common    `json:"fb_memory_usage"`
	Bar1MemoryUsage Common    `json:"bar1_memory_usage"`
}

type GpuQuota

type GpuQuota struct {
	Name  string `json:"name"`
	Quota int64  `json:"quota"`
}

type GpuStatus

type GpuStatus string
const (
	Occupied  GpuStatus = "occupied"
	Available GpuStatus = "available"
)

type HostInfo

type HostInfo struct {
	SwanProviderVersion string `json:"swan_miner_version"`
	OperatingSystem     string `json:"operating_system"`
	Architecture        string `json:"architecture"`
	CPUCores            int    `json:"cpu_cores"`
}

type Job

type Job struct {
	Uuid   string
	Status int
	Url    string
}

type JobData

type JobData struct {
	UUID                        string `json:"uuid"`
	Name                        string `json:"name"`
	Duration                    int    `json:"duration"`
	JobSourceURI                string `json:"job_source_uri"`
	JobResultURI                string `json:"job_result_uri,omitempty"`
	StorageSource               string `json:"storage_source,omitempty"`
	TaskUUID                    string `json:"task_uuid"`
	BuildLog                    string `json:"build_log,omitempty"`
	ContainerLog                string `json:"container_log"`
	NodeIdJobSourceUriSignature string `json:"node_id_job_source_uri_signature,omitempty"`
	JobRealUri                  string `json:"job_real_uri,omitempty"`
}

type JobEntity added in v0.5.0

type JobEntity struct {
	Id              int64  `json:"id" gorm:"primaryKey;autoIncrement"`
	Source          string `json:"source" gorm:"source"` // market name
	Name            string `json:"name" gorm:"name"`
	SpaceUuid       string `json:"space_uuid"`
	JobUuid         string `json:"job_uuid"`
	TaskUuid        string `json:"task_uuid"`
	ResourceType    string `json:"resource_type"`
	SpaceType       int    `json:"space_type"` // 0: public; 1: private
	SourceUrl       string `json:"source_url" gorm:"source_url"`
	Hardware        string `json:"hardware" gorm:"hardware"`
	Duration        int    `json:"duration"`
	DeployStatus    int    `json:"deploy_status" gorm:"deploy_status"`
	WalletAddress   string `json:"wallet_address"`
	ResultUrl       string `json:"result_url" gorm:"result_url"`
	RealUrl         string `json:"real_url"`
	K8sDeployName   string `json:"k8s_deploy_name" gorm:"k8s_deploy_name"`
	K8sResourceType string `json:"k8s_resource_type" gorm:"k8s_resource_type"`
	NameSpace       string `json:"name_space" gorm:"name_space"`
	ImageName       string `json:"image_name" gorm:"image_name"`
	BuildLog        string `json:"build_log" gorm:"build_log"`
	ContainerLog    string `json:"container_log" gorm:"container_log"`
	ExpireTime      int64  `json:"expire_time" gorm:"expire_time"`
	CreateTime      int64  `json:"create_time" gorm:"create_time"`
	Error           string `json:"error" gorm:"error"`
}

func (*JobEntity) TableName added in v0.5.0

func (*JobEntity) TableName() string

type JobStatus

type JobStatus string

type NodeResource

type NodeResource struct {
	MachineId string `json:"machine_id"`
	CpuName   string `json:"cpu_name"`
	Cpu       Common `json:"cpu"`
	Vcpu      Common `json:"vcpu"`
	Memory    Common `json:"memory"`
	Gpu       Gpu    `json:"gpu"`
	Storage   Common `json:"storage"`
}

type Quota

type Quota struct {
	Quota int64  `json:"quota"`
	Unit  string `json:"unit"`
}

type Resource

type Resource struct {
	Cpu     Specification
	Memory  Specification
	Gpu     Specification
	Storage Specification
}

type ResourcePolicy

type ResourcePolicy struct {
	Cpu     CpuQuota   `json:"cpu"`
	Gpu     []GpuQuota `json:"gpu"`
	Memory  Quota      `json:"memory"`
	Storage Quota      `json:"storage"`
}

type ResourceStatus

type ResourceStatus struct {
	Request  int64
	Capacity int64
}

type SectorCids

type SectorCids struct {
	Unsealed struct {
		Field1 string `json:"/"`
	} `json:"Unsealed"`
	Sealed struct {
		Field1 string `json:"/"`
	} `json:"Sealed"`
}

type SectorRef

type SectorRef struct {
	ID struct {
		Miner  uint64 `json:"Miner"`
		Number uint64 `json:"Number"`
	} `json:"ID"`
	ProofType int64 `json:"ProofType"`
}

type Seed

type Seed struct {
	Value string `json:"Value"`
	Epoch int    `json:"Epoch"`
}

type SpaceFile

type SpaceFile struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type SpaceHardware

type SpaceHardware struct {
	Description  string `json:"description"`
	HardwareType string `json:"hardware_type"`
	Memory       int    `json:"memory"`
	Name         string `json:"name"`
	Vcpu         int    `json:"vcpu"`
}

type SpaceJSON

type SpaceJSON struct {
	Data struct {
		Files []SpaceFile `json:"files"`
		Owner struct {
			PublicAddress string `json:"public_address"`
		} `json:"owner"`
		Space struct {
			Uuid        string `json:"uuid"`
			Name        string `json:"name"`
			ActiveOrder struct {
				Config SpaceHardware `json:"config"`
			} `json:"activeOrder"`
		} `json:"space"`
	} `json:"data"`
	Message string `json:"message"`
	Status  string `json:"status"`
}

type Specification

type Specification struct {
	Quantity int64
	Unit     string
}

type T added in v0.4.6

type T struct {
	Gpu struct {
		DriverVersion string `json:"driver_version"`
		CudaVersion   string `json:"cuda_version"`
		AttachedGpus  int    `json:"attached_gpus"`
		Details       []struct {
			ProductName   string `json:"product_name"`
			FbMemoryUsage struct {
				Total string `json:"total"`
				Used  string `json:"used"`
				Free  string `json:"free"`
			} `json:"fb_memory_usage"`
			Bar1MemoryUsage struct {
				Total string `json:"total"`
				Used  string `json:"used"`
				Free  string `json:"free"`
			} `json:"bar1_memory_usage"`
		} `json:"details"`
	} `json:"gpu"`
	MachineId string `json:"machine_id"`
	CpuName   string `json:"cpu_name"`
	Cpu       struct {
		Total string `json:"total"`
		Used  string `json:"used"`
		Free  string `json:"free"`
	} `json:"cpu"`
	Vcpu struct {
		Total string `json:"total"`
		Used  string `json:"used"`
		Free  string `json:"free"`
	} `json:"vcpu"`
	Memory struct {
		Total string `json:"total"`
		Used  string `json:"used"`
		Free  string `json:"free"`
	} `json:"memory"`
	Storage struct {
		Total string `json:"total"`
		Used  string `json:"used"`
		Free  string `json:"free"`
	} `json:"storage"`
}

type TaskEntity added in v0.5.0

type TaskEntity struct {
	Id           int64  `json:"id" gorm:"primaryKey;id"`
	Type         int    `json:"type" gorm:"type"`
	Name         string `json:"name" gorm:"name"`
	Contract     string `json:"contract" gorm:"name"`
	ResourceType int    `json:"resource_type" gorm:"resource_type"` // 1
	InputParam   string `json:"input_param" gorm:"input_param"`
	TxHash       string `json:"tx_hash" gorm:"tx_hash"`
	RewardTx     string `json:"reward_tx"`
	ChallengeTx  string `json:"challenge_tx"`
	SlashTx      string `json:"slash_tx"`
	Status       int    `json:"status" gorm:"status"`
	RewardStatus int    `json:"reward_status" gorm:"status"` // 0: unclaimed; 1: challenged; 2: slashed; 3: claimed
	Reward       string `json:"reward" gorm:"column:reward; default:0.0000"`
	CreateTime   int64  `json:"create_time" gorm:"create_time"`
	EndTime      int64  `json:"end_time" gorm:"end_time"`
	Error        string `json:"error" gorm:"error"`
}

func (*TaskEntity) TableName added in v0.5.0

func (task *TaskEntity) TableName() string

type TaskList

type TaskList []CacheUbiTaskDetail

func (TaskList) Len

func (t TaskList) Len() int

func (TaskList) Less

func (t TaskList) Less(i, j int) bool

func (TaskList) Swap

func (t TaskList) Swap(i, j int)

type TaskResource

type TaskResource struct {
	CPU     string `json:"cpu"`
	GPU     string `json:"gpu"`
	Memory  string `json:"memory"`
	Storage string `json:"storage"`
}

type UBITaskReq

type UBITaskReq struct {
	ID           int           `json:"id"`
	Name         string        `json:"name,omitempty"`
	Type         int           `json:"type"`
	InputParam   string        `json:"input_param"`
	Signature    string        `json:"signature"`
	Resource     *TaskResource `json:"resource"`
	ResourceType int           `json:"resource_type"`
	ContractAddr string        `json:"contract_addr"`
}

type UbiC2Proof added in v0.4.6

type UbiC2Proof struct {
	TaskId    string `json:"task_id,omitempty"`
	TaskType  string `json:"task_type,omitempty"`
	Proof     string `json:"proof,omitempty"`
	ZkType    string `json:"zk_type,omitempty"`
	NameSpace string `json:"name_space,omitempty"`
}

Jump to

Keyboard shortcuts

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