dbclient

package
v1.3.0-rc.0...-a07df58 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddonManagement

type AddonManagement struct {
	ID          uint64 `gorm:"primary_key"`
	AddonID     string `gorm:"type:varchar(64)"` // Primary key
	Name        string `gorm:"type:varchar(64)"`
	ProjectID   string
	OrgID       string
	AddonConfig string `gorm:"type:text"`
	CPU         float64
	Mem         uint64
	Nodes       int
	CreateTime  time.Time `gorm:"column:create_time"`
	UpdateTime  time.Time `gorm:"column:update_time"`
}

addon management

func (AddonManagement) TableName

func (AddonManagement) TableName() string

type AddonNode

type AddonNode struct {
	ID         string `gorm:"type:varchar(64)"`
	InstanceID string `gorm:"type:varchar(64)"` // AddonInstance primary key
	Namespace  string `gorm:"type:text"`
	NodeName   string
	CPU        float64
	Mem        uint64
	Deleted    string    `gorm:"column:is_deleted"` // Y: deleted N: not delete
	CreatedAt  time.Time `gorm:"column:create_time"`
	UpdatedAt  time.Time `gorm:"column:update_time"`
}

AddonNode Addon node info

func (AddonNode) TableName

func (AddonNode) TableName() string

type AddonNodeList

type AddonNodeList []AddonNode

func (AddonNodeList) Len

func (r AddonNodeList) Len() int

func (AddonNodeList) Less

func (r AddonNodeList) Less(i, j int) bool

func (AddonNodeList) Swap

func (r AddonNodeList) Swap(i, j int)

type ClusterDaily

type ClusterDaily struct {
	ID          int    `gorm:"type:BIGINT(20)"`
	ClusterName string `gorm:"type:cluster_name"`

	CreatedAt time.Time `gorm:"column:created_at"`
	UpdatedAt time.Time `gorm:"column:updated_at"`
	// contains filtered or unexported fields
}

ProjectDaily

type DBClient

type DBClient struct {
	*dbengine.DBEngine
}

func Open

func Open(db *dbengine.DBEngine) *DBClient

func (*DBClient) AddonManageReader

func (c *DBClient) AddonManageReader() *addonManageReader

read condition

func (*DBClient) AddonManageWriter

func (c *DBClient) AddonManageWriter() *addonManageWriter

write

func (*DBClient) AddonNodeReader

func (c *DBClient) AddonNodeReader() *addonNodeReader

func (*DBClient) AddonNodeWriter

func (c *DBClient) AddonNodeWriter() *addonNodeWriter

func (*DBClient) CreateDeployment

func (c *DBClient) CreateDeployment(deployment *Deployments) error

CreateDeployment create running deployment

func (*DBClient) CreateJob

func (c *DBClient) CreateJob(Job *Jobs) error

CreateJob 创建正在运行的Job

func (*DBClient) DeleteDeployment

func (c *DBClient) DeleteDeployment(orgID string, taskID uint64) error

DeleteDeployment 删除 deployment 信息

func (*DBClient) DeleteJob

func (c *DBClient) DeleteJob(orgID string, taskID uint64) error

DeleteJob 删除 Job 信息

func (*DBClient) GetDeployment

func (c *DBClient) GetDeployment(orgID string, taskID uint64) []Deployments

GetDeployment get deployment info

func (*DBClient) GetJob

func (c *DBClient) GetJob(orgID string, taskID uint64) []Jobs

GetJob 获取job信息

func (*DBClient) ListDeploymentsByOrgID

func (c *DBClient) ListDeploymentsByOrgID(param *apistructs.OrgRunningTasksListRequest,
	orgID uint64) (int64, *[]Deployments, error)

ListDeploymentsByOrgID list deployment by org id

func (*DBClient) ListExpiredDeployments

func (c *DBClient) ListExpiredDeployments(startTime string) []Deployments

ListExpiredDeployments list expire deployment from specific time

func (*DBClient) ListExpiredJobs

func (c *DBClient) ListExpiredJobs(startTime string) []Jobs

ListExpiredJobs 列出过期的job

func (*DBClient) ListJobsByOrgID

func (c *DBClient) ListJobsByOrgID(param *apistructs.OrgRunningTasksListRequest,
	orgID uint64) (int64, *[]Jobs, error)

ListJobsByOrgID 获取指定企业的job列表

func (*DBClient) ListRunningDeployments

func (c *DBClient) ListRunningDeployments() []Deployments

