<$> remoteList
remotesides <- mapM (proxySshRemoteSide protocolversion) remotes
return $ ProxySelector
- { proxyCHECKPRESENT = \k -> error "TODO"
- , proxyGET = \k -> do
- locs <- S.fromList <$> loggedLocations k
- case filter (flip S.member locs . remoteUUID) remotesides of
- -- TODO: Avoid always using same remote
- (r:_) -> return (Just r)
- [] -> return Nothing
+ { proxyCHECKPRESENT = nodecontaining remotesides
+ , proxyGET = nodecontaining remotesides
, proxyPUT = \k -> error "TODO"
, proxyREMOVE = \k -> error "TODO"
-- Content is not locked on the cluster as a whole,
, proxyLOCKCONTENT = const (pure Nothing)
, proxyUNLOCKCONTENT = pure Nothing
}
+ where
+ nodecontaining remotesides k = do
+ locs <- S.fromList <$> loggedLocations k
+ case filter (flip S.member locs . remoteUUID) remotesides of
+ -- TODO: Avoid always using same remote
+ (r:_) -> return (Just r)
+ [] -> return Nothing
+
- actions.
- -}
data ProxySelector = ProxySelector
- { proxyCHECKPRESENT :: Key -> Annex RemoteSide
+ { proxyCHECKPRESENT :: Key -> Annex (Maybe RemoteSide)
, proxyLOCKCONTENT :: Key -> Annex (Maybe RemoteSide)
, proxyUNLOCKCONTENT :: Annex (Maybe RemoteSide)
, proxyREMOVE :: Key -> Annex RemoteSide
singleProxySelector :: RemoteSide -> ProxySelector
singleProxySelector r = ProxySelector
- { proxyCHECKPRESENT = const (pure r)
+ { proxyCHECKPRESENT = const (pure (Just r))
, proxyLOCKCONTENT = const (pure (Just r))
, proxyUNLOCKCONTENT = pure (Just r)
, proxyREMOVE = const (pure r)
proxyclientmessage Nothing = proxydone
proxyclientmessage (Just message) = case message of
- CHECKPRESENT k -> do
- remoteside <- proxyCHECKPRESENT proxyselector k
- proxyresponse remoteside message (const proxynextclientmessage)
+ CHECKPRESENT k -> proxyCHECKPRESENT proxyselector k >>= \case
+ Just remoteside ->
+ proxyresponse remoteside message
+ (const proxynextclientmessage)
+ Nothing ->
+ protoerrhandler proxynextclientmessage $
+ client $ net $ sendMessage FAILURE
LOCKCONTENT k -> proxyLOCKCONTENT proxyselector k >>= \case
Just remoteside ->
proxyresponse remoteside message
* Basic proxying to special remote support (non-streaming).
* Getting a key from a cluster should proxy from one of the nodes that has
- it, or from the proxy repository itself if it has the key.
+ it. (done)
* Getting a key from a cluster currently always selects the lowest cost
remote, and always the same remote if cost is the same. Should
* Implement upload with fanout and reporting back additional UUIDs over P2P
protocol.
-* On upload to a cluster, as well as fanout to nodes, if the key is
- preferred content of the proxy repository, store it there.
- (But not when preferred content is not configured.)
-
* Implement cluster drops, trying to remove from all nodes, and returning
which UUIDs it was dropped from.
check may fail to realize that dropping from multiple nodes does in fact
make it worse.
+* On upload to a cluster, as well as fanout to nodes, if the key is
+ preferred content of the proxy repository, store it there.
+ (But not when preferred content is not configured.)
+ And on download from a cluster, if the proxy repository has the content,
+ get it from there to avoid the overhead of proxying to a node.
+
* Support proxies-of-proxies better, eg foo-bar-baz.
Currently, it does work, but have to run `git-annex updateproxy`
on foo in order for it to notice the bar-baz proxied remote exists,