preparing for cluster node selection
Support selecting what remote to proxy for each top-level P2P protocol message. This only needs to be extended now to support fanout to multiple nodes for PUT and REMOVE, and with a remote that fails for LOCKCONTENT and UNLOCKCONTENT. But a good first step would be to implement CHECKPRESENT and GET for clusters. Both should select a node that actually does have the content. That will allow a cluster to work for GET even when location tracking is out of date.
This commit is contained in:
parent
291280ced2
commit
7a839a983a
2 changed files with 89 additions and 72 deletions
|
@ -67,14 +67,16 @@ performProxy clientuuid servermode remote = do
|
|||
where
|
||||
withclientversion clientside (Just (clientmaxversion, othermsg)) = do
|
||||
remoteside <- proxySshRemoteSide clientmaxversion remote
|
||||
proxy p2pDone proxymethods servermode clientside remoteside
|
||||
othermsg p2pErrHandler
|
||||
protocolversion <- either (const (min P2P.maxProtocolVersion clientmaxversion)) id
|
||||
<$> runRemoteSide remoteside
|
||||
(P2P.net P2P.getProtocolVersion)
|
||||
let closer = do
|
||||
closeRemoteSide remoteside
|
||||
p2pDone
|
||||
proxy closer proxyMethods servermode clientside
|
||||
(const $ return remoteside)
|
||||
protocolversion othermsg p2pErrHandler
|
||||
withclientversion _ Nothing = p2pDone
|
||||
|
||||
proxymethods = ProxyMethods
|
||||
{ removedContent = \u k -> logChange k u InfoMissing
|
||||
, addedContent = \u k -> logChange k u InfoPresent
|
||||
}
|
||||
|
||||
performProxyCluster :: UUID -> ClusterUUID -> P2P.ServerMode -> CommandPerform
|
||||
performProxyCluster clientuuid clusteruuid servermode = do
|
||||
|
@ -84,9 +86,18 @@ performProxyCluster clientuuid clusteruuid servermode = do
|
|||
p2pErrHandler
|
||||
where
|
||||
withclientversion clientside (Just (clientmaxversion, othermsg)) = do
|
||||
giveup "TODO"
|
||||
let protocolversion = min P2P.maxProtocolVersion clientmaxversion
|
||||
let selectnode = giveup "FIXME" -- FIXME
|
||||
proxy p2pDone proxyMethods servermode clientside selectnode
|
||||
protocolversion othermsg p2pErrHandler
|
||||
withclientversion _ Nothing = p2pDone
|
||||
|
||||
proxyMethods :: ProxyMethods
|
||||
proxyMethods = ProxyMethods
|
||||
{ removedContent = \u k -> logChange k u InfoMissing
|
||||
, addedContent = \u k -> logChange k u InfoPresent
|
||||
}
|
||||
|
||||
proxyClientSide :: UUID -> Annex ClientSide
|
||||
proxyClientSide clientuuid = do
|
||||
clientrunst <- liftIO (mkRunState $ Serving clientuuid Nothing)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue