@@ -17,8 +17,11 @@ import Control.Monad.Except
17
17
import Control.Monad.Reader (ask )
18
18
import Control.Monad.ST (ST , stToIO )
19
19
import Control.Monad.State
20
+ import Data.Attoparsec.ByteString qualified as A
21
+ import Data.Attoparsec.ByteString.Char8 qualified as A8
20
22
import Data.ByteString qualified as BS
21
23
import Data.ByteString.Lazy qualified as BL
24
+ import Data.Conduit.Attoparsec qualified as C
22
25
import Data.Conduit.List qualified as C
23
26
import Data.Conduit.Zlib qualified as C
24
27
import Data.Graph qualified as Graph
@@ -43,7 +46,6 @@ import Unison.Auth.HTTPClient qualified as Auth
43
46
import Unison.Cli.Monad (Cli )
44
47
import Unison.Cli.Monad qualified as Cli
45
48
import Unison.Codebase qualified as Codebase
46
- import Unison.Debug qualified as Debug
47
49
import Unison.Hash32 (Hash32 )
48
50
import Unison.Prelude
49
51
import Unison.Share.API.Hash qualified as Share
@@ -55,17 +57,13 @@ import Unison.Sync.Common qualified as Sync
55
57
import Unison.Sync.EntityValidation qualified as EV
56
58
import Unison.Sync.Types qualified as Share
57
59
import Unison.Sync.Types qualified as Sync
60
+ import Unison.SyncV2.API (Routes (downloadEntitiesStream ))
61
+ import Unison.SyncV2.API qualified as SyncV2
58
62
import Unison.SyncV2.Types (CBORBytes )
59
63
import Unison.SyncV2.Types qualified as SyncV2
60
64
import Unison.Util.Servant.CBOR qualified as CBOR
61
65
import Unison.Util.Timing qualified as Timing
62
66
import UnliftIO qualified as IO
63
- import Unison.SyncV2.API (Routes (downloadEntitiesStream ))
64
- import Unison.SyncV2.API qualified as SyncV2
65
- import Data.Attoparsec.ByteString qualified as A
66
- import Data.Attoparsec.ByteString.Char8 qualified as A8
67
- import Data.Conduit.Attoparsec qualified as C
68
-
69
67
70
68
type Stream i o = ConduitT i o StreamM ()
71
69
@@ -150,7 +148,6 @@ syncFromCodeserver shouldValidate unisonShareUrl branchRef hashJwt knownHashes _
150
148
(Cli. runTransaction (Q. entityLocation hash)) >>= \ case
151
149
Just Q. EntityInMainStorage -> pure $ Right ()
152
150
_ -> do
153
- Debug. debugLogM Debug. Temp $ " Kicking off sync request"
154
151
Timing. time " Entity Download" $ do
155
152
liftIO . C. runResourceT . runExceptT $ httpStreamEntities
156
153
authHTTPClient
@@ -417,12 +414,10 @@ SyncV2.Routes
417
414
-- You MUST consume the stream within the callback, it will be closed when the callback returns.
418
415
withConduit :: forall r . Servant. ClientEnv -> (Stream () SyncV2. DownloadEntitiesChunk -> StreamM r ) -> Servant. ClientM (Servant. SourceIO SyncV2. DownloadEntitiesChunk ) -> StreamM r
419
416
withConduit clientEnv callback clientM = do
420
- Debug. debugLogM Debug. Temp $ " Running clientM"
421
417
ExceptT $ withRunInIO \ runInIO -> do
422
418
Servant. withClientM clientM clientEnv $ \ case
423
419
Left err -> pure . Left . TransportError $ (handleClientError clientEnv err)
424
420
Right sourceT -> do
425
- Debug. debugLogM Debug. Temp $ " Converting sourceIO to conduit"
426
421
conduit <- liftIO $ Servant. fromSourceIO sourceT
427
422
(runInIO . runExceptT $ callback conduit)
428
423
0 commit comments