change to more efficient IKey

This commit is contained in:
Joey Hess 2019-03-06 11:14:33 -04:00
parent 0db393d82f
commit f85f06aae3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -41,7 +41,7 @@ share [mkPersist sqlSettings, mkMigrate "migrateContentIdentifier"] [persistLowe
ContentIdentifiers
remote UUID
cid ContentIdentifier
key SKey
key IKey
ContentIdentifiersIndexRemoteKey remote key
ContentIdentifiersIndexRemoteCID remote cid
UniqueRemoteCidKey remote cid key
@ -79,12 +79,12 @@ flushDbQueue (ContentIdentifierHandle h) = H.flushDbQueue h
-- Be sure to also update the git-annex branch when using this.
recordContentIdentifier :: ContentIdentifierHandle -> UUID -> ContentIdentifier -> Key -> IO ()
recordContentIdentifier h u cid k = queueDb h $ do
void $ insertUnique $ ContentIdentifiers u cid (toSKey k)
void $ insertUnique $ ContentIdentifiers u cid (toIKey k)
getContentIdentifiers :: ContentIdentifierHandle -> UUID -> Key -> IO [ContentIdentifier]
getContentIdentifiers (ContentIdentifierHandle h) u k = H.queryDbQueue h $ do
l <- selectList
[ ContentIdentifiersKey ==. toSKey k
[ ContentIdentifiersKey ==. toIKey k
, ContentIdentifiersRemote ==. u
] []
return $ map (contentIdentifiersCid . entityVal) l
@ -96,4 +96,4 @@ getContentIdentifierKeys (ContentIdentifierHandle h) u cid =
[ ContentIdentifiersCid ==. cid
, ContentIdentifiersRemote ==. u
] []
return $ map (fromSKey . contentIdentifiersKey . entityVal) l
return $ map (fromIKey . contentIdentifiersKey . entityVal) l