ListRunningDeployments list running deployments

func (*DBClient) ListRunningJobs

func (c *DBClient) ListRunningJobs() []Jobs

ListRunningJobs list running job

func (*DBClient) OrgAKReader

func (c *DBClient) OrgAKReader() *orgakReader

func (*DBClient) OrgAKWriter

func (c *DBClient) OrgAKWriter() *orgakWriter

func (*DBClient) RecordsReader

func (c *DBClient) RecordsReader() *recordsReader

func (*DBClient) RecordsWriter

func (c *DBClient) RecordsWriter() *recordsWriter

func (*DBClient) ResourceRoutingReader

func (c *DBClient) ResourceRoutingReader() *resourceRoutingReader

func (*DBClient) ResourceRoutingWriter

func (c *DBClient) ResourceRoutingWriter() *resourceRoutingWriter

func (*DBClient) UpdateDeploymentStatus

func (c *DBClient) UpdateDeploymentStatus(deployment *Deployments) error

UpdateDeploymentStatus update deployment status

func (*DBClient) UpdateJobStatus

func (c *DBClient) UpdateJobStatus(Job *Jobs) error

UpdateJobStatus 更新Job状态

type Deployments

type Deployments struct {
	ID              int64     `json:"id" gorm:"primary_key"`
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
	OrgID           uint64    `gorm:"index:org_id"`
	ProjectID       uint64
	ApplicationID   uint64
	PipelineID      uint64
	TaskID          uint64
	QueueTimeSec    int64 // queue time
	CostTimeSec     int64 // job const time
	ProjectName     string
	ApplicationName string
	TaskName        string
	Status          string
	Env             string
	ClusterName     string
	UserID          string
	RuntimeID       string
	ReleaseID       string
	Extra           ExtraDeployment `json:"extra"`
}

Deployments deployment service

func (Deployments) TableName

func (Deployments) TableName() string

type ExtraDeployment

type ExtraDeployment struct{}

type ExtraJob

type ExtraJob struct{}

type Jobs

type Jobs struct {
	ID              int64     `json:"id" gorm:"primary_key"`
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
	OrgID           uint64    `gorm:"index:org_id"`
	ProjectID       uint64
	ApplicationID   uint64
	PipelineID      uint64
	TaskID          uint64
	QueueTimeSec    int64
	CostTimeSec     int64
	ProjectName     string
	ApplicationName string
	TaskName        string
	Status          string
	Env             string
	ClusterName     string
	TaskType        string
	UserID          string
	Extra           ExtraJob `json:"extra"`
}

func (Jobs) TableName

func (Jobs) TableName() string

type OrgAK

type OrgAK struct {
	dbengine.BaseModel
	OrgID       string     `gorm:"type:varchar(64);index"`
	Vendor      VendorType `gorm:"type:varchar(64);index"`
	AccessKey   string     `gorm:"type:text"`
	SecretKey   string     `gorm:"type:text"`
	Description string     `gorm:"type:text"`
}

func (OrgAK) TableName

func (OrgAK) TableName() string

type ProjectDaily

type ProjectDaily struct {
	ID          int       `gorm:"type:BIGINT(20)"`
	ProjectName string    `gorm:"type:project_name"`
	ProjectID   string    `gorm:"column:project_id"`
	CpuQuota    float64   `gorm:"column:cpu_quota"`
	CpuRequest  float64   `gorm:"column:cpu_request"`
	MemQuota    float64   `gorm:"column:mem_quota"`
	MemRequest  float64   `gorm:"column:mem_request"`
	CreatedAt   time.Time `gorm:"column:created_at"`
	UpdatedAt   time.Time `gorm:"column:updated_at"`
}

ProjectDaily

type Record

type Record struct {
	dbengine.BaseModel
	RecordType  RecordType `gorm:"type:varchar(64)"`
	UserID      string     `gorm:"type:varchar(64)"`
	OrgID       string     `gorm:"type:varchar(64);index"`
	ClusterName string     `gorm:"type:varchar(64);index"`
	Status      StatusType `gorm:"type:varchar(64)"`
	Detail      string     `gorm:"type:text"`

	PipelineID uint64
}

func (Record) TableName

func (Record) TableName() string

type RecordType

