add getExportedKey
Not optimised because that would need transition code to be written for existing export datbases.
This commit is contained in:
parent
138d07eb97
commit
b67fa2180e
1 changed files with 15 additions and 0 deletions
|
@ -19,6 +19,7 @@ module Database.Export (
|
||||||
addExportedLocation,
|
addExportedLocation,
|
||||||
removeExportedLocation,
|
removeExportedLocation,
|
||||||
getExportedLocation,
|
getExportedLocation,
|
||||||
|
getExportedKey,
|
||||||
isExportDirectoryEmpty,
|
isExportDirectoryEmpty,
|
||||||
getExportTreeCurrent,
|
getExportTreeCurrent,
|
||||||
recordExportTreeCurrent,
|
recordExportTreeCurrent,
|
||||||
|
@ -154,6 +155,20 @@ getExportedLocation (ExportHandle h _) k = H.queryDbQueue h $ do
|
||||||
where
|
where
|
||||||
ik = toIKey k
|
ik = toIKey k
|
||||||
|
|
||||||
|
{- Get the key that was exported to a location.
|
||||||
|
-
|
||||||
|
- Note that the database does not currently have an index to make this
|
||||||
|
- fast.
|
||||||
|
-
|
||||||
|
- Note that this does not see recently queued changes.
|
||||||
|
-}
|
||||||
|
getExportedKey :: ExportHandle -> ExportLocation -> IO [Key]
|
||||||
|
getExportedKey ExportHandle h _) el = H.queryDbQueue h $ do
|
||||||
|
l <- selectList [ExportedFile ==. ef] []
|
||||||
|
return $ map (fromSKey . exportedKey . entityVal) l
|
||||||
|
where
|
||||||
|
ef = toSFilePath (fromExportLocation el)
|
||||||
|
|
||||||
{- Note that this does not see recently queued changes. -}
|
{- Note that this does not see recently queued changes. -}
|
||||||
isExportDirectoryEmpty :: ExportHandle -> ExportDirectory -> IO Bool
|
isExportDirectoryEmpty :: ExportHandle -> ExportDirectory -> IO Bool
|
||||||
isExportDirectoryEmpty (ExportHandle h _) d = H.queryDbQueue h $ do
|
isExportDirectoryEmpty (ExportHandle h _) d = H.queryDbQueue h $ do
|
||||||
|
|
Loading…
Add table
Reference in a new issue