Revision d546d209
b/src/Ganeti/WConfd/ConfigState.hs | ||
---|---|---|
1 |
{-# LANGUAGE TemplateHaskell #-} |
|
2 |
|
|
1 | 3 |
{-| Pure functions for manipulating the configuration state. |
2 | 4 |
|
3 | 5 |
-} |
... | ... | |
26 | 28 |
module Ganeti.WConfd.ConfigState |
27 | 29 |
( ConfigState |
28 | 30 |
, csConfigData |
31 |
, csConfigDataL |
|
29 | 32 |
, mkConfigState |
33 |
, bumpSerial |
|
30 | 34 |
, needsFullDist |
31 | 35 |
) where |
32 | 36 |
|
33 | 37 |
import Control.Applicative |
34 | 38 |
import Data.Function (on) |
39 |
import System.Time (ClockTime(..)) |
|
35 | 40 |
|
41 |
import Ganeti.Lens |
|
36 | 42 |
import Ganeti.Objects |
43 |
import Ganeti.Objects.Lens |
|
37 | 44 |
|
38 | 45 |
-- | In future this data type will include the current configuration |
39 | 46 |
-- ('ConfigData') and the last 'FStat' of its file. |
... | ... | |
42 | 49 |
} |
43 | 50 |
deriving (Eq, Show) |
44 | 51 |
|
52 |
$(makeCustomLenses ''ConfigState) |
|
53 |
|
|
45 | 54 |
-- | Creates a new configuration state. |
46 | 55 |
-- This method will expand as more fields are added to 'ConfigState'. |
47 | 56 |
mkConfigState :: ConfigData -> ConfigState |
48 | 57 |
mkConfigState = ConfigState |
49 | 58 |
|
59 |
bumpSerial :: (SerialNoObjectL a, TimeStampObjectL a) => ClockTime -> a -> a |
|
60 |
bumpSerial now = set mTimeL now . over serialL succ |
|
61 |
|
|
50 | 62 |
-- | Given two versions of the configuration, determine if its distribution |
51 | 63 |
-- needs to be fully commited before returning the corresponding call to |
52 | 64 |
-- WConfD. |
Also available in: Unified diff