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

Side by Side 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 unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698