Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1798)

Unified Diff: appengine/cmd/dm/distributor/impl/jobsim/model.go

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: work in progress Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
+}

Powered by Google App Engine
This is Rietveld 408576698