Documentation ¶
Index ¶
- Constants
- Variables
- func NewFastbuildEngine(conf EngineConfig, mgr resource.HandleWithUser) (engine.Engine, error)
- type CombinedProject
- type DeltaInfoStats
- type EngineConfig
- type FbSummary
- type Message
- type MessageSubTaskDone
- type MessageType
- type MySQL
- type RemoteResource
- type TableClusterSetting
- type TableProjectInfo
- type TableProjectSetting
- type TableSubTask
- type TableTask
- type TableWhitelist
- type TaskExtra
Constants ¶
const ( // EngineName define the engine name EngineName = "fastbuild" FBCompressResultEnvKey = "FB_COMPRESS_RESULT" FBCacheEnableKey = "FB_CACHE_ENABLE" )
const vars for fastbuild engine
Variables ¶
var (
ErrorClusterNoFound = fmt.Errorf("cluster no found")
)
var (
ErrorInvalidMessageType = errors.New("invalid message type")
)
define errors for message
Functions ¶
func NewFastbuildEngine ¶
func NewFastbuildEngine(conf EngineConfig, mgr resource.HandleWithUser) (engine.Engine, error)
NewFastbuildEngine return new fastbuild engine
Types ¶
type CombinedProject ¶
type CombinedProject struct { *TableProjectSetting *TableProjectInfo }
generate project_settings and project_records
type DeltaInfoStats ¶
type DeltaInfoStats struct {
ServiceUnits float64
}
DeltaInfoStats describe the project info delta data.
type EngineConfig ¶
type EngineConfig struct { engine.MySQLConf SpecialFBCmd string TaskMaxRunningSeconds int32 TaskBKMainNoSubTaskTimeoutSeconds int32 }
EngineConfig define config of fastbuild
type FbSummary ¶
type FbSummary struct { LibraryBuilt int `gorm:"column:library_built" json:"library_built"` LibraryCacheHit int `gorm:"column:library_cache_hit" json:"library_cache_hit"` LibraryCPUTime float32 `gorm:"column:library_cpu_time" json:"library_cpu_time"` ObjectBuilt int `gorm:"column:object_built" json:"object_built"` ObjectCacheHit int `gorm:"column:object_cache_hit" json:"object_cache_hit"` ObjectCPUTime float32 `gorm:"column:object_cpu_time" json:"object_cpu_time"` ExeBuilt int `gorm:"column:exe_built" json:"exe_built"` ExeCacheHit int `gorm:"column:exe_cache_hit" json:"exe_cache_hit"` ExeCPUTime float32 `gorm:"column:exe_cpu_time" json:"exe_cpu_time"` CacheHits int `gorm:"column:cache_hits" json:"cache_hits"` CacheMisses int `gorm:"column:cache_misses" json:"cache_misses"` CacheStores int `gorm:"column:cache_stores" json:"cache_stores"` RealCompileTime float32 `gorm:"column:real_compile_time" json:"real_compile_time"` LocalCompileTime float32 `gorm:"column:local_compile_time" json:"local_compile_time"` RemoteCompileTime float32 `gorm:"column:remote_compile_time" json:"remote_compile_time"` }
FbSummary : fast build summary
type MessageSubTaskDone ¶
type MessageSubTaskDone struct { TaskID string `json:"task_id"` Params string `json:"params"` FullCmd string `json:"full_cmd"` Env string `json:"env"` RunDir string `json:"run_dir"` CommandType string `json:"command_type"` Command string `json:"command"` User string `json:"user"` Status string `json:"status"` StartTime int64 `json:"start_time"` EndTime int64 `json:"end_time"` // fb summary CompileResult string `json:"compile_result"` FbSummary FbSummary }
MessageSubTaskDone define struct for sub task done
func DecodeSubTaskDone ¶
func DecodeSubTaskDone(data []byte) (*MessageSubTaskDone, error)
DecodeSubTaskDone to decode message data to MessageSubTaskDone
type MessageType ¶
type MessageType int
MessageType difine message type
const (
MessageTypeSubTaskDone MessageType
)
enum values for message type
func (MessageType) String ¶
func (rst MessageType) String() string
String return the string of MessageType
type MySQL ¶
type MySQL interface { // get db operator GetDB() *gorm.DB ListTask(opts commonMySQL.ListOptions) ([]*TableTask, int64, error) GetTask(taskID string) (*TableTask, error) PutTask(task *TableTask) error UpdateTask(taskID string, task map[string]interface{}) error DeleteTask(taskID string) error ListProject(opts commonMySQL.ListOptions) ([]*CombinedProject, int64, error) ListProjectInfo(opts commonMySQL.ListOptions) ([]*TableProjectInfo, int64, error) GetProjectInfo(projectID string) (*TableProjectInfo, error) PutProjectInfo(projectInfo *TableProjectInfo) error UpdateProjectInfo(projectID string, projectInfo map[string]interface{}) error DeleteProjectInfo(projectID string) error AddProjectInfoStats(projectID string, delta DeltaInfoStats) error ListProjectSetting(opts commonMySQL.ListOptions) ([]*TableProjectSetting, int64, error) GetProjectSetting(projectID string) (*TableProjectSetting, error) PutProjectSetting(projectSetting *TableProjectSetting) error UpdateProjectSetting(projectID string, projectSetting map[string]interface{}) error DeleteProjectSetting(projectID string) error CreateOrUpdateProjectSetting(projectSetting *TableProjectSetting, projectSettingRaw map[string]interface{}) error ListWhitelist(opts commonMySQL.ListOptions) ([]*TableWhitelist, int64, error) GetWhitelist(key engine.WhiteListKey) (*TableWhitelist, error) PutWhitelist(wll []*TableWhitelist) error UpdateWhitelist(key engine.WhiteListKey, wll []map[string]interface{}) error DeleteWhitelist(keys []*engine.WhiteListKey) error ListClusterSetting(opts commonMySQL.ListOptions) ([]*TableClusterSetting, int64, error) GetClusterSetting(clusterID string) (*TableClusterSetting, error) PutClusterSetting(clusterSetting *TableClusterSetting) error UpdateClusterSetting(clusterID string, clusterSetting map[string]interface{}) error DeleteClusterSetting(clusterID string) error PutSubTask(task *TableSubTask) error ListSubTask(opts commonMySQL.ListOptions) ([]*TableSubTask, int64, error) GetSubTaskSummary(taskID string) (*FbSummary, error) ListAllSubTask(opts commonMySQL.ListOptions) ([]*TableSubTask, int64, error) }
MySQL describe the full operations to mysql databases need by engine.
type RemoteResource ¶
type RemoteResource struct { UserDefineID string `json:"user_define_id"` RemoteIP string `json:"remote_ip"` RemotePort uint32 `json:"remote_port"` }
RemoteResource 记录拉起的远端资源信息,userDefineID 保证唯一对应关系
type TableClusterSetting ¶
type TableClusterSetting struct { engine.TableBasic Cluster string `gorm:"column:cluster;primary_key" sql:"type:varchar(64)" json:"cluster"` Attr int32 `gorm:"column:attr;default:1" json:"attr"` Message string `gorm:"column:message" sql:"type:text" json:"message"` MessageMore string `gorm:"column:message_more" sql:"type:text" json:"message_more"` }
TableClusterSetting define table struct of cluster setting
func (TableClusterSetting) TableName ¶
func (tcs TableClusterSetting) TableName() string
TableName return table name
type TableProjectInfo ¶
type TableProjectInfo struct { engine.TableProjectInfoBasic ServiceUnits float64 `gorm:"column:service_units" json:"service_units"` }
TableProjectInfo define table struct of project info
func (TableProjectInfo) TableName ¶
func (tpi TableProjectInfo) TableName() string
TableName return table name
type TableProjectSetting ¶
type TableProjectSetting struct { engine.TableProjectBasic RequestCPU float64 `gorm:"column:request_cpu" json:"request_cpu"` LeastCPU float64 `gorm:"column:least_cpu" json:"least_cpu"` CacheEnabled bool `gorm:"column:cache_enabled" json:"cache_enabled"` FBResultCompress bool `gorm:"column:fb_result_compress" json:"fb_result_compress"` Attr uint32 `gorm:"column:attr" json:"attr"` // agent worker parameters AgentMinPort uint32 `gorm:"column:agent_min_port" json:"agent_min_port"` AgentMaxPort uint32 `gorm:"column:agent_max_port" json:"agent_max_port"` AgentRemoteExe string `gorm:"column:agent_remote_exe" json:"agent_remote_exe"` AgentWorkerConsole bool `gorm:"column:agent_worker_console" json:"agent_worker_console"` AgentWorkerMode string `gorm:"column:agent_worker_mode" json:"agent_worker_mode"` AgentWorkerNosubprocess bool `gorm:"column:agent_worker_nosubprocess" json:"agent_worker_nosubprocess"` Agent4OneTask bool `gorm:"column:agent_4_one_task" json:"agent_4_one_task"` AgentWorkerCPU string `gorm:"column:agent_worker_cpu" json:"agent_worker_cpu"` }
TableProjectSetting define table struct of project setting
func (TableProjectSetting) TableName ¶
func (tps TableProjectSetting) TableName() string
TableName return table name
type TableSubTask ¶
type TableSubTask struct { UpdatedAt time.Time `gorm:"column:update_at" json:"-"` TaskID string `gorm:"column:task_id;index" json:"task_id"` // 命令信息 Params string `gorm:"column:params" sql:"type:text" json:"params"` FullCmd string `gorm:"column:full_cmd" sql:"type:text" json:"full_cmd"` Env string `gorm:"column:env" sql:"type:text" json:"env"` RunDir string `gorm:"column:run_dir" sql:"type:text" json:"run_dir"` CommandType string `gorm:"column:command_type" json:"command_type"` Command string `gorm:"column:command" sql:"type:text" json:"command"` User string `gorm:"column:user" sql:"type:text" json:"user"` // 任务状态 Status string `gorm:"column:status;index" json:"status"` StartTime int64 `gorm:"column:start_time" json:"start_time"` EndTime int64 `gorm:"column:end_time" json:"end_time"` // 任务结果 CompileResult string `gorm:"column:compile_result" sql:"type:text" json:"compile_result"` FbSummary }
TableSubTask define table struct of sub task
func MessageSubTaskDone2table ¶
func MessageSubTaskDone2table(msg *MessageSubTaskDone) *TableSubTask
MessageSubTaskDone2table format TableSubTask with MessageSubTaskDone
func (TableSubTask) TableName ¶
func (tst TableSubTask) TableName() string
TableName return table name
type TableTask ¶
type TableTask struct { engine.TableTaskBasic // 资源 ResourceID string `gorm:"column:resource_id" json:"resource_id"` RequestCPU float64 `gorm:"column:request_cpu" json:"request_cpu"` LeastCPU float64 `gorm:"column:least_cpu" json:"least_cpu"` CPUTotal float64 `gorm:"column:cpu_total" json:"cpu_total"` MemTotal float64 `gorm:"column:mem_total" json:"mem_total"` WorkerIPList string `gorm:"column:worker_ip_list" sql:"type:text" json:"worker_ip_list"` // 项目属性 CacheEnabled bool `gorm:"column:cache_enabled" json:"cache_enabled"` FBResultCompress bool `gorm:"column:fb_result_compress" json:"fb_result_compress"` Attr uint32 `gorm:"column:attr" json:"attr"` // 命令信息 Params string `gorm:"column:params" sql:"type:text" json:"params"` FullCmd string `gorm:"column:full_cmd" sql:"type:text" json:"full_cmd"` Env string `gorm:"column:env" sql:"type:text" json:"env"` RunDir string `gorm:"column:run_dir" sql:"type:text" json:"run_dir"` CommandType string `gorm:"column:command_type" json:"command_type"` Command string `gorm:"column:command" sql:"type:text" json:"command"` User string `gorm:"column:user" sql:"type:text" json:"user"` // agent执行参数 AgentMinPort uint32 `gorm:"column:agent_min_port" json:"agent_min_port"` AgentMaxPort uint32 `gorm:"column:agent_max_port" json:"agent_max_port"` AgentPath string `gorm:"column:agent_path" json:"agent_path"` AgentRemoteExe string `gorm:"column:agent_remote_exe" json:"agent_remote_exe"` AgentWorkerConsole bool `gorm:"column:agent_worker_console" json:"agent_worker_console"` AgentWorkerMode string `gorm:"column:agent_worker_mode" json:"agent_worker_mode"` AgentWorkerNosubprocess bool `gorm:"column:agent_worker_nosubprocess" json:"agent_worker_nosubprocess"` Agent4OneTask bool `gorm:"column:agent_4_one_task" json:"agent_4_one_task"` AgentWorkerCPU string `gorm:"column:agent_worker_cpu" json:"agent_worker_cpu"` // 拉起的远端资源 RemoteResource string `gorm:"column:remote_resource" sql:"type:text" json:"remote_resource"` // 结果 CompileResult string `gorm:"column:compile_result" sql:"type:text" json:"compile_result"` FbSummary }
TableTask define table struct of task
type TableWhitelist ¶
type TableWhitelist struct {
engine.TableWhitelistBasic
}
TableWhitelist define table struct of white list
func (TableWhitelist) TableName ¶
func (twl TableWhitelist) TableName() string
TableName return table name