make DropDead transition minimize remote.log for dead sameas remotes

All that needs to be retained in remote.log is the sameas-uuid.
The rest of the config is eliminated. This doesn't save enough space to
bother with, but it prevents anything sensitive in the config of the
dead sameas remote from lingering around.

Note that minimizesameasdead does not update the VectorClock when
changing the log line. That's normally a no-no, but in this case,
it makes each DropDead result in the exact same file contents,
and vector clocks are not needed because the transition breaks
the history chain.
This commit is contained in:
Joey Hess 2019-10-15 11:33:33 -04:00
parent 78f522e7c8
commit ce48eb797c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 29 additions and 14 deletions

View file

@ -26,16 +26,15 @@ import Logs.Remote.Pure
import Annex.SpecialRemote.Config
import qualified Data.Map as M
import Data.ByteString.Builder
{- Adds or updates a remote's config in the log. -}
configSet :: UUID -> RemoteConfig -> Annex ()
configSet u cfg = do
c <- liftIO currentVectorClock
Annex.Branch.change remoteLog $
buildLogOld (byteString . encodeBS . showConfig)
buildRemoteConfigLog
. changeLog c u (removeSameasInherited cfg)
. parseLogOld remoteConfigParser
. parseRemoteConfigLog
{- Map of remotes by uuid containing key/value config maps. -}
readRemoteLog :: Annex (M.Map UUID RemoteConfig)