add annex-proxied
This makes git-annex sync and similar not treat proxied remotes as git syncable remotes. Also, display in git-annex info remote when the remote is proxied.
This commit is contained in:
parent
0c111fc96a
commit
b8016eeb65
7 changed files with 31 additions and 14 deletions
|
@ -1158,7 +1158,3 @@ splitRemoteAnnexTrackingBranchSubdir tb = (branch, subdir)
|
||||||
subdir = if S.null p
|
subdir = if S.null p
|
||||||
then Nothing
|
then Nothing
|
||||||
else Just (asTopFilePath p)
|
else Just (asTopFilePath p)
|
||||||
|
|
||||||
sameGitRepo :: Remote -> Remote -> Bool
|
|
||||||
sameGitRepo x y =
|
|
||||||
remoteUrl (Remote.gitconfig x) == remoteUrl (Remote.gitconfig y)
|
|
||||||
|
|
|
@ -449,11 +449,13 @@ claimingUrl' remotefilter url = do
|
||||||
checkclaim = maybe (pure False) (`id` url) . claimUrl
|
checkclaim = maybe (pure False) (`id` url) . claimUrl
|
||||||
|
|
||||||
{- Is this a remote of a type that git pull and push work with?
|
{- Is this a remote of a type that git pull and push work with?
|
||||||
- That includes special remotes with an annex:: url configured. -}
|
- That includes special remotes with an annex:: url configured.
|
||||||
|
- It does not include proxied remotes. -}
|
||||||
gitSyncableRemote :: Remote -> Bool
|
gitSyncableRemote :: Remote -> Bool
|
||||||
gitSyncableRemote r
|
gitSyncableRemote r
|
||||||
| gitSyncableRemoteType (remotetype r)
|
| gitSyncableRemoteType (remotetype r)
|
||||||
&& isJust (remoteUrl (gitconfig r)) = True
|
&& isJust (remoteUrl (gitconfig r)) =
|
||||||
|
not (remoteAnnexProxied (gitconfig r))
|
||||||
| otherwise = case remoteUrl (gitconfig r) of
|
| otherwise = case remoteUrl (gitconfig r) of
|
||||||
Just u | "annex::" `isPrefixOf` u -> True
|
Just u | "annex::" `isPrefixOf` u -> True
|
||||||
_ -> False
|
_ -> False
|
||||||
|
|
|
@ -827,7 +827,8 @@ listProxied proxies rs = concat <$> mapM go rs
|
||||||
|
|
||||||
annexconfigadjuster r' =
|
annexconfigadjuster r' =
|
||||||
let c = adduuid (configRepoUUID renamedr) $
|
let c = adduuid (configRepoUUID renamedr) $
|
||||||
addurl (remoteConfig renamedr "url") $
|
addurl $
|
||||||
|
addproxied $
|
||||||
inheritconfigs $ Git.fullconfig r'
|
inheritconfigs $ Git.fullconfig r'
|
||||||
in r'
|
in r'
|
||||||
{ Git.config = M.map Prelude.head c
|
{ Git.config = M.map Prelude.head c
|
||||||
|
@ -837,9 +838,12 @@ listProxied proxies rs = concat <$> mapM go rs
|
||||||
adduuid ck = M.insert ck
|
adduuid ck = M.insert ck
|
||||||
[Git.ConfigValue $ fromUUID $ proxyRemoteUUID p]
|
[Git.ConfigValue $ fromUUID $ proxyRemoteUUID p]
|
||||||
|
|
||||||
addurl ck = M.insert ck
|
addurl = M.insert (remoteConfig renamedr "url")
|
||||||
[Git.ConfigValue $ encodeBS $ Git.repoLocation r]
|
[Git.ConfigValue $ encodeBS $ Git.repoLocation r]
|
||||||
|
|
||||||
|
addproxied = M.insert (remoteAnnexConfig renamedr "proxied")
|
||||||
|
[Git.ConfigValue $ Git.Config.boolConfig' True]
|
||||||
|
|
||||||
inheritconfigs c = foldl' inheritconfig c proxyInheritedFields
|
inheritconfigs c = foldl' inheritconfig c proxyInheritedFields
|
||||||
|
|
||||||
inheritconfig c k = case (M.lookup dest c, M.lookup src c) of
|
inheritconfig c k = case (M.lookup dest c, M.lookup src c) of
|
||||||
|
|
|
@ -64,5 +64,7 @@ gitRepoInfo r = do
|
||||||
repo <- Remote.getRepo r
|
repo <- Remote.getRepo r
|
||||||
return
|
return
|
||||||
[ ("repository location", Git.repoLocation repo)
|
[ ("repository location", Git.repoLocation repo)
|
||||||
|
, ("proxied", Git.Config.boolConfig
|
||||||
|
(remoteAnnexProxied (Remote.gitconfig r)))
|
||||||
, ("last synced", lastsynctime)
|
, ("last synced", lastsynctime)
|
||||||
]
|
]
|
||||||
|
|
|
@ -388,6 +388,7 @@ data RemoteGitConfig = RemoteGitConfig
|
||||||
, remoteAnnexMaxGitBundles :: Int
|
, remoteAnnexMaxGitBundles :: Int
|
||||||
, remoteAnnexAllowEncryptedGitRepo :: Bool
|
, remoteAnnexAllowEncryptedGitRepo :: Bool
|
||||||
, remoteAnnexProxy :: Bool
|
, remoteAnnexProxy :: Bool
|
||||||
|
, remoteAnnexProxied :: Bool
|
||||||
, remoteAnnexClusterNode :: Maybe [RemoteName]
|
, remoteAnnexClusterNode :: Maybe [RemoteName]
|
||||||
, remoteUrl :: Maybe String
|
, remoteUrl :: Maybe String
|
||||||
|
|
||||||
|
@ -474,6 +475,7 @@ extractRemoteGitConfig r remotename = do
|
||||||
, remoteAnnexAllowEncryptedGitRepo =
|
, remoteAnnexAllowEncryptedGitRepo =
|
||||||
getbool AllowEncryptedGitRepoField False
|
getbool AllowEncryptedGitRepoField False
|
||||||
, remoteAnnexProxy = getbool ProxyField False
|
, remoteAnnexProxy = getbool ProxyField False
|
||||||
|
, remoteAnnexProxied = getbool ProxiedField False
|
||||||
, remoteAnnexClusterNode =
|
, remoteAnnexClusterNode =
|
||||||
(filter isLegalName . words)
|
(filter isLegalName . words)
|
||||||
<$> getmaybe ClusterNodeField
|
<$> getmaybe ClusterNodeField
|
||||||
|
@ -554,6 +556,7 @@ data RemoteGitConfigField
|
||||||
| MaxGitBundlesField
|
| MaxGitBundlesField
|
||||||
| AllowEncryptedGitRepoField
|
| AllowEncryptedGitRepoField
|
||||||
| ProxyField
|
| ProxyField
|
||||||
|
| ProxiedField
|
||||||
| ClusterNodeField
|
| ClusterNodeField
|
||||||
| UrlField
|
| UrlField
|
||||||
| ShellField
|
| ShellField
|
||||||
|
@ -619,6 +622,7 @@ remoteGitConfigField = \case
|
||||||
AllowEncryptedGitRepoField -> inherited "allow-encrypted-gitrepo"
|
AllowEncryptedGitRepoField -> inherited "allow-encrypted-gitrepo"
|
||||||
-- Allow proxy chains.
|
-- Allow proxy chains.
|
||||||
ProxyField -> inherited "proxy"
|
ProxyField -> inherited "proxy"
|
||||||
|
ProxiedField -> uninherited "proxied"
|
||||||
ClusterNodeField -> uninherited "cluster-node"
|
ClusterNodeField -> uninherited "cluster-node"
|
||||||
UrlField -> uninherited "url"
|
UrlField -> uninherited "url"
|
||||||
ShellField -> inherited "shell"
|
ShellField -> inherited "shell"
|
||||||
|
|
|
@ -1674,6 +1674,15 @@ Remotes are configured using these settings in `.git/config`.
|
||||||
After configuring this, run [[git-annex-updateproxy](1) to store
|
After configuring this, run [[git-annex-updateproxy](1) to store
|
||||||
the new configuration in the git-annex branch.
|
the new configuration in the git-annex branch.
|
||||||
|
|
||||||
|
* `remote.<name>.annex-proxied`
|
||||||
|
|
||||||
|
Setting this to "true" indicates that a remote is proxied via the
|
||||||
|
git-annex repository that its remote points to. That prevents commands
|
||||||
|
like `git-annex sync` from pulling and pushing the remote.
|
||||||
|
|
||||||
|
Usually this is used internally, when git-annex sets up proxied remotes,
|
||||||
|
and will not need to be set.
|
||||||
|
|
||||||
* `remote.<name>.annex-cluster-node`
|
* `remote.<name>.annex-cluster-node`
|
||||||
|
|
||||||
Set to the name of a cluster to make this remote be part of
|
Set to the name of a cluster to make this remote be part of
|
||||||
|
|
|
@ -26,17 +26,17 @@ In development on the `proxy` branch.
|
||||||
|
|
||||||
For June's work on [[design/passthrough_proxy]], remaining todos:
|
For June's work on [[design/passthrough_proxy]], remaining todos:
|
||||||
|
|
||||||
* `git-annex sync` etc should not treat clusters as git syncable remotes.
|
* On upload to cluster, send to nodes where it's preferred content, and not
|
||||||
|
to other nodes.
|
||||||
|
|
||||||
* `git-annex sync` etc, when operating on clusters, should first
|
* `git-annex sync --content` etc, when operating on clusters, should first
|
||||||
operate on the cluster as a whole, to take advantages of fanout on upload
|
operate on the cluster as a whole, to take advantages of fanout on upload
|
||||||
and mass drop. Only operate on individual cluster nodes afterwards,
|
and mass drop. Only operate on individual cluster nodes afterwards,
|
||||||
to handle cases such as a cluster containing a key, but some node
|
to handle cases such as a cluster containing a key, but some node
|
||||||
wanting and lacking the key. Perhaps just setting cost for nodes slightly
|
wanting and lacking the key. Perhaps just setting cost for nodes slightly
|
||||||
higher than the cluster cost will be enough?
|
higher than the cluster cost will be enough? Or should it even send a key
|
||||||
|
to a cluster node if the cluster contains the key? Perhaps that is
|
||||||
* On upload to cluster, send to nodes where it's preferred content, and not
|
unnecessary work, the cluster should be able to rebalance itself.
|
||||||
to other nodes.
|
|
||||||
|
|
||||||
* Getting a key from a cluster currently always selects the lowest cost
|
* Getting a key from a cluster currently always selects the lowest cost
|
||||||
remote, and always the same remote if cost is the same. Should
|
remote, and always the same remote if cost is the same. Should
|
||||||
|
|
Loading…
Reference in a new issue