Пример #1
0
// CreateLoadIarJob utility function to create job of type LoadIar
func (jm Manager) CreateLoadIarJob(owner mgm.User, inventoryPath string, filename string) int64 {
	j := mgm.Job{}
	j.Type = "load_iar"
	j.Timestamp = time.Now()
	j.User = owner.UserID

	jd := loadIarJob{}
	jd.InventoryPath = inventoryPath
	jd.Status = "Created"
	jd.Filename = filename

	encDat, _ := json.Marshal(jd)
	j.Data = string(encDat)

	return jm.AddJob(j)
}
Пример #2
0
func (jm Manager) CreateLoadOarJob(owner mgm.User, r mgm.Region, x uint, y uint, merge bool, filename string) int64 {
	j := mgm.Job{}
	j.Type = "load_oar"
	j.Timestamp = time.Now()
	j.User = owner.UserID

	jd := loadOarJob{}
	jd.Region = r.UUID
	jd.Status = "Created"
	jd.X = x
	jd.Y = y
	jd.Merge = merge
	jd.Filename = filename

	encDat, _ := json.Marshal(jd)
	j.Data = string(encDat)

	return jm.AddJob(j)
}