better archive directory handling

Adjust preferred content expressions so that content in archive directories
is preferred until it has reached an archive or smallarchive repository.
This commit is contained in:
Joey Hess 2013-04-06 18:29:52 -04:00
parent 0a77d4b716
commit 84de4a14ad
4 changed files with 28 additions and 18 deletions

View file

@ -55,21 +55,22 @@ descStandardGroup UnwantedGroup = "unwanted: remove content from this repository
{- See doc/preferred_content.mdwn for explanations of these expressions. -}
preferredContent :: StandardGroup -> String
preferredContent ClientGroup = lastResort
"exclude=*/archive/* and exclude=archive/*"
preferredContent TransferGroup = lastResort
"not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup
preferredContent ClientGroup = lastResort $
"(exclude=*/archive/* and exclude=archive/*) or (" ++ notArchived ++ ")"
preferredContent TransferGroup = lastResort $
"not (inallgroup=client and copies=client:2) and (" ++ preferredContent ClientGroup ++ ")"
preferredContent BackupGroup = "include=*"
preferredContent IncrementalBackupGroup = lastResort
preferredContent IncrementalBackupGroup = lastResort $
"include=* and (not copies=incrementalbackup:1)"
preferredContent SmallArchiveGroup = lastResort $
"(include=*/archive/* or include=archive/*) and " ++ preferredContent FullArchiveGroup
preferredContent FullArchiveGroup = lastResort
"not (copies=archive:1 or copies=smallarchive:1)"
"(include=*/archive/* or include=archive/*) and (" ++ preferredContent FullArchiveGroup ++ ")"
preferredContent FullArchiveGroup = lastResort notArchived
preferredContent SourceGroup = "not (copies=1)"
preferredContent ManualGroup = lastResort
"present and exclude=*/archive/* and exclude=archive/*"
preferredContent ManualGroup = "present and (" ++ preferredContent ClientGroup ++ ")"
preferredContent UnwantedGroup = "exclude=*"
notArchived :: String
notArchived = "not (copies=archive:1 or copies=smallarchive:1)"
{- Most repositories want any content that is only on untrusted
- or dead repositories. -}

3
debian/changelog vendored
View file

@ -6,6 +6,9 @@ git-annex (4.20130406) UNRELEASED; urgency=low
remotes, to avoid delays.
Thanks, guilhem for the patch.
* Bugfix: Direct mode no longer repeatedly checksums duplicated files.
* Adjust preferred content expressions so that content in archive
directories is preferred until it has reached an archive or smallarchive
repository.
-- Joey Hess <joeyh@debian.org> Sat, 06 Apr 2013 15:24:15 -0400

View file

@ -86,9 +86,10 @@ any repository that can will back it up.)
### client
All content is preferred, unless it's in a "archive" directory.
All content is preferred, unless it's for a file in a "archive" directory,
which has reached an archive repository.
`(exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted+:1)`
`((exclude=*/archive/* and exclude=archive/*) or (not (copies=archive:1 or copies=smallarchive:1))) or (not copies=semitrusted+:1)`
### transfer
@ -100,7 +101,7 @@ USB drive used in a sneakernet.
The preferred content expression for these causes them to get and retain
data until all clients have a copy.
`(not (inallgroup=client and copies=client:2) and exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted+:1)`
`(not (inallgroup=client and copies=client:2) and ($client)`
The "copies=client:2" part of the above handles the case where
there is only one client repository. It makes a transfer repository
@ -152,15 +153,18 @@ data until a copy has been sent to some other repository.
### manual
This gives you full manual control over what content is stored in the
This gives you nearly full manual control over what content is stored in the
repository. This allows using the [[assistant]] without it trying to keep a
local copy of every file. Instead, you can manually run `git annex get`,
`git annex drop`, etc to manage content.
`git annex drop`, etc to manage content. Only content that is present
is preferred.
Only content that is present is preferred. Content in "archive"
directories is never preferred.
The exception to this manual control is that content that a client
repository would not want is not preferred. So, files in archive
directories are not preferred once their content has
reached an archive repository.
`(present and exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted+:1)`
`present and ($client)`
### unwanted

View file

@ -27,3 +27,5 @@ Something vaguely like this should work as the preferred content
expression for the clients:
exclude=archive/* or (include=archive/* and (not (copies=archive:1 or copies=smallarchive:1)))
> [[done]] --[[Joey]]