initial try at using storeExportWithContentIdentifier

Untested, and I'm not sure about the locking of the ContentIdentifier db.
This commit is contained in:
Joey Hess 2019-03-04 17:50:41 -04:00
parent b67fa2180e
commit cd3a2b023a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 96 additions and 56 deletions

View file

@ -20,6 +20,7 @@ module Database.ContentIdentifier (
closeDb,
flushDbQueue,
recordContentIdentifier,
getContentIdentifiers,
getContentIdentifierKeys,
ContentIdentifiersId,
) where
@ -82,11 +83,8 @@ recordContentIdentifier h u cid k = queueDb h $ do
getContentIdentifiers :: ContentIdentifierHandle -> UUID -> Key -> IO [ContentIdentifier]
getContentIdentifiers (ContentIdentifierHandle h) u k = H.queryDbQueue h $ do
l <- selectList
[ ContentIdentifiersCid ==. cid
, ContentIdentifiersKey ==. toSKey k
] []
return $ map (ContentIdentifiersCid . entityVal) l
l <- selectList [ContentIdentifiersKey ==. toSKey k] []
return $ map (contentIdentifiersCid . entityVal) l
getContentIdentifierKeys :: ContentIdentifierHandle -> UUID -> ContentIdentifier -> IO [Key]
getContentIdentifierKeys (ContentIdentifierHandle h) u cid =

View file

@ -163,9 +163,9 @@ getExportedLocation (ExportHandle h _) k = H.queryDbQueue h $ do
- Note that this does not see recently queued changes.
-}
getExportedKey :: ExportHandle -> ExportLocation -> IO [Key]
getExportedKey ExportHandle h _) el = H.queryDbQueue h $ do
getExportedKey (ExportHandle h _) el = H.queryDbQueue h $ do
l <- selectList [ExportedFile ==. ef] []
return $ map (fromSKey . exportedKey . entityVal) l
return $ map (fromIKey . exportedKey . entityVal) l
where
ef = toSFilePath (fromExportLocation el)