LGTM, thanks.

On Wed, Feb 5, 2014 at 2:49 PM, Klaus Aehlig <[email protected]> wrote:

> This pure function follows the semantic that an opcode, including
> its priority, may only be changed if the opcode is not finalized.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/JQueue.hs | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/Ganeti/JQueue.hs b/src/Ganeti/JQueue.hs
> index e58905b..c5fd67e 100644
> --- a/src/Ganeti/JQueue.hs
> +++ b/src/Ganeti/JQueue.hs
> @@ -31,6 +31,7 @@ module Ganeti.JQueue
>      , InputOpCode(..)
>      , queuedOpCodeFromMetaOpCode
>      , queuedJobFromOpCodes
> +    , changeOpCodePriority
>      , cancelQueuedJob
>      , Timestamp
>      , fromClockTime
> @@ -214,6 +215,14 @@ queuedJobFromOpCodes jobid ops = do
>  setReceivedTimestamp :: Timestamp -> QueuedJob -> QueuedJob
>  setReceivedTimestamp ts job = job { qjReceivedTimestamp = Just ts }
>
> +-- | Change the priority of a QueuedOpCode, if it is not already
> +-- finalized.
> +changeOpCodePriority :: Int -> QueuedOpCode -> QueuedOpCode
> +changeOpCodePriority prio op =
> +  if qoStatus op > OP_STATUS_RUNNING
> +     then op
> +     else op { qoPriority = prio }
> +
>  -- | Set the state of a QueuedOpCode to canceled.
>  cancelOpCode :: Timestamp -> QueuedOpCode -> QueuedOpCode
>  cancelOpCode now op =
> --
> 1.9.0.rc1.175.g0b1dcb5
>
>

Reply via email to