summaryrefslogtreecommitdiff
path: root/Logs/SingleValue.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Logs/SingleValue.hs')
-rw-r--r--Logs/SingleValue.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/Logs/SingleValue.hs b/Logs/SingleValue.hs
index 201e205eb..24242c83f 100644
--- a/Logs/SingleValue.hs
+++ b/Logs/SingleValue.hs
@@ -17,16 +17,16 @@ import Annex.Common
import qualified Annex.Branch
import Logs.TimeStamp
import Logs.Line
+import Annex.VectorClock
import qualified Data.Set as S
-import Data.Time.Clock.POSIX
class SingleValueSerializable v where
serialize :: v -> String
deserialize :: String -> Maybe v
data LogEntry v = LogEntry
- { changed :: POSIXTime
+ { changed :: VectorClock
, value :: v
} deriving (Eq, Show, Ord)
@@ -42,9 +42,9 @@ parseLog = S.fromList . mapMaybe parse . splitLines
where
parse line = do
let (ts, s) = splitword line
- date <- parsePOSIXTime ts
+ c <- VectorClock <$> parsePOSIXTime ts
v <- deserialize s
- Just (LogEntry date v)
+ Just (LogEntry c v)
splitword = separate (== ' ')
newestValue :: Log v -> Maybe v
@@ -60,6 +60,6 @@ getLog = newestValue <$$> readLog
setLog :: (SingleValueSerializable v) => FilePath -> v -> Annex ()
setLog f v = do
- now <- liftIO getPOSIXTime
- let ent = LogEntry now v
+ c <- liftIO currentVectorClock
+ let ent = LogEntry c v
Annex.Branch.change f $ \_old -> showLog (S.singleton ent)