implemented servePutOffset and clientPutOffset

But, it's buggy: the server hangs without processing the VALIDITY,
and I can't seem to work out why. As far as I can see, storefile
is getting as far as running the validitycheck, which is supposed to
read that, but never does.

This is especially strange because what seems like the same protocol
doesn't hang when servePut runs it. This made me think that it needed
to use inAnnexWorker to be more like servePut, but that didn't help.

Another small problem with this is that it does create an empty
.git/annex/tmp/ file for the key. Since this will usually be used in
combination with servePut, that doesn't seem worth worrying about much.
This commit is contained in:
Joey Hess 2024-07-22 15:02:08 -04:00
parent c36b9cd1fc
commit 3069e28dd8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 110 additions and 31 deletions

View file

@ -73,7 +73,7 @@ seek o = getAnnexWorkerPool $ \workerpool -> do
-- XXX remove this
when (isNothing (portOption o)) $ do
liftIO $ putStrLn "test begins"
testPut
testPutOffset
giveup "TEST DONE"
withLocalP2PConnections workerpool $ \acquireconn -> liftIO $ do
authenv <- getAuthEnv
@ -182,11 +182,23 @@ testPut = do
(B64UUID (toUUID ("cu" :: String)))
[]
Nothing
(Just (Offset 584754208))
Nothing
(AssociatedFile (Just "foo"))
"bigfile3content"
1048576000
(liftIO (print "validity check") >> return True)
"emptyfile"
0
(liftIO (print "validity check") >> return False)
liftIO $ print res
testPutOffset = do
mgr <- httpManager <$> getUrlOptions
burl <- liftIO $ parseBaseUrl "http://localhost:8080/"
res <- liftIO $ clientPutOffset (mkClientEnv mgr burl)
(P2P.ProtocolVersion 3)
(B64Key (fromJust $ deserializeKey ("SHA256E-s1048576000--b460ca923520db561d01b99483e9e2fe65ff9dfbdd52c17acba6ac4e874e27d5")))
(B64UUID (toUUID ("f11773f0-11e1-45b2-9805-06db16768efe" :: String)))
(B64UUID (toUUID ("cu" :: String)))
[]
Nothing
liftIO $ print res
testRemove = do