add --size-limit option

When this option is not used, there should be effectively no added
overhead, thanks to the optimisation in
b3cd0cc6ba.

When an action fails on a file, the size of the file still counts toward
the size limit. This was necessary to support concurrency, but also
generally seems like the right choice.

Most commands that operate on annexed files support the option.
export and import do not, and I don't know if it would make sense for
export to.. Why would you want an incomplete export? sync doesn't, and
while it would be easy to make it support it for transferring files,
it's not clear if dropping files should also take the size limit into
account. Commands like add that don't operate on annexed files don't
support the option either.

Exiting 101 not yet implemented.

Sponsored-by: Denis Dzyubenko on Patreon
This commit is contained in:
Joey Hess 2021-06-04 16:08:42 -04:00
parent b3cd0cc6ba
commit 771a122c9e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 118 additions and 19 deletions

View file

@ -174,6 +174,7 @@ data AnnexState = AnnexState
, forcemincopies :: Maybe MinCopies
, limit :: ExpandableMatcher Annex
, timelimit :: Maybe (Duration, POSIXTime)
, sizelimit :: Maybe (TVar Integer)
, uuiddescmap :: Maybe UUIDDescMap
, preferredcontentmap :: Maybe (FileMatcherMap Annex)
, requiredcontentmap :: Maybe (FileMatcherMap Annex)
@ -232,6 +233,7 @@ newAnnexState c r = do
, forcemincopies = Nothing
, limit = BuildingMatcher []
, timelimit = Nothing
, sizelimit = Nothing
, uuiddescmap = Nothing
, preferredcontentmap = Nothing
, requiredcontentmap = Nothing