Index: appengine/cmd/dm/distributor/impl/jobsim/model.go |
diff --git a/appengine/cmd/dm/distributor/impl/jobsim/model.go b/appengine/cmd/dm/distributor/impl/jobsim/model.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..29f2030723baf29c9713da3d51908349024c5d80 |
--- /dev/null |
+++ b/appengine/cmd/dm/distributor/impl/jobsim/model.go |
@@ -0,0 +1,39 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package jobsim |
+ |
+import ( |
+ "github.com/luci/luci-go/appengine/cmd/dm/distributor" |
+ "github.com/luci/luci-go/appengine/cmd/dm/enums/execution" |
+ "github.com/luci/luci-go/appengine/cmd/dm/types" |
+ "strconv" |
+) |
+ |
+type jobsimTask struct { |
+ _ string `gae:"$kind,jobsim.Task"` |
+ ID string `gae:"$id"` |
+ |
+ NotifyPath string `gae:",noindex"` |
+ NotifyToken string `gae:",noindex"` |
+ Calculation `gae:",noindex"` |
+ AttemptID types.AttemptID `gae:",noindex"` |
+ ExecutionID types.UInt32 `gae:",noindex"` |
+ ExecutionKey []byte `gae:",noindex"` |
+ ExecutionState execution.State `gae:",noindex"` |
+ PersistentState jobsimState `gae:",noindex"` |
+} |
+ |
+type jobsimState struct { |
+ Stage int |
+} |
+ |
+func (j jobsimState) ToPersistentState() distributor.PersistentState { |
+ return distributor.PersistentState(strconv.Itoa(j.Stage)) |
+} |
+ |
+func (j *jobsimState) FromPersistentState(s distributor.PersistentState) (err error) { |
+ j.Stage, err = strconv.Atoi(string(s)) |
+ return |
+} |