Merge branch 'master' into proxy-specialremotes

This commit is contained in:
Joey Hess 2024-06-30 11:16:20 -04:00
commit f833a28844
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 36 additions and 10 deletions

View file

@ -1,6 +1,6 @@
{- Utilities for git remotes. {- Utilities for git remotes.
- -
- Copyright 2011-2014 Joey Hess <id@joeyh.name> - Copyright 2011-2024 Joey Hess <id@joeyh.name>
- -
- Licensed under the GNU AGPL version 3 or higher. - Licensed under the GNU AGPL version 3 or higher.
-} -}
@ -14,9 +14,13 @@ import Types.Availability
import qualified Types.Remote as Remote import qualified Types.Remote as Remote
import qualified Utility.RawFilePath as R import qualified Utility.RawFilePath as R
import qualified Git.Config import qualified Git.Config
import Logs.Proxy
import Types.Cluster
import Data.Time.Clock.POSIX import Data.Time.Clock.POSIX
import System.PosixCompat.Files (modificationTime) import System.PosixCompat.Files (modificationTime)
import qualified Data.Map as M
import qualified Data.Set as S
repoCheap :: Git.Repo -> Bool repoCheap :: Git.Repo -> Bool
repoCheap = not . Git.repoIsUrl repoCheap = not . Git.repoIsUrl
@ -62,9 +66,26 @@ gitRepoInfo r = do
[] -> "never" [] -> "never"
_ -> show $ posixSecondsToUTCTime $ realToFrac $ maximum mtimes _ -> show $ posixSecondsToUTCTime $ realToFrac $ maximum mtimes
repo <- Remote.getRepo r repo <- Remote.getRepo r
return let proxied = Git.Config.boolConfig $ isJust $
[ ("repository location", Git.repoLocation repo) remoteAnnexProxiedBy (Remote.gitconfig r)
, ("proxied", Git.Config.boolConfig proxies <- getProxies
(isJust (remoteAnnexProxiedBy (Remote.gitconfig r)))) let proxying = S.toList $ fromMaybe mempty $
, ("last synced", lastsynctime) M.lookup (Remote.uuid r) proxies
let iscluster = isClusterUUID . proxyRemoteUUID
let proxyname p = Remote.name r ++ "-" ++ proxyRemoteName p
let proxynames = map proxyname $ filter (not . iscluster) proxying
let clusternames = map proxyname $ filter iscluster proxying
return $ catMaybes
[ Just ("repository location", Git.repoLocation repo)
, Just ("last synced", lastsynctime)
, Just ("proxied", proxied)
, if isClusterUUID (Remote.uuid r)
then Just ("cluster", Git.Config.boolConfig True)
else Nothing
, if null clusternames
then Nothing
else Just ("gateway to cluster", unwords clusternames)
, if null proxynames
then Nothing
else Just ("proxying", unwords proxynames)
] ]

View file

@ -12,16 +12,21 @@ To use a cluster, your repository needs to have its gateway configured as a
remote. Clusters can currently only be accessed via ssh. This gateway remote. Clusters can currently only be accessed via ssh. This gateway
remote is added the same as any other git remote: remote is added the same as any other git remote:
git remote add bigserver me@bigserver:annex $ git remote add bigserver me@bigserver:annex
The gateway publishes information about the cluster to the git-annex The gateway publishes information about the cluster to the git-annex
branch. So you may need to fetch from it to learn about the cluster: branch. So you may need to fetch from it to learn about the cluster:
git fetch bigserver $ git fetch bigserver
That will make available an additional remote for the cluster, eg That will make available an additional remote for the cluster, eg
"bigserver-mycluster", as well as some remotes for each node eg "bigserver-mycluster", as well as some remotes for each node.
"bigserver-node1", "bigserver-node2", etc.
$ git annex info bigserver
...
gateway to cluster: bigserver-mycluster
proxying: bigserver-node1 bigserver-node2 bigserver-node3
...
You can get files from the cluster without caring which node it comes You can get files from the cluster without caring which node it comes
from: from: