#endif
type ClientAction a
+#ifdef WITH_SERVANT
= ClientEnv
-> ProtocolVersion
-> B64UUID ServerSide
-> [B64UUID Bypass]
-> Maybe Auth
-> Annex (Either ClientError a)
+#else
+ = ()
+#endif
p2pHttpClient
:: Remote
-> (String -> Annex a)
-#ifdef WITH_SERVANT
-> ClientAction a
-#endif
-> Annex a
#ifdef WITH_SERVANT
p2pHttpClient rmt fallback clientaction =
M.insert (Git.CredentialBaseURL credentialbaseurl) cred cc
Nothing -> noop
#else
-runP2PHttpClient rmt fallback = fallback "This remote uses an annex+http url, but this version of git-annex is not build with support for that."
+runP2PHttpClient rmt fallback () = fallback
+ "This remote uses an annex+http url, but this version of git-annex is not build with support for that."
#endif
#ifdef WITH_SERVANT
-
clientGet
:: ClientEnv
-> ProtocolVersion
withClientM (cli k cu bypass af mo auth) clientenv $ \case
Left err -> throwM err
Right respheaders -> do
- b <- S.unSourceT (getResponse respheaders) gatherByteString
+ b <- S.unSourceT (getResponse respheaders) gather
liftIO $ withBinaryFile (fromRawFilePath dest) WriteMode $ \h -> do
case startsz of
Just startsz' | startsz' /= 0 ->
v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI
-gatherByteString :: S.StepT IO B.ByteString -> IO L.ByteString
-gatherByteString = unsafeInterleaveIO . go
- where
- go S.Stop = return LI.Empty
- go (S.Error err) = giveup err
- go (S.Skip s) = go s
- go (S.Effect ms) = ms >>= go
- go (S.Yield v s) = LI.Chunk v <$> unsafeInterleaveIO (go s)
+ gather = unsafeInterleaveIO . gather'
+ gather' S.Stop = return LI.Empty
+ gather' (S.Error err) = giveup err
+ gather' (S.Skip s) = gather' s
+ gather' (S.Effect ms) = ms >>= gather'
+ gather' (S.Yield v s) = LI.Chunk v <$> unsafeInterleaveIO (gather' s)
+#endif
clientCheckPresent :: Key -> ClientAction Bool
+#ifdef WITH_SERVANT
clientCheckPresent key clientenv (ProtocolVersion ver) su cu bypass auth =
liftIO $ withClientM (cli su (B64Key key) cu bypass auth) clientenv $ \case
Left err -> return (Left err)
_ :<|> _ :<|> _ :<|> _ :<|>
v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI
+#else
+clientCheckPresent _ = ()
+#endif
+#ifdef WITH_SERVANT
clientRemove
:: ClientEnv
-> ProtocolVersion
_ :<|> _ :<|> _ :<|> _ :<|>
_ :<|> _ :<|> _ :<|> _ :<|>
v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI
+#endif
+#ifdef WITH_SERVANT
clientRemoveBefore
:: ClientEnv
-> ProtocolVersion
_ :<|> _ :<|> _ :<|> _ :<|>
_ :<|> _ :<|> _ :<|> _ :<|>
v3 :<|> _ = client p2pHttpAPI
+#endif
+#ifdef WITH_SERVANT
clientGetTimestamp
:: ClientEnv
-> ProtocolVersion
_ :<|> _ :<|> _ :<|> _ :<|>
_ :<|>
v3 :<|> _ = client p2pHttpAPI
+#endif
+#ifdef WITH_SERVANT
clientPut
:: ClientEnv
-> ProtocolVersion
_ :<|>
_ :<|>
v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI
+#endif
+#ifdef WITH_SERVANT
clientPutOffset
:: ClientEnv
-> ProtocolVersion
_ :<|>
_ :<|> _ :<|> _ :<|> _ :<|>
v3 :<|> v2 :<|> v1 :<|> _ = client p2pHttpAPI
+#endif
+#ifdef WITH_SERVANT
clientLockContent
:: ClientEnv
-> ProtocolVersion
_ :<|> _ :<|> _ :<|> _ :<|>
_ :<|> _ :<|> _ :<|>
v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI
+#endif
+#ifdef WITH_SERVANT
clientKeepLocked
:: ClientEnv
-> ProtocolVersion
v3 :<|> v2 :<|> v1 :<|> v0 :<|> _ = client p2pHttpAPI
#endif
--- ^ WITH_SERVANT
| Git.repoIsUrl repo = checkremote
| otherwise = checklocal
where
- checkp2phttp = p2pHttpClient rmt giveup
-#ifdef WITH_SERVANT
- (clientCheckPresent key)
-#endif
+ checkp2phttp = p2pHttpClient rmt giveup (clientCheckPresent key)
checkhttp = do
gc <- Annex.getGitConfig
Url.withUrlOptionsPromptingCreds $ \uo ->
| not $ Git.repoIsUrl repo = guardUsable repo (giveup "cannot access remote") $ do
u <- getUUID
hardlink <- wantHardLink
- let bwlimit = remoteAnnexBwLimitDownload (gitconfig r)
- <|> remoteAnnexBwLimit (gitconfig r)
-- run copy from perspective of remote
onLocalFast st $ Annex.Content.prepSendAnnex' key Nothing >>= \case
Just (object, _sz, check) -> do
(Ssh.runProto r connpool (return (False, UnVerified)))
key file dest meterupdate vc
| otherwise = giveup "copying from non-ssh, non-http remote not supported"
+ where
+ bwlimit = remoteAnnexBwLimitDownload (gitconfig r)
+ <|> remoteAnnexBwLimit (gitconfig r)
copyFromRemoteCheap :: State -> Git.Repo -> Maybe (Key -> AssociatedFile -> FilePath -> Annex ())
#ifndef mingw32_HOST_OS