OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package jobsim |
| 6 |
| 7 import ( |
| 8 "github.com/luci/luci-go/appengine/cmd/dm/distributor" |
| 9 "github.com/luci/luci-go/appengine/cmd/dm/enums/execution" |
| 10 "github.com/luci/luci-go/appengine/cmd/dm/types" |
| 11 "strconv" |
| 12 ) |
| 13 |
| 14 type jobsimTask struct { |
| 15 _ string `gae:"$kind,jobsim.Task"` |
| 16 ID string `gae:"$id"` |
| 17 |
| 18 NotifyPath string `gae:",noindex"` |
| 19 NotifyToken string `gae:",noindex"` |
| 20 Calculation `gae:",noindex"` |
| 21 AttemptID types.AttemptID `gae:",noindex"` |
| 22 ExecutionID types.UInt32 `gae:",noindex"` |
| 23 ExecutionKey []byte `gae:",noindex"` |
| 24 ExecutionState execution.State `gae:",noindex"` |
| 25 PersistentState jobsimState `gae:",noindex"` |
| 26 } |
| 27 |
| 28 type jobsimState struct { |
| 29 Stage int |
| 30 } |
| 31 |
| 32 func (j jobsimState) ToPersistentState() distributor.PersistentState { |
| 33 return distributor.PersistentState(strconv.Itoa(j.Stage)) |
| 34 } |
| 35 |
| 36 func (j *jobsimState) FromPersistentState(s distributor.PersistentState) (err er
ror) { |
| 37 j.Stage, err = strconv.Atoi(string(s)) |
| 38 return |
| 39 } |
OLD | NEW |