proxied exporttree=yes versionedexport=yes remotes are not untrusted
This removes versionedExport, which was only used by the S3 special remote. Instead, versionedexport=yes is a common way for remotes to indicate that they are versioned.
This commit is contained in:
parent
5c36177e58
commit
3ea835c7e8
16 changed files with 23 additions and 53 deletions
|
@ -44,6 +44,7 @@ import Annex.Transfer
|
||||||
import Annex.CheckIgnore
|
import Annex.CheckIgnore
|
||||||
import Annex.CatFile
|
import Annex.CatFile
|
||||||
import Annex.VectorClock
|
import Annex.VectorClock
|
||||||
|
import Annex.SpecialRemote.Config
|
||||||
import Command
|
import Command
|
||||||
import Backend
|
import Backend
|
||||||
import Types.Key
|
import Types.Key
|
||||||
|
@ -194,7 +195,7 @@ recordImportTree remote importtreeconfig imported = do
|
||||||
_ -> noop
|
_ -> noop
|
||||||
-- When the remote is versioned, it still contains keys
|
-- When the remote is versioned, it still contains keys
|
||||||
-- that are not present in the new tree.
|
-- that are not present in the new tree.
|
||||||
unless (Remote.versionedExport (Remote.exportActions remote)) $ do
|
unless (isVersioning (Remote.config remote)) $ do
|
||||||
db <- Export.openDb (Remote.uuid remote)
|
db <- Export.openDb (Remote.uuid remote)
|
||||||
forM_ (exportedTreeishes oldexport) $ \oldtree ->
|
forM_ (exportedTreeishes oldexport) $ \oldtree ->
|
||||||
Export.runExportDiffUpdater updater db oldtree finaltree
|
Export.runExportDiffUpdater updater db oldtree finaltree
|
||||||
|
|
|
@ -94,12 +94,18 @@ exportTreeField = Accepted "exporttree"
|
||||||
importTreeField :: RemoteConfigField
|
importTreeField :: RemoteConfigField
|
||||||
importTreeField = Accepted "importtree"
|
importTreeField = Accepted "importtree"
|
||||||
|
|
||||||
|
versioningField :: RemoteConfigField
|
||||||
|
versioningField = Accepted "versioning"
|
||||||
|
|
||||||
exportTree :: ParsedRemoteConfig -> Bool
|
exportTree :: ParsedRemoteConfig -> Bool
|
||||||
exportTree = fromMaybe False . getRemoteConfigValue exportTreeField
|
exportTree = fromMaybe False . getRemoteConfigValue exportTreeField
|
||||||
|
|
||||||
importTree :: ParsedRemoteConfig -> Bool
|
importTree :: ParsedRemoteConfig -> Bool
|
||||||
importTree = fromMaybe False . getRemoteConfigValue importTreeField
|
importTree = fromMaybe False . getRemoteConfigValue importTreeField
|
||||||
|
|
||||||
|
isVersioning :: ParsedRemoteConfig -> Bool
|
||||||
|
isVersioning = fromMaybe False . getRemoteConfigValue versioningField
|
||||||
|
|
||||||
annexObjectsField :: RemoteConfigField
|
annexObjectsField :: RemoteConfigField
|
||||||
annexObjectsField = Accepted "annexobjects"
|
annexObjectsField = Accepted "annexobjects"
|
||||||
|
|
||||||
|
|
|
@ -422,10 +422,10 @@ cleanupUnexport r db eks loc = do
|
||||||
removeExportedLocation db ek loc
|
removeExportedLocation db ek loc
|
||||||
flushDbQueue db
|
flushDbQueue db
|
||||||
|
|
||||||
-- A versionedExport remote supports removeExportLocation to remove
|
-- A versioned remote supports removeExportLocation to remove
|
||||||
-- the file from the exported tree, but still retains the content
|
-- the file from the exported tree, but still retains the content
|
||||||
-- and allows retrieving it.
|
-- and allows retrieving it.
|
||||||
unless (versionedExport (exportActions r)) $ do
|
unless (isVersioning (Remote.config r)) $ do
|
||||||
remaininglocs <- liftIO $
|
remaininglocs <- liftIO $
|
||||||
concat <$> forM eks (getExportedLocation db)
|
concat <$> forM eks (getExportedLocation db)
|
||||||
when (null remaininglocs) $
|
when (null remaininglocs) $
|
||||||
|
|
|
@ -91,7 +91,6 @@ gen r u rc gc rs = do
|
||||||
{ storeExport = storeExportM serial adir
|
{ storeExport = storeExportM serial adir
|
||||||
, retrieveExport = retrieveExportM serial adir
|
, retrieveExport = retrieveExportM serial adir
|
||||||
, removeExport = removeExportM serial adir
|
, removeExport = removeExportM serial adir
|
||||||
, versionedExport = False
|
|
||||||
, checkPresentExport = checkPresentExportM serial adir
|
, checkPresentExport = checkPresentExportM serial adir
|
||||||
, removeExportDirectory = Just $ removeExportDirectoryM serial adir
|
, removeExportDirectory = Just $ removeExportDirectoryM serial adir
|
||||||
, renameExport = Just $ renameExportM serial adir
|
, renameExport = Just $ renameExportM serial adir
|
||||||
|
|
|
@ -107,7 +107,6 @@ gen r u rc gc rs = do
|
||||||
{ storeExport = storeExportM dir cow
|
{ storeExport = storeExportM dir cow
|
||||||
, retrieveExport = retrieveExportM dir cow
|
, retrieveExport = retrieveExportM dir cow
|
||||||
, removeExport = removeExportM dir
|
, removeExport = removeExportM dir
|
||||||
, versionedExport = False
|
|
||||||
, checkPresentExport = checkPresentExportM dir
|
, checkPresentExport = checkPresentExportM dir
|
||||||
-- Not needed because removeExportLocation
|
-- Not needed because removeExportLocation
|
||||||
-- auto-removes empty directories.
|
-- auto-removes empty directories.
|
||||||
|
|
|
@ -95,7 +95,6 @@ gen rt externalprogram r u rc gc rs
|
||||||
{ storeExport = storeExportM external
|
{ storeExport = storeExportM external
|
||||||
, retrieveExport = retrieveExportM external
|
, retrieveExport = retrieveExportM external
|
||||||
, removeExport = removeExportM external
|
, removeExport = removeExportM external
|
||||||
, versionedExport = False
|
|
||||||
, checkPresentExport = checkPresentExportM external
|
, checkPresentExport = checkPresentExportM external
|
||||||
, removeExportDirectory = Just $ removeExportDirectoryM external
|
, removeExportDirectory = Just $ removeExportDirectoryM external
|
||||||
, renameExport = Just $ renameExportM external
|
, renameExport = Just $ renameExportM external
|
||||||
|
|
|
@ -84,6 +84,7 @@ remote = RemoteType
|
||||||
, configParser = mkRemoteConfigParser
|
, configParser = mkRemoteConfigParser
|
||||||
[ optionalStringParser locationField
|
[ optionalStringParser locationField
|
||||||
(FieldDesc "url of git remote to remember with special remote")
|
(FieldDesc "url of git remote to remember with special remote")
|
||||||
|
, yesNoParser versioningField (Just False) HiddenField
|
||||||
]
|
]
|
||||||
, setup = gitSetup
|
, setup = gitSetup
|
||||||
, exportSupported = exportUnsupported
|
, exportSupported = exportUnsupported
|
||||||
|
@ -230,7 +231,7 @@ gen r u rc gc rs
|
||||||
, readonly = Git.repoIsHttp r && not (isP2PHttp' gc)
|
, readonly = Git.repoIsHttp r && not (isP2PHttp' gc)
|
||||||
, appendonly = False
|
, appendonly = False
|
||||||
, untrustworthy = isJust (remoteAnnexProxiedBy gc)
|
, untrustworthy = isJust (remoteAnnexProxiedBy gc)
|
||||||
&& exportTree c
|
&& exportTree c && not (isVersioning c)
|
||||||
, availability = repoAvail r
|
, availability = repoAvail r
|
||||||
, remotetype = remote
|
, remotetype = remote
|
||||||
, mkUnavailable = unavailable r u rc gc rs
|
, mkUnavailable = unavailable r u rc gc rs
|
||||||
|
|
|
@ -42,7 +42,6 @@ instance HasExportUnsupported (ExportActions Annex) where
|
||||||
, retrieveExport = nope
|
, retrieveExport = nope
|
||||||
, checkPresentExport = \_ _ -> return False
|
, checkPresentExport = \_ _ -> return False
|
||||||
, removeExport = nope
|
, removeExport = nope
|
||||||
, versionedExport = False
|
|
||||||
, removeExportDirectory = nope
|
, removeExportDirectory = nope
|
||||||
, renameExport = Nothing
|
, renameExport = Nothing
|
||||||
}
|
}
|
||||||
|
@ -137,7 +136,6 @@ adjustExportImport' :: Bool -> Bool -> Bool -> Remote -> RemoteStateHandle -> Gi
|
||||||
adjustExportImport' isexport isimport annexobjects r rs gc = do
|
adjustExportImport' isexport isimport annexobjects r rs gc = do
|
||||||
dbv <- prepdbv
|
dbv <- prepdbv
|
||||||
ciddbv <- prepciddb
|
ciddbv <- prepciddb
|
||||||
let versioned = versionedExport (exportActions r)
|
|
||||||
return $ r
|
return $ r
|
||||||
{ exportActions = if isexport
|
{ exportActions = if isexport
|
||||||
then if isimport
|
then if isimport
|
||||||
|
@ -249,6 +247,8 @@ adjustExportImport' isexport isimport annexobjects r rs gc = do
|
||||||
else is'
|
else is'
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
versioned = isVersioning (config r)
|
||||||
|
|
||||||
thirdpartypopulated = thirdPartyPopulated (remotetype r)
|
thirdpartypopulated = thirdPartyPopulated (remotetype r)
|
||||||
|
|
||||||
-- exportActions adjusted to use the equivalent import actions,
|
-- exportActions adjusted to use the equivalent import actions,
|
||||||
|
@ -457,12 +457,12 @@ adjustExportImport' isexport isimport annexobjects r rs gc = do
|
||||||
_ -> throwM err
|
_ -> throwM err
|
||||||
| otherwise = a
|
| otherwise = a
|
||||||
|
|
||||||
-- versionedExport remotes have a key/value store which
|
-- versioned remotes have a key/value store which
|
||||||
-- the usual retrieveKeyFile can be used with, rather than
|
-- the usual retrieveKeyFile can be used with, rather than
|
||||||
-- an import/export variant. However, fall back to that
|
-- an import/export variant. However, fall back to that
|
||||||
-- if retrieveKeyFile fails.
|
-- if retrieveKeyFile fails.
|
||||||
supportversionedretrieve k af dest p vc a
|
supportversionedretrieve k af dest p vc a
|
||||||
| versionedExport (exportActions r) =
|
| versioned =
|
||||||
retrieveKeyFile r k af dest p vc
|
retrieveKeyFile r k af dest p vc
|
||||||
`catchNonAsync` const a
|
`catchNonAsync` const a
|
||||||
| otherwise = a
|
| otherwise = a
|
||||||
|
|
|
@ -79,7 +79,6 @@ gen r u rc gc rs = do
|
||||||
{ storeExport = cannotModify
|
{ storeExport = cannotModify
|
||||||
, retrieveExport = retriveExportHttpAlso url
|
, retrieveExport = retriveExportHttpAlso url
|
||||||
, removeExport = cannotModify
|
, removeExport = cannotModify
|
||||||
, versionedExport = False
|
|
||||||
, checkPresentExport = checkPresentExportHttpAlso url
|
, checkPresentExport = checkPresentExportHttpAlso url
|
||||||
, removeExportDirectory = Nothing
|
, removeExportDirectory = Nothing
|
||||||
, renameExport = cannotModify
|
, renameExport = cannotModify
|
||||||
|
|
|
@ -103,7 +103,6 @@ gen r u rc gc rs = do
|
||||||
{ storeExport = storeExportM o
|
{ storeExport = storeExportM o
|
||||||
, retrieveExport = retrieveExportM o
|
, retrieveExport = retrieveExportM o
|
||||||
, removeExport = removeExportM o
|
, removeExport = removeExportM o
|
||||||
, versionedExport = False
|
|
||||||
, checkPresentExport = checkPresentExportM o
|
, checkPresentExport = checkPresentExportM o
|
||||||
, removeExportDirectory = Just (removeExportDirectoryM o)
|
, removeExportDirectory = Just (removeExportDirectoryM o)
|
||||||
, renameExport = Just $ renameExportM o
|
, renameExport = Just $ renameExportM o
|
||||||
|
|
|
@ -144,9 +144,6 @@ storageclassField = Accepted "storageclass"
|
||||||
fileprefixField :: RemoteConfigField
|
fileprefixField :: RemoteConfigField
|
||||||
fileprefixField = Accepted "fileprefix"
|
fileprefixField = Accepted "fileprefix"
|
||||||
|
|
||||||
versioningField :: RemoteConfigField
|
|
||||||
versioningField = Accepted "versioning"
|
|
||||||
|
|
||||||
publicField :: RemoteConfigField
|
publicField :: RemoteConfigField
|
||||||
publicField = Accepted "public"
|
publicField = Accepted "public"
|
||||||
|
|
||||||
|
@ -224,7 +221,6 @@ gen r u rc gc rs = do
|
||||||
{ storeExport = storeExportS3 hdl this rs info magic
|
{ storeExport = storeExportS3 hdl this rs info magic
|
||||||
, retrieveExport = retrieveExportS3 hdl this info
|
, retrieveExport = retrieveExportS3 hdl this info
|
||||||
, removeExport = removeExportS3 hdl this rs info
|
, removeExport = removeExportS3 hdl this rs info
|
||||||
, versionedExport = versioning info
|
|
||||||
, checkPresentExport = checkPresentExportS3 hdl this info
|
, checkPresentExport = checkPresentExportS3 hdl this info
|
||||||
-- S3 does not have directories.
|
-- S3 does not have directories.
|
||||||
, removeExportDirectory = Nothing
|
, removeExportDirectory = Nothing
|
||||||
|
|
|
@ -101,7 +101,6 @@ gen r u rc gc rs = do
|
||||||
, retrieveExport = retrieveExportDav hdl
|
, retrieveExport = retrieveExportDav hdl
|
||||||
, checkPresentExport = checkPresentExportDav hdl this
|
, checkPresentExport = checkPresentExportDav hdl this
|
||||||
, removeExport = removeExportDav hdl
|
, removeExport = removeExportDav hdl
|
||||||
, versionedExport = False
|
|
||||||
, removeExportDirectory = Just $
|
, removeExportDirectory = Just $
|
||||||
removeExportDirectoryDav hdl
|
removeExportDirectoryDav hdl
|
||||||
, renameExport = Just $ renameExportDav hdl
|
, renameExport = Just $ renameExportDav hdl
|
||||||
|
|
|
@ -278,11 +278,6 @@ data ExportActions a = ExportActions
|
||||||
-- Can throw exception if unable to access remote, or if remote
|
-- Can throw exception if unable to access remote, or if remote
|
||||||
-- refuses to remove the content.
|
-- refuses to remove the content.
|
||||||
, removeExport :: Key -> ExportLocation -> a ()
|
, removeExport :: Key -> ExportLocation -> a ()
|
||||||
-- Set when the remote is versioned, so once a Key is stored
|
|
||||||
-- to an ExportLocation, a subsequent deletion of that
|
|
||||||
-- ExportLocation leaves the key still accessible to retrieveKeyFile
|
|
||||||
-- and checkPresent.
|
|
||||||
, versionedExport :: Bool
|
|
||||||
-- Removes an exported directory. Typically the directory will be
|
-- Removes an exported directory. Typically the directory will be
|
||||||
-- empty, but it could possibly contain files or other directories,
|
-- empty, but it could possibly contain files or other directories,
|
||||||
-- and it's ok to delete those (but not required to).
|
-- and it's ok to delete those (but not required to).
|
||||||
|
|
|
@ -189,8 +189,9 @@ the special remote can reply with `UNSUPPORTED-REQUEST`.
|
||||||
a list of settings with descriptions. Note that the user is not required
|
a list of settings with descriptions. Note that the user is not required
|
||||||
to provided all the settings listed here. A block of responses
|
to provided all the settings listed here. A block of responses
|
||||||
can be made to this, which must always end with `CONFIGEND`.
|
can be made to this, which must always end with `CONFIGEND`.
|
||||||
(Do not include settings like "encryption" that are common to all external
|
(Do not include config like "encryption" that are common to all external
|
||||||
special remotes.)
|
special remotes. Also avoid including a config named "versioning"
|
||||||
|
unless using it as desribed in the [[export_and_import_appendix]].)
|
||||||
* `CONFIG Name Description`
|
* `CONFIG Name Description`
|
||||||
Indicates the name and description of a config setting. The description
|
Indicates the name and description of a config setting. The description
|
||||||
should be reasonably short. Example:
|
should be reasonably short. Example:
|
||||||
|
|
|
@ -153,13 +153,6 @@ support a request, it can reply with `UNSUPPORTED-REQUEST`.
|
||||||
Indicates that `IMPORTKEY` can be used.
|
Indicates that `IMPORTKEY` can be used.
|
||||||
* `IMPORTKEYSUPPORTED-FAILURE`
|
* `IMPORTKEYSUPPORTED-FAILURE`
|
||||||
Indicates that `IMPORTKEY` cannot be used.
|
Indicates that `IMPORTKEY` cannot be used.
|
||||||
* `VERSIONED`
|
|
||||||
Used to check if the special remote is versioned.
|
|
||||||
Note that this request may be made before or after `PREPARE`.
|
|
||||||
* `ISVERSIONED`
|
|
||||||
Indicates that the remote is versioned.
|
|
||||||
* `NOTVERSIONED`
|
|
||||||
Indicates that the remote is not versioned.
|
|
||||||
* `LISTIMPORTABLECONTENTS`
|
* `LISTIMPORTABLECONTENTS`
|
||||||
Used to get a list of all the files that are stored in the special
|
Used to get a list of all the files that are stored in the special
|
||||||
remote. A block of responses
|
remote. A block of responses
|
||||||
|
@ -178,10 +171,9 @@ support a request, it can reply with `UNSUPPORTED-REQUEST`.
|
||||||
block of responses. This can be repeated any number of times
|
block of responses. This can be repeated any number of times
|
||||||
(indicating a branching history), and histories can also
|
(indicating a branching history), and histories can also
|
||||||
be nested multiple levels deep.
|
be nested multiple levels deep.
|
||||||
This should only be used when the remote supports using
|
This should only be a response when the remote supports using
|
||||||
"TRANSFER RECEIVE Key" to retrieve historical versions of files.
|
"TRANSFER RECEIVE Key" to retrieve historical versions of files,
|
||||||
And, it should only be used when the remote replies `ISVERSIONED`
|
and when "GETCONFIG versioning" yields "VALUE TRUE".
|
||||||
to the `VERSIONED` message.
|
|
||||||
* `END`
|
* `END`
|
||||||
Indicates the end of a block of responses.
|
Indicates the end of a block of responses.
|
||||||
* `LOCATION Name`
|
* `LOCATION Name`
|
||||||
|
|
|
@ -33,22 +33,6 @@ Planned schedule of work:
|
||||||
* Working on `exportreeplus` branch which is groundwork for proxying to
|
* Working on `exportreeplus` branch which is groundwork for proxying to
|
||||||
exporttree=yes special remotes. Need to merge it to master.
|
exporttree=yes special remotes. Need to merge it to master.
|
||||||
|
|
||||||
* Versioned exports are not untrustworthy. But checking that for a proxied
|
|
||||||
remote would need to construct a Remote using the special remote's config.
|
|
||||||
|
|
||||||
For eg S3 (the only versioned one currently), that would need the S3
|
|
||||||
creds to be set in the environment.
|
|
||||||
|
|
||||||
For an external special remote that uses the (currently draft) extension,
|
|
||||||
the program would need to be installed to check how it responds to
|
|
||||||
VERSIONED.
|
|
||||||
|
|
||||||
Constructing a special remote in order to use it proxied does not seem
|
|
||||||
feasible.
|
|
||||||
|
|
||||||
versionedExport could be changed be a pure function from
|
|
||||||
ParsedRemoteConfig. But that would not help with external special remotes.
|
|
||||||
|
|
||||||
## completed items for August
|
## completed items for August
|
||||||
|
|
||||||
* Special remotes configured with exporttree=yes annexobjects=yes
|
* Special remotes configured with exporttree=yes annexobjects=yes
|
||||||
|
|
Loading…
Reference in a new issue