service

package
v0.0.0-...-032b0eb Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client *docker.Client
View Source
var IsRunningJob = make(chan bool)
View Source
var JobDispatchers sync.Map

Functions

func BuildDockerfile

func BuildDockerfile(dockerFile string) (inputBuf *bytes.Buffer, err error)

func BuildImage

func BuildImage(auto bool, job *tools.EdgeCmJob, jobCh chan<- *tools.JobStatus)

Generate a image and deduce the state based on the job information

func CWA

get current cwa value

func CheckAndAutoRmImage

func CheckAndAutoRmImage()

check images and auto remove images

func CheckContainerStatus

func CheckContainerStatus()

check containers

func CheckFailedMessageAndResend

func CheckFailedMessageAndResend()

Check to send the failed message and resend it

func CheckImageExistByName

func CheckImageExistByName(name string) bool

check images exist by name

func CheckPendingJob

func CheckPendingJob()

Check the image build or the task that the image build successfully hangs

func ClearDanglingImage

func ClearDanglingImage()

clear invalid images

func ContainerExistByName

func ContainerExistByName(name string) bool

check container exist by name

func ContainerRestart

func ContainerRestart(c *gin.Context)

restart container by taskid

func ContainerStop

func ContainerStop(c *gin.Context)

stop container by taskid

func Containers

func Containers(filters map[string][]string) ([]docker.APIContainers, error)

get containers by filters

func DelImage

func DelImage(c *gin.Context)

delete image by taskid

func DeleteCWA

func DeleteCWA(jobId string)

Remove cwa via jobid

func DeleteNodeData

func DeleteNodeData(jobID string)

func GetAndStoreJobInfo

func GetAndStoreJobInfo(url, taskId string, r *Resp)

call api and store job information result

func GetDockerfile

func GetDockerfile(c *gin.Context)

get dockerfile by taskid

func HandleRequestData

func HandleRequestData(c *gin.Context, out interface{}) bool

handle request data parse struct

func Images

func Images(filters map[string][]string) ([]docker.APIImages, error)

search images by filters

func JobImageList

func JobImageList() ([]docker.APIImages, error)

get job images

func Peak

func Peak(jobId string) (*tools.PeakValue, error)

search peak and valley values were queried by jobid

func PullImage

func PullImage(c *gin.Context)

pull image by taskid

func PullJobCommand

func PullJobCommand()

pull job command

func PullJobImageBuildRun

func PullJobImageBuildRun()

pull task information

func PullJobStatus

func PullJobStatus()

pull DSM job status

func PushHardwareInfo

func PushHardwareInfo()

push hardware information every 30 seconds

func PushJobStatusChanged

func PushJobStatusChanged()

push job status

func PushRunningJob

func PushRunningJob(forever bool)

push running jobs

func RemoveImage

func RemoveImage(name string) error

remove images

func Response

func Response(c *gin.Context, statusCode int, resp interface{})

build http response body

func RestartContainer

func RestartContainer(taskId, jobId string, jobCh chan<- *tools.JobStatus)

Restart the container and generate the state based on the job information

func Run

func Run()

func RunContainer

func RunContainer(c *gin.Context)

run container by taskid

func RunningJob

func RunningJob() ([]map[string]string, error)

get current running jobs

func Serve

func Serve()

func StartContainer

func StartContainer(job *tools.EdgeCmJob, jobCh chan<- *tools.JobStatus)

Start the container and generate the state based on the job information

func StartP2pClient

func StartP2pClient()

start p2p client

func StopContainer

func StopContainer(taskId, jobId string, jobCh chan<- *tools.JobStatus)

Stop the container and generate the state based on the job information

func SystemCheck

func SystemCheck()

system check

Types

type Dispatcher

type Dispatcher struct {
	C chan struct{}
}

dispatcher struct stop: use dispatcher.Stop()

func StoreCWA

func StoreCWA(jobId string) *Dispatcher

store cwa to sqlite, return a dispatcher

func (*Dispatcher) Stop

func (d *Dispatcher) Stop()

stop dispatcher

type JobCommand

type JobCommand struct {
	Mac     string `json:"mac"`
	TaskId  string `json:"taskId"`
	JobId   string `json:"jobId"`
	Command string `json:"command"`
}

job command

type Mount

type Mount struct {
	Type        string
	Source      string
	Destination string
	Mode        string
	RW          bool
	Propagation string
}

type ReqParam

type ReqParam struct {
	TaskId string
}

request body

type Resp

type Resp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

response body

type ResponseInfo

type ResponseInfo struct {
	Success bool   `json:"success"`
	Msg     string `json:"msg"`
	Code    int    `json:"code"`
	Data    tools.EdgeCmJob
}

api response

Jump to

Keyboard shortcuts

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