add lockContentShared
Also, rename lockContent to lockContentExclusive inAnnexSafe should perhaps be eliminated, and instead use `lockContentShared inAnnex`. However, I'm waiting on that, as there are only 2 call sites for inAnnexSafe and it's fiddly.
This commit is contained in:
parent
f52d4b684d
commit
4d50958ed7
11 changed files with 100 additions and 50 deletions
|
@ -88,12 +88,12 @@ startRemote afile numcopies key remote = do
|
|||
showStart' ("drop " ++ Remote.name remote) key afile
|
||||
next $ performRemote key afile numcopies remote
|
||||
|
||||
-- Note that lockContent is called before checking if the key is present
|
||||
-- on enough remotes to allow removal. This avoids a scenario where two
|
||||
-- Note that lockContentExclusive is called before checking if the key is
|
||||
-- present on enough remotes to allow removal. This avoids a scenario where two
|
||||
-- or more remotes are trying to remove a key at the same time, and each
|
||||
-- see the key is present on the other.
|
||||
performLocal :: Key -> AssociatedFile -> NumCopies -> Maybe Remote -> CommandPerform
|
||||
performLocal key afile numcopies knownpresentremote = lockContent key $ \contentlock -> do
|
||||
performLocal key afile numcopies knownpresentremote = lockContentExclusive key $ \contentlock -> do
|
||||
(remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key
|
||||
let trusteduuids' = case knownpresentremote of
|
||||
Nothing -> trusteduuids
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue