avoid building unused bloomfilter when run without --all
This commit is contained in:
parent
5b801fcad9
commit
be9d9cb5ad
1 changed files with 7 additions and 3 deletions
|
@ -379,7 +379,10 @@ newer remote b = do
|
||||||
seekSyncContent :: [Remote] -> Annex Bool
|
seekSyncContent :: [Remote] -> Annex Bool
|
||||||
seekSyncContent rs = do
|
seekSyncContent rs = do
|
||||||
mvar <- liftIO newEmptyMVar
|
mvar <- liftIO newEmptyMVar
|
||||||
bloom <- genBloomFilter (seekworktree mvar [])
|
bloom <- ifM (Annex.getFlag "all")
|
||||||
|
( Just <$> genBloomFilter (seekworktree mvar [])
|
||||||
|
, seekworktree mvar [] (const noop) >> pure Nothing
|
||||||
|
)
|
||||||
withKeyOptions' False (seekkeys mvar bloom) (const noop) []
|
withKeyOptions' False (seekkeys mvar bloom) (const noop) []
|
||||||
liftIO $ not <$> isEmptyMVar mvar
|
liftIO $ not <$> isEmptyMVar mvar
|
||||||
where
|
where
|
||||||
|
@ -391,7 +394,7 @@ seekSyncContent rs = do
|
||||||
void $ liftIO $ tryPutMVar mvar ()
|
void $ liftIO $ tryPutMVar mvar ()
|
||||||
syncFile ebloom rs af k
|
syncFile ebloom rs af k
|
||||||
|
|
||||||
syncFile :: Either (Bloom Key) (Key -> Annex ()) -> [Remote] -> AssociatedFile -> Key -> Annex ()
|
syncFile :: Either (Maybe (Bloom Key)) (Key -> Annex ()) -> [Remote] -> AssociatedFile -> Key -> Annex ()
|
||||||
syncFile ebloom rs af k = do
|
syncFile ebloom rs af k = do
|
||||||
locs <- loggedLocations k
|
locs <- loggedLocations k
|
||||||
let (have, lack) = partition (\r -> Remote.uuid r `elem` locs) rs
|
let (have, lack) = partition (\r -> Remote.uuid r `elem` locs) rs
|
||||||
|
@ -411,7 +414,8 @@ syncFile ebloom rs af k = do
|
||||||
-- When there's a false positive in the bloom filter, the result
|
-- When there's a false positive in the bloom filter, the result
|
||||||
-- is keeping a key that preferred content doesn't really want.
|
-- is keeping a key that preferred content doesn't really want.
|
||||||
seenbloom <- case ebloom of
|
seenbloom <- case ebloom of
|
||||||
Left bloom -> pure (elemB k bloom)
|
Left Nothing -> pure False
|
||||||
|
Left (Just bloom) -> pure (elemB k bloom)
|
||||||
Right bloomfeeder -> bloomfeeder k >> return False
|
Right bloomfeeder -> bloomfeeder k >> return False
|
||||||
unless seenbloom $
|
unless seenbloom $
|
||||||
-- Using callCommandAction rather than
|
-- Using callCommandAction rather than
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue