Revision 47099cd1 htools/Ganeti/Jobs.hs

b/htools/Ganeti/Jobs.hs
35 35

  
36 36
-- | Our ADT for the OpCode status at runtime (while in a job).
37 37
data OpStatus = OP_STATUS_QUEUED
38
              | OP_STATUS_WAITLOCK
38
              | OP_STATUS_WAITING
39 39
              | OP_STATUS_CANCELING
40 40
              | OP_STATUS_RUNNING
41 41
              | OP_STATUS_CANCELED
......
47 47
    showJSON os = showJSON w
48 48
      where w = case os of
49 49
              OP_STATUS_QUEUED -> C.jobStatusQueued
50
              OP_STATUS_WAITLOCK -> C.jobStatusWaitlock
50
              OP_STATUS_WAITING -> C.jobStatusWaiting
51 51
              OP_STATUS_CANCELING -> C.jobStatusCanceling
52 52
              OP_STATUS_RUNNING -> C.jobStatusRunning
53 53
              OP_STATUS_CANCELED -> C.jobStatusCanceled
......
55 55
              OP_STATUS_ERROR -> C.jobStatusError
56 56
    readJSON s = case readJSON s of
57 57
      J.Ok v | v == C.jobStatusQueued -> J.Ok OP_STATUS_QUEUED
58
             | v == C.jobStatusWaitlock -> J.Ok OP_STATUS_WAITLOCK
58
             | v == C.jobStatusWaiting -> J.Ok OP_STATUS_WAITING
59 59
             | v == C.jobStatusCanceling -> J.Ok OP_STATUS_CANCELING
60 60
             | v == C.jobStatusRunning -> J.Ok OP_STATUS_RUNNING
61 61
             | v == C.jobStatusCanceled -> J.Ok OP_STATUS_CANCELED
......
68 68
-- such that greater\/lesser comparison on values of this type makes
69 69
-- sense.
70 70
data JobStatus = JOB_STATUS_QUEUED
71
               | JOB_STATUS_WAITLOCK
71
               | JOB_STATUS_WAITING
72 72
               | JOB_STATUS_RUNNING
73 73
               | JOB_STATUS_SUCCESS
74 74
               | JOB_STATUS_CANCELING
......
80 80
    showJSON js = showJSON w
81 81
        where w = case js of
82 82
                JOB_STATUS_QUEUED -> "queued"
83
                JOB_STATUS_WAITLOCK -> "waiting"
83
                JOB_STATUS_WAITING -> "waiting"
84 84
                JOB_STATUS_CANCELING -> "canceling"
85 85
                JOB_STATUS_RUNNING -> "running"
86 86
                JOB_STATUS_CANCELED -> "canceled"
......
88 88
                JOB_STATUS_ERROR -> "error"
89 89
    readJSON s = case readJSON s of
90 90
      J.Ok "queued" -> J.Ok JOB_STATUS_QUEUED
91
      J.Ok "waiting" -> J.Ok JOB_STATUS_WAITLOCK
91
      J.Ok "waiting" -> J.Ok JOB_STATUS_WAITING
92 92
      J.Ok "canceling" -> J.Ok JOB_STATUS_CANCELING
93 93
      J.Ok "running" -> J.Ok JOB_STATUS_RUNNING
94 94
      J.Ok "success" -> J.Ok JOB_STATUS_SUCCESS

Also available in: Unified diff