type RecordType string
const (
	RecordTypeAddNodes                RecordType = "addNodes"
	RecordTypeAddEssNodes             RecordType = "addEssNodes"
	RecordTypeAddAliNodes             RecordType = "addAliNodes"
	RecordTypeRmNodes                 RecordType = "rmNodes"
	RecordTypeDeleteNodes             RecordType = "deleteNodes"
	RecordTypeDeleteEssNodes          RecordType = "deleteEssNodes"
	RecordTypeDeleteEssNodesCronJob   RecordType = "deleteEssNodesCronJob"
	RecordTypeSetLabels               RecordType = "setLabels"
	RecordTypeAddAliECSECluster       RecordType = "addAliECSEdgeCluster"
	RecordTypeAddAliACKECluster       RecordType = "addAliACKEdgeCluster" // TODO remove
	RecordTypeAddAliCSECluster        RecordType = "addAliCSEdgeCluster"
	RecordTypeAddAliCSManagedCluster  RecordType = "addAliCSManagedEdgeCluster"
	RecordTypeImportKubernetesCluster RecordType = "importKubernetesCluster"
	RecordTypeCreateClusterCredential RecordType = "createClusterCredential"
	RecordTypeResetClusterCredential  RecordType = "resetClusterCredential"
	RecordTypeUpgradeEdgeCluster      RecordType = "upgradeEdgeCluster"
	RecordTypeOfflineEdgeCluster      RecordType = "offlineEdgeCluster"
	RecordTypeCreateAliCloudMysql     RecordType = "createAliCloudMysql"
	RecordTypeCreateAliCloudMysqlDB   RecordType = "createAliCloudMysqlDB"
	RecordTypeCreateAliCloudRedis     RecordType = "createAliCloudRedis"
	RecordTypeCreateAliCloudOss       RecordType = "createAliCloudOss"
	RecordTypeCreateAliCloudOns       RecordType = "createAliCloudOns"
	RecordTypeCreateAliCloudOnsTopic  RecordType = "createAliCloudOnsTopic"
	RecordTypeCreateAliCloudGateway   RecordType = "createAliCloudGateway"
)

func (RecordType) String

func (r RecordType) String() string

type ResourceRouting

type ResourceRouting struct {
	dbengine.BaseModel
	ResourceID string `gorm:"type:varchar(128); index"`
	// e.g mysql instance/db name
	ResourceName string `gorm:"type:varchar(64)"`
	// e.g mysql/mysql db
	ResourceType ResourceType  `gorm:"type:varchar(32)"`
	Vendor       string        `gorm:"type:varchar(32)"`
	OrgID        string        `gorm:"type:varchar(64)"`
	ClusterName  string        `gorm:"type:varchar(64)"`
	ProjectID    string        `gorm:"type:varchar(64); index"`
	AddonID      string        `gorm:"type:varchar(64)"`
	Status       RoutingStatus `gorm:"type:varchar(32)"`
	RecordID     uint64
	Detail       string `gorm:"type:text"`
}

func (ResourceRouting) TableName

func (ResourceRouting) TableName() string

type ResourceType

type ResourceType string
const (
	ResourceTypeMysql           ResourceType = "MYSQL"
	ResourceTypeMysqlDB         ResourceType = "MYSQL_DB"
	ResourceTypeGateway         ResourceType = "GATEWAY"
	ResourceTypeGatewayVpcGrant ResourceType = "GATEWAY_VPC_GRANT"
	ResourceTypeOns             ResourceType = "ONS"
	ResourceTypeOnsTopic        ResourceType = "ONS_TOPIC"
	ResourceTypeRedis           ResourceType = "REDIS"
	ResourceTypeOss             ResourceType = "OSS"
)

func (ResourceType) String

func (r ResourceType) String() string

type RoutingStatus

type RoutingStatus string
const (
	ResourceStatusCreated  RoutingStatus = "CREATED"
	ResourceStatusDeleted  RoutingStatus = "DELETED"
	ResourceStatusAttached RoutingStatus = "ATTACHED"
	ResourceStatusDetached RoutingStatus = "DETACHED"
)

func (RoutingStatus) String

func (r RoutingStatus) String() string

type StatusType

type StatusType string
const (
	StatusTypeSuccess    StatusType = "success"
	StatusTypeSuccessed  StatusType = "successed"
	StatusTypeFailed     StatusType = "failed"
	StatusTypeProcessing StatusType = "processing"
	StatusTypeUnknown    StatusType = "unknown"
)

func (StatusType) String

func (s StatusType) String() string

type VendorType

type VendorType string
const (
	VendorTypeAliyun VendorType = "aliyun"
)

Jump to

Keyboard shortcuts

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