Each for each metadata field, there's now an automatically maintained "$field-lastchanged" that gives the timestamp of the last change to that field.

Note that this is a nearly entirely free feature. The data was already
stored in the metadata log in an easily accessible way, and already was
parsed to a time when parsing the log. The generation of the metadata
fields may even be done lazily, although probably not entirely (the map
has to be evaulated to when queried).
This commit is contained in:
Joey Hess 2014-03-18 18:55:43 -04:00
parent fa641dad2d
commit caa97d1271
8 changed files with 94 additions and 23 deletions

View file

@ -28,6 +28,7 @@ module Types.MetaData (
emptyMetaData,
updateMetaData,
unionMetaData,
combineMetaData,
differenceMetaData,
isSet,
currentMetaData,
@ -188,6 +189,9 @@ unionMetaData :: MetaData -> MetaData -> MetaData
unionMetaData (MetaData old) (MetaData new) = MetaData $
M.unionWith S.union new old
combineMetaData :: [MetaData] -> MetaData
combineMetaData = foldl' unionMetaData emptyMetaData
differenceMetaData :: MetaData -> MetaData -> MetaData
differenceMetaData (MetaData m) (MetaData excludem) = MetaData $
M.differenceWith diff m excludem