Revert "cache the serialization of a Key"

This reverts commit 4536c93bb2.

That broke Read/Show of a Key, and unfortunately Key is read in at least
one place; the GitAnnexDistribution data type.

It would be worth bringing this optimisation back, but it would need
either a custom Read/Show instance that preserves back-compat, or
wrapping Key in a data type that contains the serialization, or changing
how GitAnnexDistribution is serialized.

Also, the Eq instance would need to compare keys with and without a
cached seralization the same.
This commit is contained in:
Joey Hess 2019-01-16 16:09:53 -04:00
parent 863ed51ae0
commit 96aba8eff7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
12 changed files with 19 additions and 52 deletions

View file

@ -181,7 +181,6 @@ trivialMigrate' oldkey newbackend afile maxextlen
| migratable && hasExt oldvariety = Just $ oldkey
{ keyName = keyHash oldkey
, keyVariety = newvariety
, keySerialization = Nothing
}
{- Fast migration from hash to hashE backend. -}
| migratable && hasExt newvariety = case afile of
@ -190,7 +189,6 @@ trivialMigrate' oldkey newbackend afile maxextlen
{ keyName = keyHash oldkey
<> encodeBS (selectExtension maxextlen file)
, keyVariety = newvariety
, keySerialization = Nothing
}
{- Upgrade to fix bad previous migration that created a
- non-extension preserving key, with an extension
@ -198,7 +196,6 @@ trivialMigrate' oldkey newbackend afile maxextlen
| newvariety == oldvariety && not (hasExt oldvariety) &&
keyHash oldkey /= keyName oldkey = Just $ oldkey
{ keyName = keyHash oldkey
, keySerialization = Nothing
}
| otherwise = Nothing
where
@ -291,8 +288,5 @@ testKeyBackend =
let b = genBackendE (SHA2Hash (HashSize 256))
in b { getKey = (fmap addE) <$$> getKey b }
where
addE k = k
{ keyName = keyName k <> longext
, keySerialization = Nothing
}
addE k = k { keyName = keyName k <> longext }
longext = ".this-is-a-test-key"